# IcingaDB data is not up to date with the data displayed in Icingaweb

**URL:** <https://community.icinga.com/t/icingadb-data-is-not-up-to-date-with-the-data-displayed-in-icingaweb/13904>\
**Category:** Icinga Web Modules\
**Created:** [July 25, 2024, 8:13am UTC](https://community.icinga.com/t/icingadb-data-is-not-up-to-date-with-the-data-displayed-in-icingaweb/13904 "2024-07-25T08:13:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vutuong](https://community.icinga.com/user_avatar/community.icinga.com/vutuong/32/6943_2.png) [@vutuong](https://community.icinga.com/u/vutuong)\
**Post date:** [July 25, 2024, 8:13am UTC](https://community.icinga.com/t/icingadb-data-is-not-up-to-date-with-the-data-displayed-in-icingaweb/13904/1 "2024-07-25T08:13:13Z")

</div>

I have IcingaDB running, but now I need to read and filter some data from `service_state` in IcingaDB. I realized that the data is not up to date with the data displayed in Icingaweb when using this query:  
`SELECT t1.name AS host_name, t1.address, t2.name AS servicename, t3.hard_state, FROM_UNIXTIME(t3.last_update/1000) AS last_update_readable FROM host t1 JOIN service t2 ON t1.id = t2.host_id JOIN service_state t3 ON t2.id = t3.service_id WHERE t2.name = 'Red_Alarm' limit 3;`  
I noticed that the `last_update` time is much older compared to the time shown on the web interface. Why is this happening? What is the sync interval between IcingaDB and Redis? The data in Redis seems to be up to date compared to the web but because the key is hash so I can not query to redis with filter that I want.

---

<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:** [July 25, 2024, 8:56am UTC](https://community.icinga.com/t/icingadb-data-is-not-up-to-date-with-the-data-displayed-in-icingaweb/13904/2 "2024-07-25T08:56:45Z")

</div>

> [@vutuong](#):
>
> I noticed that the `last_update` time is much older compared to the time shown on the web interface

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.

> <https://github.com/RISE-GmbH/icingaweb2-module-checkreports/blob/d1a1ff68dbe3d69aa8cb73a43f85afbe316c2cf7/library/Checkreports/ProvidedHook/Reporting/Icingadb/ServiceCheckReport.php#L62>

> **[OSMC 2023 | Extending Icinga Web with Modules: powerful, smart and easily...](https://de.slideshare.net/slideshow/extending-icinga-web-with-modules-powerful-smart-and-easily-created-by-nicolas-schneider/263715633#10)**
>
> OSMC 2023 | Extending Icinga Web with Modules: powerful, smart and easily created by Nicolas Schneider - Download as a PDF or view online for free

 ![osmc-nschneider-slide10](https://community.icinga.com/uploads/default/original/2X/3/3986f7e5eb5c33f64850bd6add7662f6b91cf5fa.png)
