Page tree
Skip to end of metadata
Go to start of metadata

Installation

To use the Node.js connector for Moogsoft AIOps install the following components.

Install Node.js

See https://nodejs.org/en/download/ for downloads and details. We recommend the LTS version.

Install Node-MOOG

From npm (https://www.npmjs.com/package/node-moog)

npm install node-moog

Install a Generic REST listener

In Moogsoft AIOps, login as an Admin, select the System Settings from the apps menu icon then select monitoring from under the Integrations heading. Install a monitoring component by clicking on the +Add Monitoring Integration option and selecting the Node.js tile. Use a unique instance name for this integration and remember to make a note to change the moog connection nodes attributes accordingly..

Usage

Simple Event Generation

Populate a pre configured event object:
MoogEvent(mEvent)

mEvent is an optional default event template. If none is supplied then reasonable defaults are used for many fields. 


var MoogEvent = require('node-moog').MoogEvent;
myEvent = new MoogEvent();
myEvent.description = 'My new description';


Elements available in an event.

  • myEvent.signature //String
  • myEvent.source_id //String
  • myEvent.external_id //String
  • myEvent.manager //String
  • myEvent.source //String
  • myEvent.class //String
  • myEvent.agent_location //String
  • myEvent.type //String
  • myEvent.severity //Int
  • myEvent.description //String
  • myEvent.first_occurred // Epoch Int
  • myEvent.agent_time // Epoch Int

Create a connection


Create a connection to the REST LAM

moogREST(options)

options is an object containing connection specific settings

var moogRest = require('node-moog').moogREST({'url':'http://hostname:8888','auth_token':'my_secret'});

auth_token is optional and depends on the REST LAM configuration.

var moogRest = require('node-moog').moogREST({'url':'http://hostname:8888','authUser':'graze','authPass':'xxxxx'});

authUser and authPass are for basic auth and depend on the REST LAM configuration, it is strongly advised to use basic auth with tls, requires version 5.0.7+ of moog REST LAM.

To use tls (https)

To pass a server crt file pass the parameter options.certFile as a file path to the server crt.

To pass a client crt file use options.caFile as the path, if you want a client cert you must also pass a server cert.

var moog = require('node-moog');

// Set the options to your specific configuration.
var options = {'url':'https://innomoog:8881',
	'authUser':'graze',
	'authPass':'graze',
	'certFile' : '../ssl/server.crt',
	'caFile' : '../ssl/client.crt'
};

// Create a proforma event
var moogEvent = new moog.MoogEvent();
// Init a connection object
var moogRest = moog.moogREST(options);


When creating the Proforma you can pass a partial MoogEvent as a default, if not, default values will be provided for you.

Submit an event

It is very simple to now submit an event to the REST LAM.

moogEvent.description = 'My new description';
// Many defaults are set for you.
moogRest.sendEvent(moogEvent,callback());


The moogEvent can be a single event or an array of events.

The submit is an event emitter and will currently provide 2 events, ok and error.

These may change/expand in the future to give more detail on the event progress


moogRest.sendEvent(moogEvent, function (res, rtn) {
	if (rtn == 200) {
		console.log('moogRest message sent, return code: ' + rtn);
		console.log('moogRest result: ' + res.message);
		process.exit(0);
	} else {
		console.log('moogRest - ' + rtn);
		console.log('moogRest - ' + res);
		process.exit(1);
	}
});
  • No labels