Sha256: e2351ef7587694426dbb6b1c2688ed4854b2517919e804664b1b10237b2db83e

Contents?: true

Size: 774 Bytes

Versions: 65

Compression:

Stored size: 774 Bytes

Contents

interval 60

default[:pid_file] = '/etc/service/name/supervise/pid'

collect do
  if File.exists? plugin.pid_file
    pid = File.read(plugin.pid_file).chomp
    cpu_usage = shell("ps -p #{pid} S -o pcpu h").to_i
    mem_usage = shell("ps -p #{pid} S -o rss h").to_i
    event(:service => "process pid cpu #{plugin.pid_file}", :metric => cpu_usage, :description => "Cpu usage for process pid: #{plugin.pid_file}", :warning => 70, :critical => 90)
    event(:service => "process pid mem #{plugin.pid_file}", :metric => mem_usage.to_f / 1024, :description => "Mem (Mb) usage for process pid: #{plugin.pid_file}", :state => 'ok')
  else
    event(:service => "process pid #{plugin.pid_file}", :state => 'critical', :description => "File #{plugin.pid_file} not found")
  end
end

Version data entries

65 entries across 65 versions & 1 rubygems

Version Path
kurchatov-0.0.7 examples/process_usage.rb
kurchatov-0.0.7.pre.3 examples/process_usage.rb
kurchatov-0.0.7.pre.2 examples/process_usage.rb
kurchatov-0.0.7.pre.1 examples/process_usage.rb
kurchatov-0.0.6 examples/process_usage.rb
kurchatov-0.0.6.pre.5 examples/process_usage.rb
kurchatov-0.0.6.pre.4 examples/process_usage.rb
kurchatov-0.0.6.pre.3 examples/process_usage.rb
kurchatov-0.0.6.pre.2 examples/process_usage.rb
kurchatov-0.0.6.pre.1 examples/process_usage.rb
kurchatov-0.0.5 examples/process_usage.rb
kurchatov-0.0.5.pre5 examples/process_usage.rb
kurchatov-0.0.5.pre4 examples/process_usage.rb
kurchatov-0.0.5.pre2 examples/process_usage.rb
kurchatov-0.0.5.pre1 examples/process_usage.rb
kurchatov-0.0.4 examples/process_usage.rb
kurchatov-0.0.4d examples/process_usage.rb
kurchatov-0.0.4c examples/process_usage.rb
kurchatov-0.0.4b examples/process_usage.rb
kurchatov-0.0.3 examples/process_usage.rb