exec

Reference for the `exec` action.

exec · action · run nanook doc exec for the same content in your terminal.

Runs a shell command on alert. The cmd option is a template rendered against the alert event before exec; NANOOK_ALERT_* env vars are also exported.

Options

OptionTypeDefaultDescription
cmdstringrequiredshell command template (e.g. notify {{ kind }} {{ rule }})

Examples

Run a script on every fire

[channels.notify]
type = "exec"
[channels.notify.opts]
cmd = "/usr/local/bin/notify.sh {{ kind }} {{ rule }}"

Use the rendered body

[channels.page]
type = "exec"
[channels.page.opts]
cmd = "logger -t nanook \"$NANOOK_ALERT_BODY\""

[[alerts]]
expr    = "cpu.usage > 90%"
channel = "page"
body    = "host hot at {{ trigger.val }}%"