Deleting comments

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
proquibas
Posts: 18
Joined: Mon Jul 22, 2013 7:52 am

Deleting comments

Post by proquibas »

Hi all,

I'm trying to delete a lot of comments from diferent services by using a mysql query. It works fine and all comments dissapear, but when I configure some objecto in the nagios XI GUI and apply configuration, the comments appear again.

There is a procedure to delete definetly the comments?

Thanks.
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: Deleting comments

Post by jolson »

What command are you running to remove the comments from mysql?
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
proquibas
Posts: 18
Joined: Mon Jul 22, 2013 7:52 am

Re: Deleting comments

Post by proquibas »

Well, I'm using MySQL Workbench to run queries:

select * from nagios_comments;

Then I select the rows I want, delete it and apply changes. When I run the query again the deleted rows does not appear, but when I apply config by using the Nagios XI gui and I run the query again, the comments appear again...
Thanks!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Deleting comments

Post by tmcdonald »

First of all, we *strongly* advise against using any sort of database management scripts like MySQL Workbench of PHPMyAdmin. If you do not know exactly what you are doing it can cause some serious damage to your XI environment.

I will see if the developers can weigh in on why this might be the case. As far as I know, the nagios_* tables are separate from the CCM apply config process and should not be touched by it.
Former Nagios employee
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Deleting comments

Post by jdalrymple »

Not officially supported by us, use at your own risk:

Code: Select all

[root@localhost var]# service nagios stop
Stopping nagios: done.
[root@localhost var]# mysql -u root -pnagiosxi -e 'delete from nagios_comments' nagios
[root@localhost var]# grep -v "comment_data" retention.dat > temp
[root@localhost var]# mv temp retention.dat
mv: overwrite `retention.dat'? y
[root@localhost var]# service nagios start
Starting nagios: done.
Locked