npm install dojot-clientlib
This library implements an Alarm Manager nodejs client for sending alarms to it through RabbitMQ.
The client sends a JSON formatted alarm event to the RabbitMQ instance of Alarm Manager. The alarm is enqueued until a server channel connection is available.
Alarms are JSON messages :
{
"namespace": "test.commons.backtrace",
"domain": "ApplicationCrash",
"description": "description to be written",
"severity": "Minor", [Warning, Minor, Major, Clear]
"primarySubject": {
"instance_id": "4",
"module_name": "My beautiful module"
},
"additionalData": {
"process_id": "1",
"signal": "1"
},
"eventTimestamp": "1"
}
And we send it through :
var clientlib = require('dojot-clientlib');
var ALARM = {
"namespace": "test.commons.backtrace",
"domain": "ApplicationCrash",
"description": "description to be written",
"severity": "Minor",
"primarySubject": {
"instance_id": "4",
"module_name": "My beautiful module"
},
"additionalData": {
"process_id": "1",
"signal": "1"
},
"eventTimestamp": "1"
};
var client = new clientlib.AlarmConn();
client.send(ALARM);
client.close();
Other parameters include:
function send(alarm,
hostname = 'localhost', port = '5672',
username = 'guest', password = 'guest')
When no more alarms are to be sent, the connection should be closed using:
function close();