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


Remember Me

Delete Comments more than n days old

9 votes
Current Version
Last Release Date
Compatible With
  • Nagios 3.x
del_comments.gzPerl Script del_comments

Help Support Ethan Galstad's New Project:

Help Support Ethan

A Message From The Founder...

As the founder of Nagios, I'm asking for your help in a cause that's dear to my heart.

I'm launching a new project to help better the world by providing the information, ideas, and inspiration that I believe can improve the lives of people everywhere.

I know you're busy managing networks, but I would appreciate it if you would consider liking my Facebook page and showing your support for the content and messages I produce by sharing them with your friends and family.

You can learn more about my project by visiting ethangalstad.me/nagios. Thank you for your time. I wish you all the best in your endeavors, whatever they may be.

- Ethan

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!