Sha256: 6a36712ae0f10e22518f2124985526245be30591a31833627a0449d371c3d4ea

Contents?: true

Size: 540 Bytes

Versions: 16

Compression:

Stored size: 540 Bytes

Contents

require 'json'

class Riemann::Babbler::Cloudclients < Riemann::Babbler

  def init
    plugin.set_default(:service, 'cloud clients')
    plugin.set_default(:interval, 60)
    plugin.set_default(:url, 'http://localhost/client/all')
  end

  def collect
    clients = 0
    json = JSON.parse rest_get(plugin.url)
    json.each { |client| clients += 1 if client[1]["state"] == "ESTABLISHED" }
    {:service => plugin.service + " established", :description => "online clients in #{plugin.url}", :metric => clients, :state => 'ok' }
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
riemann-babbler-1.0.7.2 lib/riemann/babbler/plugins/cloudclients.rb
riemann-babbler-1.0.7.1 lib/riemann/babbler/plugins/cloudclients.rb
riemann-babbler-1.0.7 lib/riemann/babbler/plugins/cloudclients.rb
riemann-babbler-1.0.6 lib/riemann/babbler/plugins/cloudclients.rb
riemann-babbler-1.0.5.7 lib/riemann/babbler/plugins/cloudclients.rb
riemann-babbler-1.0.5.6 lib/riemann/babbler/plugins/cloudclients.rb
riemann-babbler-1.0.5.5 lib/riemann/babbler/plugins/cloudclients.rb
riemann-babbler-1.0.5.4 lib/riemann/babbler/plugins/cloudclients.rb
riemann-babbler-1.0.5.3 lib/riemann/babbler/plugins/cloudclients.rb
riemann-babbler-1.0.5.2 lib/riemann/babbler/plugins/cloudclients.rb
riemann-babbler-1.0.5.1 lib/riemann/babbler/plugins/cloudclients.rb
riemann-babbler-1.0.5 lib/riemann/babbler/plugins/cloudclients.rb
riemann-babbler-1.0.4 lib/riemann/babbler/plugins/cloudclients.rb
riemann-babbler-1.0.3 lib/riemann/babbler/plugins/cloudclients.rb
riemann-babbler-1.0.2 lib/riemann/babbler/plugins/cloudclients.rb
riemann-babbler-1.0.1 lib/riemann/babbler/plugins/cloudclients.rb