mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-25 02:18:08 +00:00
Ruby plugins: apply code changes as suggested by "rubocop --auto-correct"
This commit is contained in:
parent
b0b39b018e
commit
809639ab65
33 changed files with 904 additions and 910 deletions
|
@ -8,10 +8,10 @@
|
|||
#
|
||||
|
||||
# set path to your rails app
|
||||
RAILS_ROOT = "/path/to/rails/app"
|
||||
RAILS_ROOT = '/path/to/rails/app'.freeze
|
||||
|
||||
# set name to your unicorn.pid
|
||||
PID_NAME = "unicorn.pid"
|
||||
PID_NAME = 'unicorn.pid'.freeze
|
||||
|
||||
module Munin
|
||||
class UnicornStatus
|
||||
|
@ -30,8 +30,9 @@ module Munin
|
|||
ps_output = `ps w --ppid #{master_pid}`
|
||||
ps_output.split("\n").each do |line|
|
||||
chunks = line.strip.split(/\s+/, 5)
|
||||
pid, pcmd = chunks[0], chunks[4]
|
||||
next if pid !~ /\A\d+\z/ or pcmd !~ /worker/
|
||||
pid = chunks[0]
|
||||
pcmd = chunks[4]
|
||||
next if pid !~ /\A\d+\z/ || pcmd !~ /worker/
|
||||
|
||||
result << pid.to_i
|
||||
end
|
||||
|
@ -67,15 +68,15 @@ module Munin
|
|||
end
|
||||
|
||||
case ARGV[0]
|
||||
when "autoconf"
|
||||
puts "yes"
|
||||
when "config"
|
||||
when 'autoconf'
|
||||
puts 'yes'
|
||||
when 'config'
|
||||
puts "graph_title Unicorn [#{File.basename(__FILE__).gsub(/^unicorn_status_/, '')}] - Status"
|
||||
puts "graph_args -l 0"
|
||||
puts "graph_vlabel number of workers"
|
||||
puts "graph_category webserver"
|
||||
puts "total_worker.label total_workers"
|
||||
puts "idle_worker.label idle_workers"
|
||||
puts 'graph_args -l 0'
|
||||
puts 'graph_vlabel number of workers'
|
||||
puts 'graph_category webserver'
|
||||
puts 'total_worker.label total_workers'
|
||||
puts 'idle_worker.label idle_workers'
|
||||
else
|
||||
m = Munin::UnicornStatus.new(ENV['rails_root'] || RAILS_ROOT, ENV['pid_name'] || PID_NAME)
|
||||
puts "total_worker.value #{m.worker_count}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue