npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

opsgenie

v0.2.0

Published

A module for sending heartbeats to OpsGenie

Downloads

108

Readme

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