Sha256: 6dc1712cd436d69150b8580e66be9d12398d43dbeeee82b06c71d41d0430521f

Contents?: true

Size: 871 Bytes

Versions: 9

Compression:

Stored size: 871 Bytes

Contents

require 'rusage'
$LOAD_PATH.unshift(File.expand_path('../lib', __FILE__))
require 'panoptimon-plugin-daemon_health/rollup'

config[:interval] ||= 60

start = then_ = Time.now
rolling = Rollup.new(start, config) # brief history

setup = ->() {
EM.add_periodic_timer(config[:interval], ->(){
  now = Time.now
  elapsed = now - then_

  metrics = rolling.roll(now).merge({
    'uptime' => (now - start).round(0),
    'rss'    => Process.rusage.maxrss,
    collectors:     monitor.collectors.length,
    active_plugins: monitor.plugins.keys.length,
    loaded_plugins: monitor.loaded_plugins.keys.length,
  })
  m = Metric.new('daemon_health', metrics)
  monitor.bus.notify(m)

  then_ = now
})
}

return ->(metric) {
  return if metric.has_key?('daemon_health|uptime') # skip our own data
  if setup; setup[] ; setup = nil; end
  rolling.log(metrics: metric.keys.length)
}

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
panoptimon-0.4.5 plugins/daemon_health/daemon_health.rb
panoptimon-0.4.4 plugins/daemon_health/daemon_health.rb
panoptimon-0.4.2 plugins/daemon_health/daemon_health.rb
panoptimon-0.4.1 plugins/daemon_health/daemon_health.rb
panoptimon-0.4.0 plugins/daemon_health/daemon_health.rb
panoptimon-0.3.0 plugins/daemon_health/daemon_health.rb
panoptimon-0.2.0 plugins/daemon_health/daemon_health.rb
panoptimon-0.1.0 plugins/daemon_health/daemon_health.rb
panoptimon-0.0.2 plugins/daemon_health/daemon_health.rb