Host state differs between Icinga2 API and host_state table in database

This user had a very similar problem:

  • Icinga2 API has has the most current information about the icinga objects.
  • The most recent check-result and last_update are stored in redis
  • If there is a state change, in order to do SLA calculations later, there is an update on the relational mariadb/mysql//postgres database.
  • A restart of Icingadb.service or the icinga2.service will trigger an update on the relational database.

https://icinga.com/docs/icinga-2/latest/doc/14-features/#icinga-db

Icinga DB is a set of components for publishing, synchronizing and visualizing monitoring data in the Icinga ecosystem, consisting of:

  • Icinga 2 with its icingadb feature enabled, responsible for publishing monitoring data to a Redis server, i.e. configuration and its runtime updates, check results, state changes, downtimes, acknowledgements, notifications, and other events such as flapping
  • The Icinga DB daemon, which synchronizes the data between the Redis server and a database
  • And Icinga Web with the Icinga DB Web module enabled, which connects to both Redis and the database to display and work with the most up-to-date data