I’m trying to find this data (specifically, the string) in the database. Honestly, I have very little clue about how icinga is set up and integrated with our services, just trying to complete another task and finding out how to query the database for this information would be great.
Use case being, I want to periodically query the database for certain services, and if there has been a recent event (hard state change to crit for example) then the message related to that is pulled.
just need pointing in the right direction for what the database schema might be to find this particular field/value
thanks!
Icinga Web 2 version (System - About): 2.12.1
PHP version used (php --version): 8.1.2-1ubuntu2.19
Here is the latest Schema assuming it is MySQL of the icingaDb feature: icingadb/schema/mysql/schema.sql at main · Icinga/icingadb · GitHub
There are host_state and service_state tables. Keep in mind that these entries can be „outdated“ since redis has the most recent informations on checkoutput if there is no statechange for a long time.
I would strongly support @moreamazingnick’s argument to use the Icinga API, especially if you want to do “standard” tasks like checking a service state.
If the Event Streams API seems a bit of an overkill, you can just use the simple GET request-based API as described in the Querying Objects section.
thanks for the replies - unfortunately still couldn’t find the string location
i should have added: its an influxdb, not mysql
using the icinga api is not an option unfortunately. the purpose is for a fully custom service status page for our employees/users, which i have already built using the database (unaware that icinga had an API at the time oops!)
just exploring adding an extra minor feature to the page in posting the plugin output string as a notice if a service is down, so finding this output string in the database is kinda the only way to go
Icinga 2 allows to store performance data in an Influx DB, but Icinga DB does not interoperate with Influx DB. All information shown in your screenshot is from Icinga DB, being stored in either a MySQL/MariaDB or a PostgreSQL database.