Importing nagios core log files into XI

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
mon-team
Posts: 171
Joined: Thu Jun 28, 2012 9:22 am

Importing nagios core log files into XI

Post 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
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Importing nagios core log files into XI

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
mon-team
Posts: 171
Joined: Thu Jun 28, 2012 9:22 am

Re: Importing nagios core log files into XI

Post 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
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Importing nagios core log files into XI

Post 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" 
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
mon-team
Posts: 171
Joined: Thu Jun 28, 2012 9:22 am

Re: Importing nagios core log files into XI

Post 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.
...
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Importing nagios core log files into XI

Post 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?
mon-team
Posts: 171
Joined: Thu Jun 28, 2012 9:22 am

Re: Importing nagios core log files into XI

Post 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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Importing nagios core log files into XI

Post by abrist »

What is the output of:

Code: Select all

grep "mysql\|ndo2db" /var/log/messages
tail -25 /var/log/mysqld.log
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
mon-team
Posts: 171
Joined: Thu Jun 28, 2012 9:22 am

Re: Importing nagios core log files into XI

Post 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
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Importing nagios core log files into XI

Post 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
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked