How to pull service/host uptime and downtime stats directly from MySQL databases that NagiosXI runs on?
I know there are 2 mysql databases: nagios and nagiosql. Please let me know what tables/columns provide the uptime/downtime stats. In other words, I would like to be able to run sql queries to pull up the % of downtime from the total period of time that some service/host was monitored, and I want to do that directly from the database and not the web GUI of NagiosXI.
Also, is there an API for nagiosql component of NagiosXI? I want to be able to manipulate hosts/services with my own code and update the database accordingly.
Thanks!
How to pull service/host uptime stats directly from MySQL DB
Re: How to pull service/host uptime stats directly from MySQ
There is no tables that directly report that. You will need to query the right table and do the math in your logic. The tables of interest:txwomansu wrote:How to pull service/host uptime and downtime stats directly from MySQL databases that NagiosXI runs on?
Code: Select all
Database:
nagios
Tables:
nagios_hoststatus
nagios_servicestatus
nagios_statehistory
nagios_logentries
See my above comment.txwomansu wrote: I would like to be able to run sql queries to pull up the % of downtime from the total period of time that some service/host was monitored
No. The backend api is mostly read only. QL object configuration is mostly done by internal php functions. You could pick apart the CCM code or build your own queries. Be careful here as inserting incorrectly can really have adverse affects on the databases and XI.txwomansu wrote:Also, is there an API for nagiosql component of NagiosXI? I want to be able to manipulate hosts/services with my own code and update the database accordingly.
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.
"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.
Re: How to pull service/host uptime stats directly from MySQ
Thanks for the information.