• Products
  • Get started
  • Documentation
  • Resources

Monitoring Nagios using Heartbeats

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.

Instructions to use Opsgenie Nagios Plugin:

  1. Go to Heartbeats page on your Opsgenie and add a heartbeat.

  2. Create an API integration API Integration and copy its Api key.

  3. Download the Nagios Heartbeat plugin from its GitHub release page and put the binary file into your Nagios libexec directory.

  4. 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.

Troubleshooting

Make sure the binary file heartbeat is executable.

Additional Help