Hi All,
I am working to keep my /var health on my Nagios servers, I have been looking at the different tables that NagiosXI uses in MySQL and the biggest offender is nagios_logentries.MYD and nagios_statehistory.MYD. What is the best way to deal with these? Stop Nagios, drop the tables and reinject them? I have reduced the time to keep the data in the Admin area of NagiosXI, but it never seems to delete the data previously kept from when I made the changes. Is there a utility I can run that will go and delete data that is older than the 7 days I specified?
This is on our development NagiosXI node, so keeping this data is not so important, I just don't like extending the volume each time mysql takes up all my space.
Gavin
Deleting NagiosXI MySQL Data.
Re: Deleting NagiosXI MySQL Data.
If you wanted to do that you'd probably need to get some sort of daily cron job going that would simply run a shell script:
This will run and delete anything in nagios_logentries and nagios_statehistory that is older than 7 days from when it is run.
Code: Select all
#!/bin/sh
mysql -u ndoutils -p'<yourpassword>' nagios -e 'DELETE FROM nagios_logentries,nagios_statehistory WHERE entry_time < (NOW() - INTERVAL 7 DAY);'Nicholas Scott
Former Nagios employee
Former Nagios employee