Socket
Book a DemoInstallSign in
Socket

opsgenie

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opsgenie

A module for sending heartbeats to OpsGenie

latest
Source
npmnpm
Version
0.2.0
Version published
Weekly downloads
5
-85.29%
Maintainers
1
Weekly downloads
 
Created
Source

opsgenie-node

A Node.js module for sending heartbeats to OpsGenie.

Build Status

Why?

When operating a Node.js app, you need to be notified of downtime. Services like Pingdom allow you to monitor the availability of your app by pinging it periodically and alerting you if it cannot be reached. But this requires your app to be available online.

If your app is running behind a firewall (intranet) or it's a background job not inteded to be publically available, Pingdom and similar services have no way of pinging it. The solution of cause is to reverse the roles and let your app ping the monitoring service. OpsGenie provide such an API.

Install

npm install opsgenie

Usage

You can either configure OpsGenie using environment variables, or configure it using the .heartbeat() function.

OpsGenie environment variables:

  • OPSGENIE_API_KEY - Your personal OpsGenie API key
  • OPSGENIE_NAME - The hostname that the OpsGenie heartbeat agent should register as (optional)

If no name is provided, either by OPSGENIE_NAME or by setting it via the .heartbeat() function, the hostname of the server will be used.

Example 1 - Using OpsGenie with environment variables:

require('opsgenie');

Example 2 - Configure OpsGenie using the .heartbeat() function:

require('opsgenie').heartbeat({
  apiKey: 'eb243592-faa2-4ba2-a551q-1afdf565c889',
  name: 'host-name'
});

Advanced usage

The OpsGenie module can emit the following events:

  • error - If something goes wrong while communicating with OpsGenie, an error event is emitted (note: if no listener is added, OpsGenie will not emit this event)
  • heartbeat - For every heartbeat sent to OpsGenie, the response JSON object is emitted
var opsgenie = require('opsgenie');

opsgenie.on('error', function (err) {
  console.log('Something went wrong while communicating with OpsGenie: ' + err.message);
});

opsgenie.on('heartbeat', function (res) {
  console.log('OpsGenie heartbeat result:', res);
});

License

MIT

Keywords

ops

FAQs

Package last updated on 08 Jul 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts