Deleting NagiosXI MySQL Data.

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
yaanatech
Posts: 74
Joined: Thu Mar 29, 2012 1:23 pm

Deleting NagiosXI MySQL Data.

Post by yaanatech »

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
User avatar
nscott
Posts: 1040
Joined: Wed May 11, 2011 8:54 am

Re: Deleting NagiosXI MySQL Data.

Post by nscott »

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:

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);'
This will run and delete anything in nagios_logentries and nagios_statehistory that is older than 7 days from when it is run.
Nicholas Scott
Former Nagios employee
Locked