mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
unicorn_memory_status/unicorn_status change pid name
User to be able to change the pid name fixed at “unicorn.pid, but can be changed use `env.pid_name my_unicorn.pid`
This commit is contained in:
parent
acad90146d
commit
d2529b0cb4
@ -10,12 +10,15 @@
|
||||
# set path to your rails app
|
||||
RAILS_ROOT = "/path/to/rails/app"
|
||||
|
||||
# set name to your unicorn.pid
|
||||
PID_NAME = "unicorn.pid"
|
||||
|
||||
module Munin
|
||||
class UnicornMemoryStatus
|
||||
attr_reader :pid_file
|
||||
|
||||
def initialize(rails_root)
|
||||
@pid_file = "#{rails_root}/tmp/pids/unicorn.pid"
|
||||
def initialize(rails_root, pid_name)
|
||||
@pid_file = "#{rails_root}/tmp/pids/#{pid_name}"
|
||||
end
|
||||
|
||||
def master_pid
|
||||
@ -75,6 +78,6 @@ when "config"
|
||||
puts "total_memory.label total_memory"
|
||||
puts "total_memory.draw LINE2"
|
||||
else
|
||||
m = Munin::UnicornMemoryStatus.new(ENV['rails_root'] || RAILS_ROOT)
|
||||
m = Munin::UnicornMemoryStatus.new(ENV['rails_root'] || RAILS_ROOT, ENV['pid_name'] || PID_NAME)
|
||||
puts "total_memory.value #{m.total_memory}"
|
||||
end
|
||||
|
@ -10,12 +10,15 @@
|
||||
# set path to your rails app
|
||||
RAILS_ROOT = "/path/to/rails/app"
|
||||
|
||||
# set name to your unicorn.pid
|
||||
PID_NAME = "unicorn.pid"
|
||||
|
||||
module Munin
|
||||
class UnicornStatus
|
||||
attr_reader :pid_file
|
||||
|
||||
def initialize(rails_root)
|
||||
@pid_file = "#{rails_root}/tmp/pids/unicorn.pid"
|
||||
def initialize(rails_root, pid_name)
|
||||
@pid_file = "#{rails_root}/tmp/pids/#{pid_name}"
|
||||
end
|
||||
|
||||
def master_pid
|
||||
@ -73,7 +76,7 @@ when "config"
|
||||
puts "total_worker.label total_workers"
|
||||
puts "idle_worker.label idle_workers"
|
||||
else
|
||||
m = Munin::UnicornStatus.new(ENV['rails_root'] || RAILS_ROOT)
|
||||
m = Munin::UnicornStatus.new(ENV['rails_root'] || RAILS_ROOT, ENV['pid_name'] || PID_NAME)
|
||||
puts "total_worker.value #{m.worker_count}"
|
||||
puts "idle_worker.value #{m.idle_worker_count}"
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user