Monitoring Nagios Server Using OpsGenie Plugin

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. Please create an OpsGenie account if you haven't done already.
  2. Add a heartbeat in OpsGenie Heartbeats page.
  3. Create a OpsGenie Heartbeat integration from Integrations page and copy its Api key.
  4. Download the Nagios Heartbeat plugin from its GitHub release page and put the binary file into your Nagios libexec directory.
  5. Define a command in Nagios like so:
    define command{
    	command_name	opsgenie_heartbeat
    	command_line	/usr/local/Nagios/libexec/heartbeat -apiKey $ARG1$ -name $ARG2$
    }
  6. Define a service that will run the command like so:
    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 support document.
  • Source code of the Heartbeat Plugin is available at GitHub

Troubleshooting

Make sure the binary file heartbeat is executable.