Get started with Opsgenie as a user
Learn how to configure your profile, get notifications from Opsgenie and view on-call schedules.
How do you monitor Nagios? Opsgenie has an easy-to-use plugin that sends heartbeat messages to Opsgenie API. Nagios runs this plugin periodically. If Opsgenie does not receive a heartbeat for a configurable time period, it notifies appropriate people via email, iOS & Android push notifications, SMS and phone calls.
Go to Heartbeats page on your Opsgenie and add a heartbeat.
Create an API integration API Integration and copy its Api key.
Download the Nagios Heartbeat plugin from its GitHub release page and put the binary file into your Nagios libexec directory.
Define a command in Nagios like so:
1
2
3
4
define command{
command_name opsgenie_heartbeat
command_line /usr/local/Nagios/libexec/heartbeat -apiKey $ARG1$ -name $ARG2$ -action send
}
Heartbeats for EU
If you are configuring the Heartbeats for OpsgenieEU, need to add -apiUrl as https://api.eu.opsgenie.com to command line while defining command, so the command definition will be like below:
1
2
3
4
define command{
command_name opsgenie_heartbeat
command_line /usr/local/Nagios/libexec/heartbeat -apiKey $ARG1$ -name $ARG2$ -action send -apiUrl https://api.eu.opsgenie.com
}
5. Define a service that will run the command like so:
1
2
3
4
5
6
7
8
9
10
define service {
service_description OpsGenie Heartbeat
host_name localhost
check_interval 10
check_period 24x7
max_check_attempts 60
retry_interval 1
notification_interval 60
check_command opsgenie_heartbeat!API_KEY!HEARTBEAT_NAME
}
where API_KEY is the api key you acquired from Opsgenie Heartbeat integration and HEARTBEAT_NAME is the name of the heartbeat you added.
For details about defining command and service in Nagios, see Nagios Object Definitions doc.
For details about Opsgenie Heartbeats and how to use them, refer to our Heartbeat Monitoring Document.
Source code of the Heartbeat Plugin is available at GitHub
Make sure the binary file heartbeat is executable.
Was this helpful?