Skip to content

fguimond/sensu-pagerduty-handler

 
 

Repository files navigation

Sensu Go PagerDuty Handler

TravisCI: TravisCI Build Status

The Sensu Go PagerDuty Handler is a Sensu Event Handler which manages PagerDuty incidents, for alerting operators. With this handler, Sensu can trigger and resolve PagerDuty incidents.

Installation

Download the latest version of the sensu-pagerduty-handler from releases, or create an executable script from this source.

From the local path of the sensu-pagerduty-handler repository:

go build -o /usr/local/bin/sensu-pagerduty-handler main.go

Configuration

Example Sensu Go handler definition:

{
    "api_version": "core/v2",
    "type": "Handler",
    "metadata": {
        "namespace": "default",
        "name": "pagerduty"
    },
    "spec": {
        "type": "pipe",
        "command": "sensu-pagerduty-handler",
        "env_vars": [
          "PAGERDUTY_TOKEN=SECRET",
        ],
        "timeout": 10,
        "filters": [
            "is_incident"
        ]
    }
}

Example Sensu Go check definition:

{
    "api_version": "core/v2",
    "type": "CheckConfig",
    "metadata": {
        "namespace": "default",
        "name": "dummy-app-healthz"
    },
    "spec": {
        "command": "check-http -u http://localhost:8080/healthz",
        "subscriptions":[
            "dummy"
        ],
        "publish": true,
        "interval": 10,
        "handlers": [
            "pagerduty"
        ]
    }
}

Usage Examples

Help:

Usage:
  sensu-pagerduty-handler [flags]

Flags:
  -h, --help           help for sensu-pagerduty-handler
  -t, --token string   The PagerDuty V2 API authentication token, use default from PAGERDUTY_TOKEN env var

Note: Make sure to set the PAGERDUTY_TOKEN environment variable for sensitive credentials in production to prevent leaking into system process table. Please remember command arguments can be viewed by unprivileged users using commands such as ps or top. The --token argument is provided as an override primarily for testing purposes.

Contributing

See https://github.com/sensu/sensu-go/blob/master/CONTRIBUTING.md

About

Sensu Go PagerDuty Handler

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%