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

@ -11,11 +11,11 @@
memory_stats_command = ENV['memory_stats_command'] || '/opt/ruby-enterprise-1.8.6-20080810/bin/passenger-memory-stats'
if ARGV.length > 0 && ARGV[0] == 'config'
puts "graph_title Passenger Memory Usage"
puts "graph_category webserver"
puts "graph_vlabel MB"
puts "apache_rss.label Apache Dirty RSS"
puts "passenger_rss.label Passenger Dirty RSS"
puts 'graph_title Passenger Memory Usage'
puts 'graph_category webserver'
puts 'graph_vlabel MB'
puts 'apache_rss.label Apache Dirty RSS'
puts 'passenger_rss.label Passenger Dirty RSS'
exit(0)
end

View file

@ -8,13 +8,13 @@
process_stats_command = ENV['process_stats_command'] || '/opt/ruby-enterprise-1.8.6-20080810/bin/passenger-status'
if ARGV.length > 0 && ARGV[0] == 'config'
puts "graph_title Passenger Processes"
puts "graph_category webserver"
puts "graph_vlabel processes"
puts "max.label Max processes"
puts "count.label Total processes"
puts "active.label Active processes"
puts "queued.label Queued requests"
puts 'graph_title Passenger Processes'
puts 'graph_category webserver'
puts 'graph_vlabel processes'
puts 'max.label Max processes'
puts 'count.label Total processes'
puts 'active.label Active processes'
puts 'queued.label Queued requests'
exit(0)
end
@ -24,13 +24,14 @@ active = nil
queued = nil
`#{process_stats_command}`.each_line do |line|
if /max\s+=\s+(\d+)/.match(line)
case line
when /max\s+=\s+(\d+)/
max = $~[1]
elsif /count\s+=\s+(\d+)/.match(line)
when /count\s+=\s+(\d+)/
count = $~[1]
elsif /^active\s+=\s+(\d+)/.match(line)
when /^active\s+=\s+(\d+)/
active = $~[1]
elsif /Waiting on global queue\s+=\s+(\d+)/.match(line)
when /Waiting on global queue\s+=\s+(\d+)/
queued = $~[1]
end
end

View file

@ -28,27 +28,27 @@ end
def output_values
status = `sudo passenger-status`
unless $?.success?
$stderr.puts "failed executing passenger-status"
warn 'failed executing passenger-status'
exit 1
end
status =~ /max\s+=\s+(\d+)/
puts "max.value #{$1}"
puts "max.value #{Regexp.last_match(1)}"
status =~ /count\s+=\s+(\d+)/
puts "running.value #{$1}"
puts "running.value #{Regexp.last_match(1)}"
status =~ /active\s+=\s+(\d+)/
puts "active.value #{$1}"
puts "active.value #{Regexp.last_match(1)}"
status =~ /Waiting on global queue:\s+(\d+)/
puts "waiting.value #{$1}"
puts "waiting.value #{Regexp.last_match(1)}"
total_sessions = 0
status.scan(/Sessions: (\d+)/).flatten.each { |count| total_sessions += count.to_i }
puts "sessions.value #{total_sessions}"
end
if ARGV[0] == "config"
if ARGV[0] == 'config'
output_config
else
output_values