From 972d1f4b27d89ffcda90b1cbe5e7b1923af62c03 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 27 Dec 2008 20:40:50 +0000 Subject: added lastrun check --- files/master/puppetlast | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 files/master/puppetlast (limited to 'files') diff --git a/files/master/puppetlast b/files/master/puppetlast new file mode 100644 index 0000000..f547069 --- /dev/null +++ b/files/master/puppetlast @@ -0,0 +1,18 @@ +#!/usr/bin/env ruby +# Puppetlast, a script to output the last check-in time of nodes. Also outputs the cached configuration state, if expired or not. +# +# AJ "Fujin" Christensen +# changed by admin+puppet(at)immerda.ch to fit our needs +# +require 'puppet' + +Puppet[:config] = "/etc/puppet/puppet.conf" +Puppet.parse_config +Puppet[:name] = "puppetmasterd" +Puppet::Node::Facts.terminus_class = :yaml + +Puppet::Node::Facts.search("*").sort { |a,b| a.name <=> b.name }.each do |node| + if ((Time.now - node.values[:_timestamp]) / 60).floor > 720 then + puts "#{node.name} #{node.expired? ? 'cached expired, ' : ''}last checked #{((Time.now - node.values[:_timestamp]) / 60).floor} minutes ago" + end +end -- cgit v1.2.3