![Lead Image © Lisa Young, 123RF.com Lead Image © Lisa Young, 123RF.com](/var/ezflow_site/storage/images/archive/2014/22/configuring-nagios-for-passive-script-notification/123rf_829353_fenster-wasserwaage-handwerker_lisa-young_resized.png/93935-1-eng-US/123rf_829353_fenster-wasserwaage-handwerker_Lisa-Young_resized.png_medium.png)
Lead Image © Lisa Young, 123RF.com
Nagios Passive Checks
Smooth Check
Suppose you have developed a magnificent script (a Bash script, for example). This script will execute every night to dump a MySQL database or to rsync your valuable files to another server.
A common strategy is to use email as the way to get notified about the script results. If you wrote a good script, and your systems are very strong, the script will never exit with an error condition, and every morning you will find a message stating OK: no error running my beautiful backup script in your inbox.
This message is not a problem – as long as you only have one script sending notifications one time in a day. Suppose, however, that you have many scripts, with many backups, and all these scripts are notifying you via email. Your mailbox will fill up every morning with the same message. The first day, you will be impressed, but soon you will lose interest in reading all those identical messages. Your next step will be to create a filter in your mail client to put these messages in a subfolder, and after that you won't read them anymore, because you have basically just sent yourself a lot of spam. The worst part is, in the flood of useless emails, you risk of not seeing a real error notification that you really should be reading.
One solution is to send a message only in the case of an error; however, if you configure your script to send an email if it encounters an error during the execution, you have no guarantee that the script actually executed. If the script crashes or aborts before the line that sends the email notification, you will never know.
A far better solution is to let Nagios [1] listen for the notifications and only notify you if an error occurs or a message indicating success is not received.
Nagios will help you:
- Avoid having to manually process useless spamming notifications ("script execution ok" messages)
- Receive
Buy this article as PDF
(incl. VAT)