maketank-scripts from ansible
This commit is contained in:
15
roles/mkt-scripts/files/postfix/pflogsum-ganglia.rb
Executable file
15
roles/mkt-scripts/files/postfix/pflogsum-ganglia.rb
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/ruby
|
||||
|
||||
out = %x{/usr/sbin/logtail2 /var/log/mail.info |/usr/sbin/pflogsumm |/bin/grep -v "Grand Totals"|/usr/bin/head -22 |/usr/bin/awk '/\d+/ {print}'}.chomp
|
||||
|
||||
out.each_line { |line|
|
||||
line.delete!('"')
|
||||
line.strip!
|
||||
line.chomp!
|
||||
str = line.split(' ')
|
||||
met = str[1]
|
||||
val = str[0].delete('^0-9')
|
||||
cmd = "/usr/bin/gmetric -x 300 -d 30000 -g mail -t uint16 -D \"Postfix #{met}\" -n postfix_#{met} -v #{val}"
|
||||
puts cmd
|
||||
%x{#{cmd}}
|
||||
}
|
||||
Reference in New Issue
Block a user