Monitoring tools are complex applications themselves, with multiple moving parts. Given that we rely on them to detect and alert us when there is a problem in our critical applications, it is essential to ensure that our tools are working as expected and can notify us when there is a problem. OpsGenie heartbeat monitoring offers a simple method to do just that:
Send periodic heartbeat messages to OpsGenie, and if we don't get them, we'll let you know.Most monitoring tools have some form of web monitor or execute scripts. Sending heartbeat messages to OpsGenie is as simple as making an HTTPS POST request or executing a command line utility that does that. Let's walk through the steps to configure OpsGenie heartbeats to monitor Nagios.
- Naturally, you'll need an OpsGenie account if you don't already have one. Heartbeat monitoring is supported in all subscription plans, and there is a free tier as well.
- Next, we need to add a heartbeat configuration for Nagios, where we can specify how often OpsGenie should expect to receive heartbeats. So if we define a 10 minutes heartbeat interval and OpsGenie does not receive any heartbeats for more than 10 minutes, OpsGenie would generate an alert.
- We also need to configure heartbeat integration to specify what the alert content and how the alert should be routed. OpsGenie treats heartbeats like other alerts, so can route alerts using on-call schedules, escalation policies, etc. and notify the right people according their preferences. Heartbeat integration provides the api key we will need to use to send the the heartbeat messages as well.
- We need to configure Nagios to send heartbeat messages to OpsGenie. For Nagios, we provide a simple plugin that consists of a single binary (source included) that sends heartbeat messages to OpsGenie. Heartbeat binary is very simple, it takes api key and the name of the heartbeat config as parameters and simply makes an HTTPS POST request to OpsGenie, and can be used from any application or script to send heartbeat messages to OpsGenie.
And that's it. If Nagios cannot send heartbeat messages to OpsGenie for any reason (server problems, network problems etc.) for longer than the time frame specified in the heartbeat config, OpsGenie will generate an alert and notify the specified people.
For another example of how to send Heartbeat messages, check out the Sensu OpsGenie Heartbeat plugin developed by the awesome Sensu community. Heartbeat monitoring can be used to monitor any application, and particularly useful for apps that cannot be monitored using active checks. Check out the OpsGenie NPM module that can be used to send heartbeat messages from any Node.js application as an example.
OpsGenie heartbeat monitoring is now used for variety of use cases, but ensuring that the monitoring and alerting works as expected was the main use case that drove us to develop it. Don't leave your alerting to chance. Take advantage of the free heartbeat monitoring, even if you're not using OpsGenie for alerting.