Comments and Acknowledgements

Delete Comments more than n days old

Description:

A simple perl script to delete host and service comments older than a given number of days.

Current Version

none

Last Release Date

2011-08-19

Compatible With

  • Nagios 3.x

Owner

License

GPL


Project Files
Project Notes
This script works by parsing the status.dat file then submitting commands via the command interface. Read the script contents to see how it should be run and to see what it does. If you want to delete all comments, simply specify -d 0. I'm not a programmer by trade so please forgive me if this isn't the best perl you have seen! Note the script must be run by a user that has write access to the command pipe (typically that will be user 'nagios'). I strongly recommend you test this yourself by specifying a junk output file (for example /var/tmp/mytestfile.junk) before letting it write commands to your production system command file!
Reviews (3) Add a Review
Worked Great
by lthomas987, June 30, 2015

This did exactly what it said it would. No logging, not much error checking but fast and efficient and cleared all the old stuff out as expected.



Not working
by steffan, December 31, 2011

Not working for me, downloadet the script chmod +x delete_old_comments.pl sudo ./delete_old_comments.pl -d 10 -s /usr/local/nagios/var/status.dat -c /usr/local/nagios/rw/nagios.cmd and nothing happens, the script runs, but no errors, no output, and no comments deleted (even tho there are a lot comments over 10 days old.) so doesn't work, sadly. i use Nagios Core Version 3.2.3



Great script
by diramos, November 30, 2011

Great sript! Very useful for me. In my company we use Nagios totally based on host and services comments. So, over time, thousands of comments accumulate, causing slowdowns in Nagios and greatly increasing the check latency. The script completely corrected this problem. Congratulations and thank you very much!



Project Stats
Rating
4.5 (10)
Favorites
3
Views
120,856