Page 1 of 1
Max Comment History Age
Posted: Thu Oct 08, 2020 8:39 pm
by lucasari
Hi,
we have the need to delete every comment on services and host 3 days after they have been created.
we found the option "Max Comment History Age" in Admin -> Performance Settings -> Databases. If we set this option to 3, will it actually delete the comments after 3 days have passed from the creation?
if so, how often and when is the housekeeping job being run?
regards,
Luca
Re: Max Comment History Age
Posted: Fri Oct 09, 2020 11:33 am
by ssax
Yes, the option you found is to set the retention/cleanup on the nagios_commenthistory table. If you set it to 3 it should delete everything older than 3 days which gets kicked off by the dbmaint cron job:
Which by default runs every 5 minutes:
Code: Select all
*/5 * * * * nagios /usr/bin/php -q /usr/local/nagiosxi/cron/dbmaint.php >> /usr/local/nagiosxi/var/dbmaint.log 2>&1
Re: Max Comment History Age
Posted: Wed Nov 04, 2020 9:55 pm
by lucasari
we are having some issues with getting the comments removed after using this function.
in fact, we set the retention to 10 minutes, but we are still seeing comments that are much older. they do not get deleted.
how can we make sure the comments older than a certain amount of time get deleted? is there any command we can run to achieve this?
Re: Max Comment History Age
Posted: Thu Nov 05, 2020 5:25 pm
by ssax
The DB maint process should clean them up, please attach this file:
Code: Select all
/usr/local/nagiosxi/cron/dbmaint.php
You should be able to run this command (which will delete everything older than 6 months) to manually clean it up:
Code: Select all
mysql -uroot -pnagiosxi -h 127.0.0.1 -B nagios -e 'DELETE FROM nagios_commenthistory WHERE entry_time <= (NOW() - INTERVAL 6 MONTH);'
To delete all older than 10 minutes you would do this:
Code: Select all
mysql -uroot -pnagiosxi -h 127.0.0.1 -B nagios -e 'DELETE FROM nagios_commenthistory WHERE entry_time <= (NOW() - INTERVAL 10 MINUTE);'