From d2491a19775f180ebd1bec367f7324fb1766e1b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= Date: Mon, 17 Jun 2013 16:05:35 -0400 Subject: [PATCH 1/4] use a proper interpretor env is not in /bin in debian --- plugins/puppet/puppetmaster | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/puppet/puppetmaster b/plugins/puppet/puppetmaster index aa46b875..d3925def 100755 --- a/plugins/puppet/puppetmaster +++ b/plugins/puppet/puppetmaster @@ -1,4 +1,4 @@ -#! /bin/env ruby +#!/usr/bin/ruby # returns the mem usage of a given process def plist(psname) From ee0f13f366e444faef795042490c7cf6e7ac52e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= Date: Mon, 17 Jun 2013 16:36:28 -0400 Subject: [PATCH 2/4] allow customizing tiem format, use standard by default, syslog doesn't use iso timestamps.. --- plugins/puppet/puppetmaster | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/puppet/puppetmaster b/plugins/puppet/puppetmaster index d3925def..b11aaf9e 100755 --- a/plugins/puppet/puppetmaster +++ b/plugins/puppet/puppetmaster @@ -19,8 +19,9 @@ def phaselog logfile = ENV['puppet_logfile'] || '/var/log/messages' count,avg,day_count_unique,day_count = 0 ,0 ,0, 0 t = Time.now - today = t.strftime("^%Y-%m-%dT") - hour = t.strftime("^%Y-%m-%dT%H:") + dateformat = ENV['puppet_logformat'] || "^%b %d" + today = t.strftime(dateformat) + hour = t.strftime(dateformat + " %H:") m = t.min.to_i last5m = "" 6.times do |i| From e5be4561c0b796cf410e8bd5b7f659d32e866dab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= Date: Mon, 17 Jun 2013 16:25:16 -0400 Subject: [PATCH 3/4] specify units of compilation time --- plugins/puppet/puppetmaster | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/puppet/puppetmaster b/plugins/puppet/puppetmaster index b11aaf9e..5cc84cec 100755 --- a/plugins/puppet/puppetmaster +++ b/plugins/puppet/puppetmaster @@ -79,7 +79,7 @@ case ARGV[0] puts "graph_title puppet clients usage" puts "graph_vlabel clients" puts "known_clients.label Known Clients" - puts "avg_compile.label Average configuration compile" + puts "avg_compile.label Average configuration compile, in seconds" puts "last5m_count.label Clients in the last 5 minutes" puts "last24h_unique_count.label unique clients in the last 24 hours" end From 93a7c79350719b4a0058be19f4b0d7d93551f6a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= Date: Tue, 9 Jul 2013 22:03:12 -0400 Subject: [PATCH 4/4] document the plugin --- plugins/puppet/puppetmaster | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/plugins/puppet/puppetmaster b/plugins/puppet/puppetmaster index 5cc84cec..13c7a706 100755 --- a/plugins/puppet/puppetmaster +++ b/plugins/puppet/puppetmaster @@ -1,5 +1,28 @@ #!/usr/bin/ruby +# this plugin reports various performance statistics from a puppetmaster +# server and client +# +# linked as puppet_mem, it will display memory usage of the puppet +# client and puppet master on the local server. +# +# linked as puppet_clients, it will report the average compile time, the +# number of clients that checked in in the last 5 minutes and 24h and +# the number of known clients. +# +# it requires read access to the puppet logfile. +# +# CONFIGURATION +# +# [puppet*] +# env.puppet_logfile /var/log/message +# env.puppet_logformat "^%b %d" +# +# the logfile is where the puppetmaster is expected to log its +# compilation statistics. the format is the format of the date syslog +# writes to the file, which may vary according to locale and +# configuration. + # returns the mem usage of a given process def plist(psname) counter = 0