Chef-client cookbook chef-client run interval and delay are not exactly as it is in the real run


#1

I am using “chef-client” cookbook (depends ‘chef-client’, ‘~> 10.0.4’).

The interval of each chef-client run is controlled by “default[‘chef_client’][‘interval’]”.

So I have set my interval to 300 seconds as the below:

# Sets Chef::Config[:interval] via command-line option for number of seconds between chef-client daemon runs. Default 1800.
default['chef_client']['interval'] = '300'

Also there is a delay can be added on top of this interval:

# Sets Chef::Config[:splay] via command-line option for a random amount of seconds to add to interval. Default 300.
default['chef_client']['splay'] = '60'

So I expected to see chef-client run in between 5 to 6 mins?

However when I checked my RHEL7 message log output, to my surprise I found out that some of the chef-client run interval can be up to 7mins instead of up to 6mins.

The log says:

Jun 27 09:32:25 sg-mr-chef chef-client
Jun 27 09:39:18 sg-mr-chef chef-client
Jun 27 09:45:48 sg-mr-chef chef-client
Jun 27 09:53:03 sg-mr-chef chef-client
Jun 27 09:59:26 sg-mr-chef chef-client
Jun 27 10:06:37 sg-mr-chef chef-client
Jun 27 10:13:07 sg-mr-chef chef-client

It clearly shows some of the interval is more than 6mins. Is this expected?

Thanks


#2

If the chef-client kicks off at 1:00:00, runs for 45 seconds and then waits 300 seconds with a random additional splay of 0-60 seconds, the next run could kick off between 1:05:45-1:06:45. This fits what you’re seeing.


#3

Ah, I see, need to add the duration of the chef-client run as well. Thank you!