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

node-red-contrib-opsgenie

v0.2.0

Published

Interface to Opsgenie API

Downloads

22

Readme

Opsgenie nodes Node-RED

Platform License Downloads NPM Known Vulnerabilities

These node-red nodes are used to work with Opsgenie using the REST API.

NOTE: This is a work in progress and currently only implements a very limited part of the Opsgenie Alert API functionality. The intention is to extend this project to cover all API functionality using a separate node for read and write for each API (eg. Alert API Write, Incident API Read, etc.)

Please feel free to contribute code by submitting pull requests.

Alternatively, submit an issue on the GitHub project page and I will be more than willing to code the additional functionality myself according to the needs out there.

Table of Contents

Credits

Edrean Ernst (Creator) Pedro Torrezão (Contributor)

Dependencies

This node depends on the following libraries :

  • https (https://www.npmjs.com/package/https)

Installation

This package can be installed through the Palette Manager in node-red.

It can also be installed by running the following command in your node-red directory (usually ~/.node-red) :

npm install node-red-contrib-opsgenie

Properties

The nodes have the following properties :

  • Parameters
    • This points to a configuration node that contains the information needed to connect to the Opsgenie API.
  • Name
    • The chosen name for the node.

The configuration node has the following properties:

  • API Host
    • This defines the API host that should be used. Default is 'api.opsgenie.com'.
  • Version
    • The API version. The default is 'v2'.
  • API Key
    • This is the API key created in your Opsgenie account. Refer to the Opsgenie documentation on how to create an API key.

Usage

Alert Action

This node will accept the following fields as input:

msg.action

This is a string field where an action can be specified that should be performed on alerts.

Accepted action strings are :

  • "create" - This will create a new alert according to the parameters defined in msg.payload
  • "close" - This will close an existing alert using msg.identifier and msg.identifierType as reference

msg.payload

This field is a JSON record defining the parameters that will be sent as the REST API body. The parameters will differ depending on the action being performed. Refer to the Opsgenie API documentation for more information.

As an example, if you want to create a new alert with an alias the payload will be :

"payload": {
    "message": "Alert world!",
    "alias": "myalertalias"
}

msg.identifier

This field is required when closing an alert. It is a string field that should contain the identifier used to identify the relevant alert that should be closed.

msg.identifierType

This field is also required when closing an alert. It is a string field that should contain the type of identifier used in msg.identifier. Possible values are:

  • "id"
  • "tiny"
  • "alias"

Please refer to the Opsgenie API documentation for descriptions of each of these identifier types.

Alert Read

This node will pull the existing alerts from your Opsgenie setup according the configuration.

Read msg.action

This is a string field where the type of action can be specified (e.g. list) Possible values are:

  • "list"
    • When triggered, this action will retrieve a list of the alerts from the Alerts API Endpoint producing one message per alert.

Examples

Create a simple alert

"msg": {
    "action": "create",
    "payload": {
        "message": "Simple alert message"
    }
}

Create an alert with an alias and source

"msg": {
    "action": "create",
    "payload": {
        "message": "Red alert!",
        "source": "noderedflow",
        "alias": "redalert"
    }
}

Close an alert using alias as reference and adding a note

"msg": {
    "action": "close",
    "identifier": "redalert",
    "identifierType": "alias",
    "payload": {
        "note": "Node was here!"
    }
}

Get current alerts

"msg": {
    "action": "list"
}

Example of a message produced per alert:

"msg": {
  "event_type": "Opsgenie Alert",
  "topic": "Opsgenie Alert",
  "payload": element.message,
  "data": 
  {
    "id": "70413a06-38d6-4c85-92b8-5ebc900d42e2",
    "tinyId": "1791",
    "alias": "event_573",
    "message": "Our servers are in danger",
    "status": "closed",
    "acknowledged": false,
    "isSeen": true,
    "tags": [ "OverwriteQuietHours", "Critical" ],
    "snoozed": true,
    "snoozedUntil": "2017-04-03T20:32:35.143Z",
    "count": 79,
    "lastOccurredAt": "2017-04-03T20:05:50.894Z",
    "createdAt": "2017-03-21T20:32:52.353Z",
    "updatedAt": "2017-04-03T20:32:57.301Z",
    "source": "Isengard",
    "owner": "[email protected]",
    "priority": "P4",
    "responders":[ 
      { "id":"4513b7ea-3b91-438f-b7e4-e3e54af9147c", "type":"team" },
      { "id":"bb4d9938-c3c2-455d-aaab-727aa701c0d8", "type":"user" },
      { "id":"aee8a0de-c80f-4515-a232-501c0bc9d715", "type":"escalation" }, 
      { "id":"80564037-1984-4f38-b98e-8a1f662df552", "type":"schedule" }
    ],
    "integration": { 
        "id": "4513b7ea-3b91-438f-b7e4-e3e54af9147c",
        "name": "Nebuchadnezzar",
        "type": "API"
    },
    "report": {
        "ackTime": 15702,
        "closeTime": 60503,
        "acknowledgedBy": "[email protected]",
        "closedBy": "[email protected]"
    }
  },
  {
    "id": "70413a06-38d6-4c85-92b8-5ebc900d42e2",
    "tinyId": "1791",
    "alias": "event_573",
    "message": "Sample Message",
    "status": "open",
    "acknowledged": false,
    "isSeen": false,
    "tags": [ "RandomTag" ],
    "snoozed": false,
    "count": 1,
    "lastOccurredAt": "2017-03-21T20:32:52.353Z",
    "createdAt": "2017-03-21T20:32:52.353Z",
    "updatedAt": "2017-04-03T20:32:57.301Z",
    "source": "Zion",
    "owner": "",
    "priority": "P5",
    "responders":[],
    "integration": {
        "id": "4513b7ea-3b91-b7e4-438f-e3e54af9147c",
        "name": "My_Lovely_Amazon",
        "type": "CloudWatch"
    }
  }
}