Page 1 of 1

Database value

Posted: Mon Feb 26, 2018 9:42 am
by Enigmaal
Hi everyone,

I'm actually trying to get data from Nagios' MySQL database and I got a little problem.
I would like get the state and the last date of result for a service but I don't know which tables get it.


Thank you

PS : Sorry for my not pretty good english , I'm from France , you even know baguette :)

Re: Database value

Posted: Mon Feb 26, 2018 11:02 am
by tmcdonald
We don't generally support custom queries into the database, but this will get you the columns you want:

Code: Select all

mysql> select current_state, last_check from nagios_servicestatus where service_object_id = 145;
+---------------+---------------------+
| current_state | last_check          |
+---------------+---------------------+
|             0 | 2018-02-26 11:00:02 |
+---------------+---------------------+
Figuring out which specific service_object_id to use will mean querying the nagios_services and nagios_hosts tables to get the relevant IDs to use.