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