Home Directory Addons Comments and Acknowledgements Remove acknowledgements older than n hours / days / weeks and send a report

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

Remove acknowledgements older than n hours / days / weeks and send a report

Current Version
1.0
Last Release Date
2012-02-27
Compatible With
  • Nagios 3.x
  • Nagios XI
Owner
License
GPL
Hits
49068
Files:
FileDescription
nagiosAckRm.plnagiosAckRm.pl
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
This script automatically removes Nagios acknowledgements that have been not fixed since last script execution. It is mainly destined to run on some regular bases in connection to the cron daemon. The script is also capable of sending out the report into external recipients via e-mail.
The script removes the acknowledgements that are older than n minutes / hours / days / weeks based on content of cron daemon. E.g. if you want to remove the acknowledgements that are older than 1 day, then you must run the script via cron daemon on a daily bases:

0 10 * * * /usr/local/bin/nagiosAckRm.pl

If you want to remove the acknowledgements that are older than 1 week, then you must run the script via cron daemon on a weekly bases:

0 10 * * 1 /usr/local/bin/nagiosAckRm.pl

And so on.

The 'Platform specific settings' section needs to be updated depending on the platform being used. It has been successfully tested on the official Nagios XI VM from Nagios.

In order to make the report via e-mail feature working you must:

* uncomment and set the variables in 'Platform specific settings' section
* uncomment 'sendReport' subroutine in 'Subroutines execution' section
* remove both '=cut' marks inside the script that disable 'sendReport' subroutine definition

Reviews (2)
This script does work.

The tricky part is finding the correct offset to use when parsing the "retention.dat" file, which is the count of the number of lines (exclusive) from the beginning of a host or service definition to the "problem_has_been_acknowledged=" line. (I use "$hostAcknowledgementThreshold = 39" and "$serviceAcknowledgementThreshold = 45").

Also the script does not properly acquire the service name because it is searching for "display_name", but the "retention.dat" file only provides "service_description" (in later versions of Nagios). So the regex in the script source needs to be updated.
bybensode, February 21, 2015
1 of 1 people found this review helpful
Requires an initial ACKs file report to base actions on. Tried touching an empty file couldn't figure out it's requirements so this script doesn't work.