summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--files/master/puppetlast18
-rw-r--r--manifests/puppetmaster.pp2
-rw-r--r--manifests/puppetmaster/checklastrun.pp13
3 files changed, 33 insertions, 0 deletions
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 <aj@junglist.gen.nz>
+# 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
diff --git a/manifests/puppetmaster.pp b/manifests/puppetmaster.pp
index 7e80792..f1fcc89 100644
--- a/manifests/puppetmaster.pp
+++ b/manifests/puppetmaster.pp
@@ -13,6 +13,8 @@ class puppet::puppetmaster inherits puppet {
}
}
include puppet::puppetmaster::base
+
+ puppet::puppetmaster::checklastrun
}
class puppet::puppetmaster::base inherits puppet::base {
diff --git a/manifests/puppetmaster/checklastrun.pp b/manifests/puppetmaster/checklastrun.pp
new file mode 100644
index 0000000..3c5708c
--- /dev/null
+++ b/manifests/puppetmaster/checklastrun.pp
@@ -0,0 +1,13 @@
+class puppet::puppetmaster::checklastrun {
+ include ibp::opt::bin
+ file{'/opt/bin/puppetlast':
+ source => [ "puppet://$server/files/puppet/master/puppetlast",
+ "puppet://$server/puppet/master/puppetlast"],
+ owner => root, group => 0, mode =0700;
+ }
+ file{'/etc/cron.d/puppetlast.cron':
+ content => "40 22 * * * root /opt/bin/puppetlast"
+ require => File['/opt/bin/puppetlast'],
+ owner => root, group => 0, mode => 0644;
+ }
+}