Sha256: ee9eb98c87f0cd10920473088d9c7464b7131792f0bd7865918e07c1f0f064ca

Contents?: true

Size: 628 Bytes

Versions: 51

Compression:

Stored size: 628 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

51 entries across 51 versions & 1 rubygems

Version Path
kurchatov-0.0.7 examples/proc_mem.rb
kurchatov-0.0.7.pre.3 examples/proc_mem.rb
kurchatov-0.0.7.pre.2 examples/proc_mem.rb
kurchatov-0.0.7.pre.1 examples/proc_mem.rb
kurchatov-0.0.6 examples/proc_mem.rb
kurchatov-0.0.6.pre.5 examples/proc_mem.rb
kurchatov-0.0.6.pre.4 examples/proc_mem.rb
kurchatov-0.0.6.pre.3 examples/proc_mem.rb
kurchatov-0.0.6.pre.2 examples/proc_mem.rb
kurchatov-0.0.6.pre.1 examples/proc_mem.rb
kurchatov-0.0.5 examples/proc_mem.rb