Sha256: d808b84ce3e46ac3f319087193ce14b6596fc5feeb7cac3585422956b968cec7
Contents?: true
Size: 726 Bytes
Versions: 13
Compression:
Stored size: 726 Bytes
Contents
require 'json' class Riemann::Babbler::Cloudrestreamerstatus < Riemann::Babbler def init plugin.set_default(:service, 'cloud restreamer 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 do |worker| next unless worker.has_key? "processors" worker["processors"].each do |key, client_hash| next unless client_hash.has_key? "clients" client_hash["clients"].each {|key| clients += 1} end end {:service => plugin.service, :description => "Cloud restreamer clients in #{plugin.url}", :metric => clients, :state => 'ok' } end end
Version data entries
13 entries across 13 versions & 1 rubygems