10.9. Using alerts with Nagios

You can send alerts created in NetSpyGlass to Nagios instead of, or in addition to, other notification streams described above. The main difference is that notification streams such as email, Slack or PagerDuty work by NetSpyGlass “pushing” data to them, while Nagios polls its targets, including NetSpyGlass. This means we can’t describe Nagios as notification stream, instead, we have to configure Nagios to make it poll NetSpyGlass in a particular way to collect information about active alerts. This can have its pros and cons.


  • if you already run Nagios and rely on it for alerts and have your alert workflow built around Nagios, you will benefit from the effort you have already invested in it if you send NetSpyGlass alerts there as well.


  • Nagios requires extensive configuration to “know” what target to poll and what information to collect. If you want “fan out” alerts to appear in Nagios in a such way that each alert is associated with one device and component, you’ll need to generate configuration for Nagios to make it poll NetSpyGlass for each corresponding monitoring variable instance. NetSpyGlass comes with a script generate_hosts.py that can help you generate Nagios confgiuration for this. See Installation for more information. In any case this will probably require some additional scripts to automate Nagios configuration generation.
  • The total number of alert name, device id and componet id combinations can be very large which can put strain on Nagios server that has to make lots of polling calls
  • since Nagios polls its targets on its own schedule, it is going to learn about active alerts with some delay.

Even if you decide to use Nagios, you have two ways to do this with NetSpyGlass:

  1. you can make Nagios poll monitoring variables directly as described in Integration with Nagios. In this case you define thresholds in the Nagios plugin configuration
  2. you can create alerts in NetSpyGlass as described in this document and make Nagios poll monitoring variable instances created for the alert.

The first method may be easier if you are familiar with Nagios and already have established automation for generating Nagios configurations. The second method allows you to use all the power and flexibility of alerts in NetSpyGlass, including ability to write unit tests for them.

Chapter Using Nagios with NetSpyGlass Alerts provides more details on using NetSpyGlass alerts with Nagios.