5 nodes = JSON.parse(IO.popen(["knife", "status", "-c", "/var/lib/chef/.chef/knife.rb", "-F", "json"]).read).sort_by { |node| node["name"] }
8 puts "graph_title Chef node status"
9 puts "graph_args --base 1000 --logarithmic"
10 puts "graph_vlabel Time since last checkin"
11 puts "graph_category chef"
14 name = node["name"].split(".").first
16 puts "#{name}.label #{name}"
17 puts "#{name}.type GAUGE"
19 puts "#{name}.warning 14400"
20 puts "#{name}.critical 43200"
24 name = node["name"].split(".").first
25 time = Time.now.to_f - node["ohai_time"]
27 puts "#{name}.value #{time}"