riemann-util

Install

class RiemannMonitor

A small abstraction over riemann client that provides defaults, demands required fields and simplifies event dispatching.

Example

var RiemannMonitor =require('riemann-util').RiemannMonitor;

var monitor =newRiemannMonitor({

role:'ninja',

ttl:60*60,// 1 hour in seconds

});

var client =... get a reference to riemann client somehow

monitor.bindClient(client);

monitor.send({

metric:5,

description:'bar and foo',

service:'bar'

});

RiemannMonitor.Ctor(config)

contructs a riemann monitor.

config - see below

RimannMonitor.bindClient(client)

Binds a node.js riemann client to this monitor instance. Monitor will discard events if a client is not bound. If a client is not bound while the first event sent to the monitor, a single warning will be printed using console.warn()

client - an instance of a node.js riemann client

RiemannMonitor.send(event)

Sends an event to riemman. Defaults from config will be applied. Event data here will always override the config, except for tags, which will be concatenated to default tags.