1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

Ruby plugins: apply code changes as suggested by "rubocop --auto-correct"

This commit is contained in:
Lars Kruse 2020-08-25 17:06:15 +02:00
parent b0b39b018e
commit 809639ab65
33 changed files with 904 additions and 910 deletions

View file

@ -15,29 +15,29 @@
# reports how long the puppet agent took to apply the catalog
def get_runtime
logfile = ENV["puppet_logfile"] || "/var/log/messages"
logfile = ENV['puppet_logfile'] || '/var/log/messages'
t = Time.now
dateformat = ENV["puppet_logformat"] || "^%b %d"
dateformat = ENV['puppet_logformat'] || '^%b %d'
today = t.strftime(dateformat)
File.open(logfile).grep(/#{today}/).grep(/Finished catalog run in/).reverse_each do |line|
if line =~ /in (.*) seconds/
puts "runtime.value #{$1}"
puts "runtime.value #{Regexp.last_match(1)}"
exit 0
end
end
end
case ARGV[0]
when "config"
puts "graph_category other"
puts "graph_args --base 1000 -l 0"
puts "graph_scale no"
puts "graph_title puppet catalog run time"
puts "graph_vlabel Seconds"
puts "runtime.label Catalog application time"
when 'config'
puts 'graph_category other'
puts 'graph_args --base 1000 -l 0'
puts 'graph_scale no'
puts 'graph_title puppet catalog run time'
puts 'graph_vlabel Seconds'
puts 'runtime.label Catalog application time'
exit 0
when "autoconf"
puts "yes"
when 'autoconf'
puts 'yes'
exit 0
else
get_runtime