Sha256: 3e30e6e9c3c1f4ca493e7480f73283892ce27b33d7ca9a04aa482174b12a3183

Contents?: true

Size: 616 Bytes

Versions: 14

Compression:

Stored size: 616 Bytes

Contents

require 'sys/proctable'

default[:pidfile] = '/var/run/service.pid'

collect do

  @pagesize ||= shell('/usr/bin/getconf PAGESIZE').to_i
  master_pid = File.read(plugin.pidfile).to_i
  mem_total = 0
  ::Sys::ProcTable.ps do |p|
    next unless p.pid == master_pid || p.ppid == master_pid
    mem_total += (p.rss * @pagesize).to_f / 1024
  end

  event(
    :diff => true,
    :description => "RSS usage delta #{plugin.pidfile}",
    :metric => mem_total,
    :service => "procmem #{plugin.pidfile}",
    :warning => 30*1024, #kibibytes
    :critical => 90*1024
  ) if File.stat(plugin.pidfile).mtime > interval

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
kurchatov-0.0.5.pre5 examples/proc_mem.rb
kurchatov-0.0.5.pre4 examples/proc_mem.rb
kurchatov-0.0.5.pre2 examples/proc_mem.rb
kurchatov-0.0.5.pre1 examples/proc_mem.rb
kurchatov-0.0.4 examples/proc_mem.rb
kurchatov-0.0.4d examples/proc_mem.rb
kurchatov-0.0.4c examples/proc_mem.rb
kurchatov-0.0.4b examples/proc_mem.rb
kurchatov-0.0.3 examples/proc_mem.rb
kurchatov-0.0.3b examples/proc_mem.rb
kurchatov-0.0.3a examples/proc_mem.rb
kurchatov-0.0.2 examples/proc_mem.rb
kurchatov-0.0.2b examples/proc_mem.rb
kurchatov-0.0.1 examples/proc_mem.rb