mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-23 06:35:42 +00:00
Merge pull request #601 from sugamasao/feature-unicorn-change-pid-name
unicorn_memory_status/unicorn_status change pid name
This commit is contained in:
commit
f05e3897d5
2 changed files with 12 additions and 6 deletions
|
@ -10,12 +10,15 @@
|
||||||
# set path to your rails app
|
# set path to your rails app
|
||||||
RAILS_ROOT = "/path/to/rails/app"
|
RAILS_ROOT = "/path/to/rails/app"
|
||||||
|
|
||||||
|
# set name to your unicorn.pid
|
||||||
|
PID_NAME = "unicorn.pid"
|
||||||
|
|
||||||
module Munin
|
module Munin
|
||||||
class UnicornMemoryStatus
|
class UnicornMemoryStatus
|
||||||
attr_reader :pid_file
|
attr_reader :pid_file
|
||||||
|
|
||||||
def initialize(rails_root)
|
def initialize(rails_root, pid_name)
|
||||||
@pid_file = "#{rails_root}/tmp/pids/unicorn.pid"
|
@pid_file = "#{rails_root}/tmp/pids/#{pid_name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def master_pid
|
def master_pid
|
||||||
|
@ -75,6 +78,6 @@ when "config"
|
||||||
puts "total_memory.label total_memory"
|
puts "total_memory.label total_memory"
|
||||||
puts "total_memory.draw LINE2"
|
puts "total_memory.draw LINE2"
|
||||||
else
|
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}"
|
puts "total_memory.value #{m.total_memory}"
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,12 +10,15 @@
|
||||||
# set path to your rails app
|
# set path to your rails app
|
||||||
RAILS_ROOT = "/path/to/rails/app"
|
RAILS_ROOT = "/path/to/rails/app"
|
||||||
|
|
||||||
|
# set name to your unicorn.pid
|
||||||
|
PID_NAME = "unicorn.pid"
|
||||||
|
|
||||||
module Munin
|
module Munin
|
||||||
class UnicornStatus
|
class UnicornStatus
|
||||||
attr_reader :pid_file
|
attr_reader :pid_file
|
||||||
|
|
||||||
def initialize(rails_root)
|
def initialize(rails_root, pid_name)
|
||||||
@pid_file = "#{rails_root}/tmp/pids/unicorn.pid"
|
@pid_file = "#{rails_root}/tmp/pids/#{pid_name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def master_pid
|
def master_pid
|
||||||
|
@ -73,7 +76,7 @@ when "config"
|
||||||
puts "total_worker.label total_workers"
|
puts "total_worker.label total_workers"
|
||||||
puts "idle_worker.label idle_workers"
|
puts "idle_worker.label idle_workers"
|
||||||
else
|
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 "total_worker.value #{m.worker_count}"
|
||||||
puts "idle_worker.value #{m.idle_worker_count}"
|
puts "idle_worker.value #{m.idle_worker_count}"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue