1.0.3-alpha • Published 6 years ago

newrelic-alerts v1.0.3-alpha

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

newrelic-alerts

This package allows for the creation of newrelic alerts based on NRQL queries.

Usage

Ensure that the NEWRELIC_API_KEY environment variable has been set before running and that the key has admin privileges. See here for info on API keys.

Create a .newrelicalerts file in your project root (see the example file here).

Run newrelic-alerts to generate the alert.

Config options

All config options are required.

ParamTypeMeaning
policies[]ArrayAn array of alert policies
policies.nameStringThe name of the policy
policies.notifcationObjectDetails of the notification channel to associate with the policy
policies.notification.urlStringThe url of an incoming slack web hook
policies.notification.typeEnum(slack)The type of notification channel (slack is the only one currently supported)
policies.notification.channelStringThe slack channel name the policy should alert
policies.conditionObjectThe condition that will trigger the alert
policies.condition.descriptionStringA human-friendly description of the condition
policies.condition.thresholdNumberThe value the result of the NRQL query is compared against
policies.condition.operatorEnum(above, below, equal)How the query result should be compared against the threshold
policies.condition.durationNumberHow long (in minutes) the query should meet the threshold before the alarm is triggered
policies.condition.queryStringA NRQL query

Example .newrelicalerts file

{
  "policies": [
    {
      "name": "Gone viral!",
      "notification": {
        "url": "https://hooks.slack.com/services/...",
        "type": "slack",
        "channel": "#my-channel"
      },
      "condition": {
        "description": "Greater than 800 page views for at least 2 minutes",
        "threshold": 800,
        "operator": "above",
        "duration": 2,
        "query": "SELECT count(*) FROM PageView"
      }
    }
  ]
}
1.0.3-alpha

6 years ago

1.0.2-alpha

6 years ago

1.0.1-alpha

6 years ago

1.0.0-alpha

6 years ago

1.0.0

6 years ago