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
Max Comment History Age
Re: Max Comment History Age
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
cat /etc/cron.d/nagiosxiCode: Select all
*/5 * * * * nagios /usr/bin/php -q /usr/local/nagiosxi/cron/dbmaint.php >> /usr/local/nagiosxi/var/dbmaint.log 2>&1Re: Max Comment History Age
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?
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
The DB maint process should clean them up, please attach this file:
You should be able to run this command (which will delete everything older than 6 months) to manually clean it up:
To delete all older than 10 minutes you would do this:
Code: Select all
/usr/local/nagiosxi/cron/dbmaint.phpCode: Select all
mysql -uroot -pnagiosxi -h 127.0.0.1 -B nagios -e 'DELETE FROM nagios_commenthistory WHERE entry_time <= (NOW() - INTERVAL 6 MONTH);'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);'