1.0.1 • Published 7 years ago

yavo v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

yavo

Yet another VictorOps client

Usage

const VictorOps = require('yavo');
const client = new VictorOps('my-key');
client.alert({
  'message_type':'CRITICAL',
  'entity_id':'disk space/db01.mycompany.com',
  'entity_display_name':'Critically Low Disk Space on DB01',
  'state_message':'The disk is really really full.  Here is abunch of information about the problem'
}, 'routing-key') ;

Or with pino logging integration:

const logger = require('pino')() ;
const VictorOps = require('yavo');
const client = new VictorOps(logger, 'my-key');
client.alert({
  'message_type':'CRITICAL',
  'entity_id':'disk space/db01.mycompany.com',
  'entity_display_name':'Critically Low Disk Space on DB01',
  'state_message':'The disk is really really full.  Here is abunch of information about the problem'
}, 'routing-key') ;

With a callback, if you want reponse details

const VictorOps = require('yavo');
const client = new VictorOps(logger, 'my-key');
client.alert({
  'message_type':'CRITICAL',
  'entity_id':'disk space/db01.mycompany.com',
  'entity_display_name':'Critically Low Disk Space on DB01',
  'state_message':'The disk is really really full.  Here is abunch of information about the problem'
}, 'routing-key', (err, body) => {
  console.log(`result: ${body.result}, entity_id: ${body.entity_id}`);
}) ;

Or, if you prefer Promises

const VictorOps = require('yavo');
const client = new VictorOps(logger, 'my-key');
client.alert({
  'message_type':'CRITICAL',
  'entity_id':'disk space/db01.mycompany.com',
  'entity_display_name':'Critically Low Disk Space on DB01',
  'state_message':'The disk is really really full.  Here is abunch of information about the problem'
}), 'routing-key')
  .then(body) => {
  console.log(`result: ${body.result}, entity_id: ${body.entity_id}`);
}) ;
1.0.1

7 years ago

1.0.0

7 years ago