Node status tracking time stamp


#1

Ohai Chefs,

Can you please explain to me how is Management console tracking nodes i.e.
their status? - What I precisely mean how does it check date/time when was
last chef-client run? How do you get that time stamp information from code
perspective?

I haven’t found code around that, that’s why I ask.

Chef server api docs are great but haven’t found commands which would help
me to retrieve something from Chef server with precise date/time when
something was changed and what exactly has been changed.

Thanks in advance,

J.


#2

On Monday, February 3, 2014 at 9:17 AM, Jasna Benčić wrote:

Ohai Chefs,

Can you please explain to me how is Management console tracking nodes i.e. their status? - What I precisely mean how does it check date/time when was last chef-client run? How do you get that time stamp information from code perspective?

I haven’t found code around that, that’s why I ask.

Chef server api docs are great but haven’t found commands which would help me to retrieve something from Chef server with precise date/time when something was changed and what exactly has been changed.

Thanks in advance,

J.
If you’re talking about the “classic” status page which just lists the last time chef ran (and has the same info as knife status), that timestamp comes from ohai as the “ohai_time” attribute, which you can observe during a chef run with node[“ohai_time”]. Source: https://github.com/opscode/ohai/blob/master/lib/ohai/plugins/ohai_time.rb

If you’re talking about the new reporting data on preview.opscode.com (can also be installed in on-premises Enterprise Chef), that data is collected by the resource reporter: https://github.com/opscode/chef/blob/master/lib/chef/resource_reporter.rb I haven’t personally tried it, but if you want an open source option for reporting what chef has changed on a system, you could try this: https://github.com/theforeman/chef-handler-foreman

HTH,


Daniel DeLeo


#3

If you’re talking about the “classic” status page which just lists the
last time chef ran (and has the same info as knife status), that
timestamp comes from ohai as the “ohai_time” attribute, which you can
observe during a chef run with node["ohai_time"]. Source:
https://github.com/opscode/ohai/blob/master/lib/ohai/plugins/ohai_time.rb

Exactly that

If you’re talking about the new reporting data on preview.opscode.com(can also be installed in on-premises Enterprise Chef), that data is
collected by the resource reporter:
https://github.com/opscode/chef/blob/master/lib/chef/resource_reporter.rbI haven’t personally tried it, but if you want an open source option for
reporting what chef has changed on a system, you could try this:
https://github.com/theforeman/chef-handler-foreman

HTH,


Daniel DeLeo

But, also links on second paragraph are really helpful . One more question.
Is it possible to pull off something like that for cookbooks that are on
Chef server? So I get their last change and time when change has happened.


#4

On Monday, February 3, 2014 at 9:51 AM, Jasna Benčić wrote:

If you’re talking about the “classic” status page which just lists the last time chef ran (and has the same info as knife status), that timestamp comes from ohai as the “ohai_time” attribute, which you can observe during a chef run with node[“ohai_time”]. Source: https://github.com/opscode/ohai/blob/master/lib/ohai/plugins/ohai_time.rb

Exactly that

If you’re talking about the new reporting data on preview.opscode.com (http://preview.opscode.com) (can also be installed in on-premises Enterprise Chef), that data is collected by the resource reporter: https://github.com/opscode/chef/blob/master/lib/chef/resource_reporter.rb I haven’t personally tried it, but if you want an open source option for reporting what chef has changed on a system, you could try this: https://github.com/theforeman/chef-handler-foreman

HTH,


Daniel DeLeo

But, also links on second paragraph are really helpful . One more question. Is it possible to pull off something like that for cookbooks that are on Chef server? So I get their last change and time when change has happened.

For the moment, no. You’d have to parse the HTTP logs, which might require a custom log format to record info from the authentication headers. This is something we’re actively working on.


Daniel DeLeo


#5

Ok, many thanks Daniel.

On Tue, Feb 4, 2014 at 3:07 AM, Daniel DeLeo dan@kallistec.com wrote:

On Monday, February 3, 2014 at 9:51 AM, Jasna Benčić wrote:

If you’re talking about the “classic” status page which just lists the
last time chef ran (and has the same info as knife status), that
timestamp comes from ohai as the “ohai_time” attribute, which you can
observe during a chef run with node[“ohai_time”]. Source:
https://github.com/opscode/ohai/blob/master/lib/ohai/plugins/ohai_time.rb

Exactly that

If you’re talking about the new reporting data on preview.opscode.com(can also be installed in on-premises Enterprise Chef), that data is
collected by the resource reporter:
https://github.com/opscode/chef/blob/master/lib/chef/resource_reporter.rbI haven’t personally tried it, but if you want an open source option for
reporting what chef has changed on a system, you could try this:
https://github.com/theforeman/chef-handler-foreman

HTH,


Daniel DeLeo

But, also links on second paragraph are really helpful . One more
question. Is it possible to pull off something like that for cookbooks that
are on Chef server? So I get their last change and time when change has
happened.

For the moment, no. You’d have to parse the HTTP logs, which might
require a custom log format to record info from the authentication headers.
This is something we’re actively working on.


Daniel DeLeo


#6

On 2/3/2014 9:07 PM, Daniel DeLeo wrote:

On Monday, February 3, 2014 at 9:51 AM, Jasna Benčić wrote:

If you’re talking about the “classic” status page which just lists
the last time chef ran (and has the same info as knife status),
that timestamp comes from ohai as the “ohai_time” attribute, which
you can observe during a chef run with node[“ohai_time”].
Source: https://github.com/opscode/ohai/blob/master/lib/ohai/plugins/ohai_time.rb

Exactly that

There is a handler as part of knife-lastrun. We started using
this handler and love it.

https://github.com/jgoulah/knife-lastrun

Direct link to the handler’s code so you can see what it stores
on each node object:

Super. A++++. Would install again.

Jeff Blaine

If you’re talking about the new reporting data on preview.opscode.com
http://preview.opscode.com (can also be installed in on-premises
Enterprise Chef), that data is collected by the resource
reporter: https://github.com/opscode/chef/blob/master/lib/chef/resource_reporter.rb
I haven’t personally tried it, but if you want an open source option
for reporting what chef has changed on a system, you could try
this: https://github.com/theforeman/chef-handler-foreman


#7

There is a handler as part of knife-lastrun. We started using
this handler and love it.

https://github.com/jgoulah/knife-lastrun

Direct link to the handler’s code so you can see what it stores
on each node object:

https://github.com/jgoulah/knife-lastrun/blob/master/lib/lastrun_update.rb

Super. A++++. Would install again.

Jeff Blaine

Thanks Jeff, that is a very handy plugin