initial
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env ruby
|
||||
# $Id$
|
||||
|
||||
# returns the mem usage of a given process
|
||||
gmetric = %x{which gmetric}.chomp
|
||||
exit 0 unless gmetric != ""
|
||||
gmetric = "#{gmetric} --type=float --units=seconds --slope=positive --tmax=3600 --dmax=300000"
|
||||
debug = ARGV[0].nil? ? false : true
|
||||
test = debug ? "-t ": ""
|
||||
puts "DEBUG" if debug
|
||||
vals = %x{logtail2 #{test}/var/log/daemon.log |awk '/puppet-master.*Compiled catalog for/ {print $14}'|sort -n}.chomp.split(/\n/).collect { |v| v.to_f }
|
||||
puts vals if debug
|
||||
if vals.length > 0
|
||||
min = vals[0]
|
||||
max = vals[-1]
|
||||
mean = sprintf("%.2f",(vals.inject(0) { |r,v| r += v } / vals.length))
|
||||
out = %x{#{gmetric} --name="puppetmaster MIN compile time" --value=#{min}}
|
||||
out += %x{#{gmetric} --name="puppetmaster MAX compile time" --value=#{max}}
|
||||
out += %x{#{gmetric} --name="puppetmaster MEAN compile time" --value=#{mean}}
|
||||
puts out if debug
|
||||
end
|
||||
Reference in New Issue
Block a user