meichthys / uptime_kuma

Uptime Kuma HACS integration
114 stars 23 forks source link

Uptime Kuma entities not available in HA #91

Closed xelemorf closed 9 months ago

xelemorf commented 9 months ago

Related to the following: https://github.com/hassio-addons/addon-uptime-kuma/issues/156 https://github.com/louislam/uptime-kuma/issues/4502

Problem/Motivation

UptimeKuma sensor entities dissapeared in HA, showing "Error in describing condition: can't access property "entity_id" of undefined"; manual check for entity availability shows no custom UptimeKuma monitors are populated into HA.

Expected behavior

Custom UptimeKuma monitors should be auto-populated after addon-start

Actual behavior

UptimeKuma sensor entities dissapeared in HA, only the below are available, none of the custom monitors are available

Steps to reproduce

Let UptimeKuma run for over 90 days with 28 monitor entities, wait for the database to grow over 2GB (2397.6 GB) While settings are configured to keep only 1 day history.

Proposed changes

Vacuum function clearly not working: "Trigger database VACUUM for SQLite. If your database is created after 1.10.0, AUTO_VACUUM is already enabled and this action is not needed." This is a re-occurring issue once the database grows above 2GB, having a setting to keep history for 1 days does not do anything.

Current workaround (reinstall UptimeKuma addon)

  1. Export all settings manually (since the backup feature does not work and you cannot access the data folder for UptimeKuma on HAOS)
  2. Completely uninstall UptimeKuma addon
  3. Reboot HAOS
  4. Reinstall Uptime Kuma Addon (HA integration can stay as it was), reboot HAOS
  5. Reconfigure everything from scratch using the same monitor names and settings
  6. Configure database to keep only 1 days of history, observe the second day that th setting is not respected
  7. Wait for some time to the database to grow above 2GB then rinse and repeat all the steps

System details:

HomeAssistant Addon version: 0.12.0 HAOS OVA (VMware) - The issue is independent from HAOS and HA versions. Core 2024.2.2 Supervisor 2024.01.1 Operating System 11.5 Frontend 20240207.1 CPU: 2 vCPU (Intel Core i7-8700T @ 2.40GHz) RAM: 4GB (DDR4)

meichthys commented 9 months ago

Looks like duplicate of #87 and #86 but I'll leave this open since it had more information.

I've never been able to reproduce this but in not using the HomeAssistant add-on either.

Are you using SSL? I've seen reports on the part similar to this but usually only when SSL was not being used.

CommanderStorm commented 9 months ago

This is not an issue with your addon. => you can close this issue

A lot of performance improvements (using aggregated vs non-aggregated tables to store heartbeats, enabling users to choose mariadb as a db-backend, pagination of important events) have been made in v2.0 (uptime-kuma's next release) resolving™️ this problem-area.

You can subscribe to our releases and get notified when a new release (such as v2.0-beta.0) gets made. See https://github.com/louislam/uptime-kuma/issues/4500 for the bugs that need addressing before that can happen.

Meanwhile (the issue is with SQLite not reading data fast enough to keep up):

meichthys commented 9 months ago

@CommanderStorm thank you so much for the explanation. This has come up quite a few times and now I have an answer 👍