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.4.7 examples/process_usage.rb
kurchatov-0.4.6 examples/process_usage.rb
kurchatov-0.4.5 examples/process_usage.rb
kurchatov-0.4.4 examples/process_usage.rb
kurchatov-0.4.3 examples/process_usage.rb
kurchatov-0.4.2 examples/process_usage.rb
kurchatov-0.4.1 examples/process_usage.rb
kurchatov-0.3.8 examples/process_usage.rb
kurchatov-0.3.7 examples/process_usage.rb
kurchatov-0.3.6 examples/process_usage.rb
kurchatov-0.3.5 examples/process_usage.rb
kurchatov-0.3.4 examples/process_usage.rb
kurchatov-0.3.3 examples/process_usage.rb
kurchatov-0.3.2 examples/process_usage.rb
kurchatov-0.3.1 examples/process_usage.rb
kurchatov-0.3.0 examples/process_usage.rb
kurchatov-0.2.9 examples/process_usage.rb
kurchatov-0.2.8 examples/process_usage.rb
kurchatov-0.2.7 examples/process_usage.rb
kurchatov-0.2.6 examples/process_usage.rb