Alerting From Sensu

We have created a Sensu handler that can be leveraged to create alerts within GoAlert. You can find more information about our handler at it’s GitHub page here. Below is the main readme for our Sensu handler:


Sensu Go GoAlert Handler

Bonsai Asset Badge TravisCI Build Status

Sensu Go event handler that will create and close alerts in GoAlert.

Configuration

Asset Registration

Assets are the best way to make use of this plugin. If you’re not using an asset, please consider doing so! If you’re using sensuctl 5.13 or later, you can use the following command to add the asset:

sensuctl asset add target/sensu-go-goalert:0.0.6

If you’re using an earlier version of sensuctl, you can find the asset on the Bonsai Asset Index.

Examples

Example Sensu Go handler definition (named goalert-handler.json):

{
  "type": "Handler",
  "api_version": "core/v2",
  "metadata": {
    "name": "goalert",
    "namespace": "default"
  },
  "spec": {
    "type": "pipe",
    "command": "sensu-go-goalert",
    "env_vars": ["GOALERT_URL=ENTER_GENERIC_INTEGRATION_KEY_URL_HERE"],
    "filters": [
      "is_incident",
      "not_silenced"
      ],
    "handlers": [],
    "runtime_assets": ["target/sensu-go-goalert"],
    "timeout": 15
  }
}

sensuctl create -f goalert-handler.json

Example Sensu Go check definition:

{
  "api_version": "core/v2",
  "type": "CheckConfig",
  "metadata": {
    "namespace": "default",
    "name": "example-health"
  },
  "spec": {
    "command": "curl -s http://localhost:3030/health",
    "subscriptions": ["example"],
    "publish": true,
    "interval": 10,
    "handlers": ["goalert"]
  }
}

Installation

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

Run
go get github.com/target/sensu-go-goalert/...
to install the sensu-goalert-handler binary into your GOPATH automatically.

Or, run
go build ./cmd/sensu-goalert-handler
to build the sensu-goalert-handler binary into the current directory.