down hosts clean up

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
exp-user1
Posts: 65
Joined: Mon Oct 21, 2019 1:56 pm

Re: down hosts clean up

Post by exp-user1 »

Hi,

I sent you the backup in PM. please check and let me know.

Thanks.
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: down hosts clean up

Post by gsmith »

Hi

The file was not attached to the PM. Please resend.

Thanks
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: down hosts clean up

Post by gsmith »

Hi,

We are going to delete those "phantom" entries out of the database.

First we need to take a System Backup to preserve the current state of the databases.

Go to the Admin page, pick "Local Backup Archives" from the left-hand menu under 'System Backups' and then hit
the "Create Backup" button.
Image7.jpg
Next on a command line on the server:

Code: Select all

mysql -u root -p nagios
<enter password when prompted, default = 'nagiosxi'>
delete from nagios_hoststatus where status_update_time < (SELECT STR_TO_DATE('2021-02-25 00:00:01','%Y-%m-%d %H:%i:%s'));
commit;
Thanks
You do not have the required permissions to view the files attached to this post.
exp-user1
Posts: 65
Joined: Mon Oct 21, 2019 1:56 pm

Re: down hosts clean up

Post by exp-user1 »

Hi,

could you please explain what exactly this delete statement will do?
I see that some host with OK status are included in this delete.

thanks.
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: down hosts clean up

Post by gsmith »

Hi,

I amended the statement

Code: Select all

mysql -u root -p nagios
<enter password when prompted, default = 'nagiosxi'>
delete from nagios_hoststatus where status_update_time < (SELECT STR_TO_DATE('2021-02-25 00:00:01','%Y-%m-%d %H:%i:%s'))
AND output like 'CRITICAL%';
commit;
Now it will delete every entry that hasn't been updated since 24 FEB and a status like 'CRITICAL....."

Seems like we will have some with STATUS = OK and not updated since 24 FEB, but we can examine them after
you run the delete.

Thanks
exp-user1
Posts: 65
Joined: Mon Oct 21, 2019 1:56 pm

Re: down hosts clean up

Post by exp-user1 »

Hi,

Sounds good now. I will keep monitoring.

Thanks.
You do not have the required permissions to view the files attached to this post.
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: down hosts clean up

Post by gsmith »

Hi,

Great! I am going to lock this thread for now. But
please reach out if you have more issues.

Thanks
Locked