# Host state differs between Icinga2 API and host\_state table in database

**URL:** <https://community.icinga.com/t/host-state-differs-between-icinga2-api-and-host-state-table-in-database/14660>\
**Category:** Icinga 2\
**Tags:** redis, database, api, icingadb\
**Created:** [March 5, 2025, 12:20am UTC](https://community.icinga.com/t/host-state-differs-between-icinga2-api-and-host-state-table-in-database/14660 "2025-03-05T00:20:31Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![moreamazingnick](https://community.icinga.com/user_avatar/community.icinga.com/moreamazingnick/32/7725_2.png) [@moreamazingnick](https://community.icinga.com/u/moreamazingnick)\
**Post date:** [March 5, 2025, 3:43am UTC](https://community.icinga.com/t/host-state-differs-between-icinga2-api-and-host-state-table-in-database/14660/2 "2025-03-05T03:43:09Z")

</div>

This user had a very similar problem:

> [@IcingaDB data is not up to date with the data displayed in Icingaweb](https://community.icinga.com/t/icingadb-data-is-not-up-to-date-with-the-data-displayed-in-icingaweb/13904/1):
>
> I noticed that the `last_update` time is much older compared to the time shown on the web interface. Why is this happening?

> [@IcingaDB data is not up to date with the data displayed in Icingaweb](https://community.icinga.com/t/icingadb-data-is-not-up-to-date-with-the-data-displayed-in-icingaweb/13904/2):
>
> the reason for this is, that the most recent non hard state change information is stored in the redis server only.
> 
> The sql database hold the hard state relevant for “reboot consistant” sla calculation.
> 
> It is quite easy to implement something like this query in php as an icingaweb2 module.  
> Inside icingeweb2 you can easyily combine the redis data with the sql data.

- 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](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](https://icinga.com/docs/icinga-db), which synchronizes the data between the Redis server and a database
> - And Icinga Web with the [Icinga DB Web](https://icinga.com/docs/icinga-db-web) module enabled, which connects to both Redis and the database to display and work with the most up-to-date data

---

_[View the full topic](https://community.icinga.com/t/host-state-differs-between-icinga2-api-and-host-state-table-in-database/14660)._
