Skip to content

johntdyer/sensu-webex-handler

Repository files navigation

Sensu Go webex Handler

Bonsai Asset Badge Build Status Go Report Card GitHub issues GitHub forks GitHub stars GitHub license codecov

The Sensu webex handler is a Sensu Event Handler that sends event data to a configured webex channel. This plugin was mostly copied from the Sensu slack handler and repurposed for Webex Teams.

screenshot

Installation

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

From the local path of the webex-handler repository:

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

Configuration

Example Sensu Go handler definition:

webex-handler.json

{
    "api_version": "core/v2",
    "type": "Handler",
    "metadata": {
        "namespace": "default",
        "name": "webex"
    },
    "spec": {
        "type": "pipe",
        "command": "sensu-webex-handler --api-key abc123 --room-id 'ABCDEFGHIJKLMNOP123' \\",
        "timeout": 30,
        "filters": [
            "is_incident"
        ]
    }
}

sensuctl create -f webex-handler.json

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": [
            "webex"
        ]
    }
}

Usage examples

Help:

The Sensu Go Webex Teams handler for event forwarding

Usage:
  sensu-webex-teams-handler [flags]

Flags:
  -k, --api-key string   API key for authenticated access
  -a, --api-url string   Webex Teams API (default "api.ciscospark.com")
  -h, --help             help for sensu-webex-teams-handler
  -r, --room-id string   Room or email to send alert to