How to access core and supervisor CPU + MEM usage (HA OS)

Update: since HA Core 2023.4 CPU + MEM of HA Core and HA Supervisor are finally available natively via the supervisor integration:

The Supervisor integration now provides sensors containing the Home Assistant Core and Supervisor’s stats. Thanks, @ludeeus!

BUT: once I switched to those,
a) My CPU usage went up quite significantly (approx. 10 %) plus
b) I find massive log entries of those:

2023-11-07 17:57:11.148 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.home_assistant_core_cpu_percent is taking over 10 seconds
2023-11-07 17:58:11.568 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.home_assistant_core_cpu_percent is taking over 10 seconds
2023-11-07 17:59:10.912 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.home_assistant_core_cpu_percent is taking over 10 seconds
2023-11-07 18:00:19.941 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.home_assistant_core_cpu_percent is taking over 10 seconds
2023-11-07 18:01:11.090 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.home_assistant_core_cpu_percent is taking over 10 seconds
2023-11-07 18:02:11.063 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.home_assistant_core_cpu_percent is taking over 10 seconds

What’s wrong with this supervisor integration for the sensor.home_assistant_core_cpu_percent sensor?
Will disable it and see if CPU usage wents down again, but even when it does: that’d be a proof, not a solution…

Here’s the proof: once I enabled those supervisor integration powered sensors, overall system CPU usage increased:


Edit: once sensor.home_assistant_core_cpu_percent entity has been disabled, HA log gives these:

2023-11-07 18:20:10.803 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.home_assistant_core_cpu_percent is taking over 10 seconds
2023-11-07 18:21:00.823 WARNING (MainThread) [homeassistant.helpers.entity_component] Forced update failed. Entity sensor.home_assistant_core_cpu_percent not found.
2023-11-07 18:21:10.929 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.home_assistant_core_memory_percent is taking over 10 seconds
2023-11-07 18:22:01.018 WARNING (MainThread) [homeassistant.helpers.entity_component] Forced update failed. Entity sensor.home_assistant_core_cpu_percent not found.

Totally crazy. What “forced update”? It has been disabled…


Edit 2:
Earlier I updated the command line based sensors (4: CPU + MEM of Core + Supervisor) with an automation:

# TRIGGER:
platform: time_pattern
id: command_line_sensors
minutes: /1
...
# ACTION:
service: homeassistant.update_entity
data: {}
target:
  entity_id:
    - sensor.home_assistant_core_cpu_percent
    - sensor.home_assistant_core_memory_percent
    - sensor.home_assistant_supervisor_cpu_percent
    - sensor.home_assistant_supervisor_memory_percent

That was the cause for the new “forced update” log entries. Once I disabled that action in the automation (event 2 in timeline), overall CPU usage went down to a normal average. Disabling the Core CPU sensor (event 1) changed nothing, so did re-enabling it (event 3). HA log entries (... is taking over 10 seconds) are gone too for now.

Will monitor it for a while as it’s just been a few minutes. Curious why entities which are automatically updated (in this case by the supervisor integration) can create such an issue when at the same time requested to update using the homeassistant.update_entity service. Probably a performance/timing thing, which resulted in the spammed HA log entries.


Final notice few hours later: seems to be fixed indeed.

Summary: this whole experience once again acts as a prove how important it is to monitor what’s going on on the system. This way one can even discover when the monitoring tools themself go crazy :slight_smile: …and fix it. No monitoring, system running way worse.