Page 1 of 1

NagiosXI_nagios_servicechecks

Posted: Wed Oct 12, 2016 9:15 am
by maartin.pii
Hi All,

I have the following question about the nagios_ instace's data base - Does the table nagios_servicechecks store an historical of all service checks? Is it right to consume data from it? Or it's better to user the nagios_statehistory or something like that?

From what I understand the nagios_servicechecks store an historical of all service checks when it's properly configured on ndo2db.cfg - Am I right?

I am developing an add-on which need to read historical data as input, so it would be wonderful for me if you could guide me through this.

Best Regards,

Re: NagiosXI_nagios_servicechecks

Posted: Wed Oct 12, 2016 1:06 pm
by bwallace
State history is found in:

Code: Select all

/usr/local/nagios/var/nagios.log 
/usr/local/nagios/var/archives/
While /usr/local/nagios/share/perfdata contains performance data.

For your add-on, you may find it helpful to use the API feature in XI. As of Nagios XI 5, a new REST API was introduced. This API allows you to read, write, delete, and update data in the Nagios XI system through commands that are authenticated via Nagios XI API keys. All of the documentation is available inside of the Nagios XI product via the Help menu. In the left pane you will find the section Nagios XI API Docs.

Re: NagiosXI_nagios_servicechecks

Posted: Fri Oct 14, 2016 7:54 am
by maartin.pii
Thanks @bwallace!

I was thinking about using the API - However, since I was developing a kind of component embedded in Nagios I thought that maybe would be better to talk with the DB directly. Despite these I will read the documentation about it.

When you say that historical checks and information are stored on those logs - How is then inserted on the db? By ndo? And in which tables does the historical checks reside?

Regards,

Re: NagiosXI_nagios_servicechecks

Posted: Fri Oct 14, 2016 11:06 am
by bwallace
Ndo = yes. There are several tables in the ndo db which are used to hold "historical" information about Nagios and the hosts/services it is monitoring or was monitoring at some point in the past. Refer to page 14 of this doc for more:
https://assets.nagios.com/downloads/nag ... _Model.pdf

To answer your question about the general flow of things, my esteemed colleague tmcdonald best answered this at his presentation during the Nagios 2015 conference:

A check is run and results are processed into 3 items:
+ exit code: 0=OK, 1=Warning, 2=Critical, 3=Unknown
+ status output: this is the human readable string - includes performance data, everything after the pipe symbol
+ other

where this data goes:
+ exit code/status output is written to ---> status.dat, retention.dat, nagios.log(if non-OK), syslog, ndo database (optional but enabled by default and recommended to leave enabled)
+ performance data is split from status output after "|" character. This is handled by nagios, cron npcd -in that order.

Perf data is stored in:
+ /usr/local/nagios/var[host | service] -perfdata


You can view the presentation here https://www.youtube.com/watch?v=tsbJw4p ... 8&index=14
Slides here http://www.slideshare.net/nagiosinc/tre ... r-the-hood

Hope this helps!

Re: NagiosXI_nagios_servicechecks

Posted: Tue Oct 18, 2016 10:11 am
by maartin.pii
bwallace wrote:Ndo = yes. There are several tables in the ndo db which are used to hold "historical" information about Nagios and the hosts/services it is monitoring or was monitoring at some point in the past. Refer to page 14 of this doc for more:
https://assets.nagios.com/downloads/nag ... _Model.pdf

To answer your question about the general flow of things, my esteemed colleague tmcdonald best answered this at his presentation during the Nagios 2015 conference:

A check is run and results are processed into 3 items:
+ exit code: 0=OK, 1=Warning, 2=Critical, 3=Unknown
+ status output: this is the human readable string - includes performance data, everything after the pipe symbol
+ other

where this data goes:
+ exit code/status output is written to ---> status.dat, retention.dat, nagios.log(if non-OK), syslog, ndo database (optional but enabled by default and recommended to leave enabled)
+ performance data is split from status output after "|" character. This is handled by nagios, cron npcd -in that order.

Perf data is stored in:
+ /usr/local/nagios/var[host | service] -perfdata


You can view the presentation here https://www.youtube.com/watch?v=tsbJw4p ... 8&index=14
Slides here http://www.slideshare.net/nagiosinc/tre ... r-the-hood

Hope this helps!
---------------------------

Thanks bwallace! I'll take a look at these and let you know.

Regards,

Re: NagiosXI_nagios_servicechecks

Posted: Tue Oct 18, 2016 11:57 am
by rkennedy
Let us know how it goes, or if you have any further questions.

Re: NagiosXI_nagios_servicechecks

Posted: Wed Oct 19, 2016 7:07 pm
by maartin.pii
Hi Guys - I think that I am on my way with your answers and some personal research.

This thread can be closed.

Regards,

Re: NagiosXI_nagios_servicechecks

Posted: Thu Oct 20, 2016 11:13 am
by avandemore
maartin.pii,

Glad to hear your problem is resolved. If you have further issues, please open a new thread.