bin/handler-opsgenie.rb
bin/check-opsgenie-heartbeat.rb
handler-opsgenie
{
"opsgenie": {
"customerKey": "the-key",
"teams": ["teams"],
"recipients": "the-recipients",
"source": "alert-source",
"overwrite_quiet_hours": true,
"tags": ["sensu"]
}
}
To get this to work you need to specify a few different things. For a list of fields that are required/available look at the sensu documentation. These files need to be on the server and the client boxes. Once there restart sensu-server and sensu-api.
- declare this as a handler:
/etc/sensu/conf.d/handler_opsgenie.json
{
"handlers": {
"opsgenie": {
"type": "pipe",
"command": "/opt/sensu/embedded/bin/handler-opsgenie.rb"
}
},
"opsgenie": {
"customerKey": "YOUR-KEY-HERE"
}
}
- add it to the check:
/etc/sensu/conf.d/check_xxx.json
{
"checks": {
"check_elastinats_is_running": {
"command": "/opt/sensu/embedded/bin/check-process.rb -p cron",
"interval": 60,
"handlers": [ "opsgenie" ],
"subscribers": [ "core" ]
}
}
}
- optionally add it to the default handler:
/etc/sensu/conf.d/default_handler.json
{
"handlers": {
"default": {
"type": "set",
"handlers": [
"opsgenie"
]
}
}
}