Home Directory Addons Comments and Acknowledgements Delete Comments more than n days old

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

Delete Comments more than n days old

Rating
10 votes
Favoured:
3
Current Version
none
Last Release Date
2011-08-19
Compatible With
  • Nagios 3.x
License
GPL
Hits
120739
Files:
FileDescription
del_comments.gzPerl Script del_comments
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
A simple perl script to delete host and service comments older than a given number of days.
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)
bylthomas987, June 16, 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.
bysteffan, December 2, 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
bydiramos, November 3, 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!