Page 1 of 2

Importing nagios core log files into XI

Posted: Tue Aug 05, 2014 5:23 am
by mon-team
Hi Guys,

How can we import our old nagios core log files into nagiosXI?

After copying these log files in /usr/local/nagios/var/archives dir, i can see old log entries in Nagios Core Availabity Report but not in NagiosXI Event Log or Host/Service History

Thanks

Re: Importing nagios core log files into XI

Posted: Tue Aug 05, 2014 4:05 pm
by lmiltchev
The log files need to be imported into the database. There is no way to do this directly from the Nagios XI web interface. I've seen scripts that can do this. You may need to browse the Nagios Exchange or search on Google for a script that can do the job for you. Before making any changes, do proper backup.

Re: Importing nagios core log files into XI

Posted: Tue Nov 04, 2014 11:58 am
by mon-team
Hi guys,

Could you please give me more details about this?
Can you recommend a procedure to import nagios core history into XI.

Thanks in advance for your response.
BRegards

Re: Importing nagios core log files into XI

Posted: Tue Nov 04, 2014 1:23 pm
by abrist
You should be able to use log2ndo to do this:

Code: Select all

/usr/local/nagios/bin/log2ndo /path/to/log/file -d /usr/local/nagios/var/ndo.sock -i "localhost" 

Re: Importing nagios core log files into XI

Posted: Fri Nov 14, 2014 9:47 am
by mon-team
hi support,

I ran this command several times:
/usr/local/nagios/bin/log2ndo -s /usr/local/nagios/var/archives/nagios-*-2008-00.log -d /usr/local/nagios/var/ndo.sock -i "localhost"

Now i am getting these errors in /var/log/messages:
Nov 14 14:44:09 torvir01u ndo2db: Error: queue recv error.
Nov 14 14:44:09 torvir01u ndo2db: Error: queue recv error.
Nov 14 14:44:09 torvir01u ndo2db: Error: queue recv error.
Nov 14 14:44:09 torvir01u ndo2db: Error: queue recv error.
Nov 14 14:44:09 torvir01u ndo2db: Error: queue recv error.
Nov 14 14:44:09 torvir01u ndo2db: Error: queue recv error.
Nov 14 14:44:09 torvir01u ndo2db: Error: queue recv error.
Nov 14 14:44:09 torvir01u ndo2db: Error: queue recv error.
...

Re: Importing nagios core log files into XI

Posted: Fri Nov 14, 2014 9:51 am
by slansing
Are you getting any sql query errors in your syslog as well? "ndo2db: Error: queue recv error" is typically surrounded by them. Did you also import the last (current) nagios log? I would not have done that necessarily, if you did, are the times on the two systems in sync?

Re: Importing nagios core log files into XI

Posted: Fri Nov 14, 2014 11:01 am
by mon-team
I didn't found any sql error in logs and i didn't try to import the current nagios.log

I would like to import all nagios historical logfiles collected from 06/2008 to the date of the installazione of our nagiosXI.

Re: Importing nagios core log files into XI

Posted: Fri Nov 14, 2014 3:09 pm
by abrist
What is the output of:

Code: Select all

grep "mysql\|ndo2db" /var/log/messages
tail -25 /var/log/mysqld.log

Re: Importing nagios core log files into XI

Posted: Tue Nov 18, 2014 6:59 am
by mon-team
[root@nagiosxi ~]# grep "mysql\|ndo2db" /var/log/messages
Nov 14 12:43:51 tor1vir0119u nagios: ndomod: Please check remote ndo2db log, database connection or SSL Parameters
Nov 14 13:39:37 tor1vir0119u nagios: ndomod: Please check remote ndo2db log, database connection or SSL Parameters
Nov 14 13:46:03 tor1vir0119u ndo2db: Error: queue recv error.
Nov 14 13:46:03 tor1vir0119u ndo2db: Error: queue recv error.
Nov 14 13:46:03 tor1vir0119u ndo2db: Error: queue recv error.
Nov 14 13:46:03 tor1vir0119u ndo2db: Error: queue recv error.
Nov 14 13:46:03 tor1vir0119u ndo2db: Error: queue recv error.
Nov 14 13:46:03 tor1vir0119u ndo2db: Error: queue recv error.
Nov 14 13:46:03 tor1vir0119u ndo2db: Error: queue recv error.
...
Nov 14 14:48:03 tor1vir0119u ndo2db: Error: queue recv error.
Nov 14 14:48:03 tor1vir0119u ndo2db: Error: queue recv error.
Nov 14 14:48:03 tor1vir0119u ndo2db: Error: queue recv error.
Nov 14 14:48:03 tor1vir0119u ndo2db: Error: queue recv error.
Nov 14 14:48:03 tor1vir0119u ndo2db: Error: queue recv error.
Nov 14 14:48:03 tor1vir0119u ndo2db: Error: queue recv error.
Nov 14 14:48:03 tor1vir0119u ndo2db: Error: queue recv error.
Nov 14 14:48:03 tor1vir0119u ndo2db: Error: queue recv error.
Nov 14 14:48:09 tor1vir0119u nagios: ndomod: Please check remote ndo2db log, database connection or SSL Parameters
Nov 14 16:47:51 tor1vir0119u nagios: ndomod: Please check remote ndo2db log, database connection or SSL Parameters
---------------------------------

The following logs in mysql.log aren't related to the above issue

root@nagiosxi ~]# tail -25 /var/log/mysqld.log
141110 12:33:12 [Note] Event Scheduler: Purging the queue. 0 events
141110 12:33:14 InnoDB: Starting shutdown...
141110 12:33:15 InnoDB: Shutdown completed; log sequence number 0 44233
141110 12:33:15 [Note] /usr/libexec/mysqld: Shutdown complete

141110 12:33:15 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
141110 12:49:03 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
141110 12:49:04 InnoDB: Initializing buffer pool, size = 8.0M
141110 12:49:04 InnoDB: Completed initialization of buffer pool
141110 12:49:04 InnoDB: Started; log sequence number 0 44233
141110 12:49:04 [Note] Event Scheduler: Loaded 0 events
141110 12:49:04 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.73' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
-------------------

Thanks for your help

Re: Importing nagios core log files into XI

Posted: Tue Nov 18, 2014 1:03 pm
by abrist
You will probably need to clear the ndo queue:

Code: Select all

for i in `ipcs -q | grep nagios |awk '{print $2}'`; do ipcrm -q $i; done 
And tune message queue parameters:

Code: Select all

kernel.msgmnb 
kernel.msgmax 
kernel.msgmni 
See the following faq entry (old but still relevant):
http://support.nagios.com/wiki/index.ph ... 3.x_Issues