Accessing data - Nagios 2.7

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
kreplech
Posts: 5
Joined: Tue Oct 11, 2011 11:25 am

Accessing data - Nagios 2.7

Post by kreplech »

Hello All,

My organization would like to import Nagios data to SQL Server for some custom reporting we'd like to do. I'd like to trigger Nagios reports from command line. Is there an online source for writing shell scripts that interact with Nagios?

Thanks,
K
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: Accessing data - Nagios 2.7

Post by jsmurphy »

To export the data from Nagios to a SQL database there's a plugin called NDOUtils - http://exchange.nagios.org/directory/Ad ... ls/details. From there you can pretty much use your favourite language for retrieving the information with SQL queries.
kreplech
Posts: 5
Joined: Tue Oct 11, 2011 11:25 am

Re: Accessing data - Nagios 2.7

Post by kreplech »

Is there a way to directly access the data? Where/how is Nagios data stored?
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: Accessing data - Nagios 2.7

Post by jsmurphy »

Maybe I'm misunderstanding the question, but you will be able to access the data from SQL queries. Are you asking how is the data stored before installing the database sync tool? It's stored in a whole lot of flat files in /opt/nagios/var/spool/checkresults/ but this is of no use to you, it's all untranslated data used by the Nagios engine.

You can't query the Nagios engine directly, which is why the Nagios team released the database sync tool.
kreplech
Posts: 5
Joined: Tue Oct 11, 2011 11:25 am

Re: Accessing data - Nagios 2.7

Post by kreplech »

I thought that might be the case. I had read in an admin post that it was possible to parse the log files: http://www.steveshipway.org/forum/viewt ... 579#p12579

Also, strange that the checkresults directory is empty... ?
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: Accessing data - Nagios 2.7

Post by jsmurphy »

the spool directory is all transient data... it's temporary. Well yes you could parse the log files but it's not going to be fast; I don't know why I didn't think of that when answering you last time, pretty obvious thinking about it :lol: . I've never attempted to parse the logs though so I'm afraid I won't be much help.
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Accessing data - Nagios 2.7

Post by mguthrie »

For historical information, use ndoutils. You can parse the nagios.log file, and the old logs in the archive directory, but that's going to be painfully slow compared to a database. Current status information is located in a file called status.dat.
mohsin2011
Posts: 63
Joined: Fri Sep 09, 2011 1:14 am

Re: Accessing data - Nagios 2.7

Post by mohsin2011 »

Can you please let me know that what is the default database of nagios and how can we access it or there is'nt any database we have to add any plugin for accessing current data and history ?
Hopes for your suggestions

Best Regards!
Locked