exec

package
v0.0.0-...-1b1fa67 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package exec provides a transport to send alerts via external commands.

Alerts are serialized as JSON and can be read from stdin.

If "all" construction parameter is true, the input will be a list of kkok.Alert objects exported to JSON. Otherwise, the input will be a kkok.Alert object exported to JSON.

The plugin takes these construction parameters:

Name      Type       Default   Description
label     string     ""        Arbitrary string label.
command   []string             Command and arguments.  Required.
all       bool       false     See above description.
timeout   int        5         Seconds before killing the command.
                               If 0, the command will not be killed.

Example snippet for TOML configuration:

[[route.notify]]
type        = "exec"
label       = "send alerts via curl"
command     = ["curl", "--data-binary", "@-", "-f", "-s",
               "-H", "Content-Type: application/json",
               "http://some.service.com/"]
all         = true

This example sends all alerts to an external service in one request. If curl cannot connect to the external service or if the service returns status code other than 200 (by -f option), an error will be logged.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL