Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Remove acknowledgements older than n hours / days / weeks and send a report
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
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
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)
bymvanle, January 20, 2016
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.
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.
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.