core icon indicating copy to clipboard operation
core copied to clipboard

System monitor: CPU usage has gone

Open rds76 opened this issue 1 year ago • 4 comments

The problem

state switch between some value and unknown periodically

What version of Home Assistant Core has the issue?

2024.2.2

What was the last working version of Home Assistant Core?

2024.2.1

What type of installation are you running?

Home Assistant Core

Integration causing the issue

System monitor

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

rds76 avatar Feb 16 '24 23:02 rds76

Same here. From time to time is showing values other times is giving Unknow. I believe it’s when the cpu usage fall below/around 1%. IMG_7153

icovelev avatar Feb 17 '24 00:02 icovelev

Sam here. If CPU use <9% - sensor CPU use show state "unknown"

Aliskin-Papa avatar Feb 17 '24 07:02 Aliskin-Papa

Same here, RPi4 - restored backup, skipped Update, because "0%" usage on startup is better than a unknown value most of the time ... 🤷🏻‍♂️

macxl69 avatar Feb 17 '24 08:02 macxl69

Same problem.

garry0garry avatar Feb 17 '24 08:02 garry0garry

+1

Exact same issue introduced by core 2024.2.2 Sensor processor use percentage reports unavailable every minute or so

shaf avatar Feb 17 '24 09:02 shaf

did y'all check https://github.com/home-assistant/core/issues/103298 where this was raised before? The current change was a 'fix' for that, but it really feels like regression from the original (so before 2023.11)

normally Id say this is a duplicate of the above #103298, but I d believe we need to make a bit more noise so I wont ;-)

Mariusthvdb avatar Feb 17 '24 09:02 Mariusthvdb

This error has been occurring from time to time since the last update. The entity is non-numeric: sensor.processor_use

sblogoshs avatar Feb 17 '24 11:02 sblogoshs

Yeah, this has been going on since 2023.11. The new "unknown" value is an attempt to mask the drops to zero but I think it's even worse than before. And it doesn't fix the peaks to 100% during an hour after a reboot I don't understand why we cannot go back to before 2023.11, it's so simple... And this is only happening in the System Monitor integration, not an external cause because the Glance add-on shows correct values as well as HA own hardware page. I also have a test instance on a Rpi5 atm which is obviously very lightly loaded giving cpu below 1% in idle, so now I get mostly "unknown" on the CPU % entity from System Monitor, which is ridiculous. I tried to enable logging but unfortunately there is nothing useful in there home-assistant_systemmonitor_2024-02-17T11-56-44.100Z.log

TekFan avatar Feb 17 '24 12:02 TekFan

I don't understand why we cannot go back to before 2023.11, it's so simple...

I don't think it's that simple, seems like there's been a bit of an overhaul of systemmonitor over the past few months

shaf@vmware-u20:~/.../components/systemmonitor$ git status
HEAD detached at 2024.2.2
nothing to commit, working tree clean

shaf@vmware-u20:~/.../components/systemmonitor$ pwd
/home/shaf/tmp/core/homeassistant/components/systemmonitor

shaf@vmware-u20:~/.../components/systemmonitor$ git log .
commit e7068ae134bc2b6228ce92ab44cf2594ad771295
Author: G Johansson <[email protected]>
Date:   Sun Feb 11 15:11:31 2024 -0500

    Fix cpu percentage in System Monitor (#110268)

    * Fix cpu percentage in System Monitor

    * Tests

commit 7ca83a7648fc3f50254667aa9d4e03c3ce9bcd75
Author: G Johansson <[email protected]>
Date:   Sun Feb 4 14:11:28 2024 -0500

    Add debug logger for cpu temp in System Monitor (#109627)

commit 16f6854f64d544b67e0dd8fa2648981f5b6b8941
Author: Franck Nijhof <[email protected]>
Date:   Sat Jan 20 04:09:39 2024 +0100

    Update psutil to 5.9.8 (#108421)

commit 3d410a1d6ed8ef4fbcec995f0535964e89e9770b
Author: Marc Mueller <[email protected]>
Date:   Wed Jan 17 18:19:10 2024 +0100

    Improve systemmonitor generic typing (#108220)

commit d4f9ad9dd365232fe48953de69a2a4ba875f90ca
Author: G Johansson <[email protected]>
Date:   Wed Jan 17 02:07:55 2024 +0100

    Create update coordinator for Systemmonitor (#106693)

commit 0ba0f57439eae802d49f3e7a68d91f5cc6ce9dc5
Author: G Johansson <[email protected]>
Date:   Tue Jan 16 21:39:03 2024 +0100

    Add entity name translations to System Monitor (#107952)

commit 5b3e1306f82b2d370154e57657250b3107ae768a
Author: G Johansson <[email protected]>
Date:   Mon Jan 15 18:26:49 2024 +0100

    Add tests for System Monitor (#107891)

    * Add tests

# etc etc etc

Maybe @gjohansson-ST can help or comment ?

shaf avatar Feb 17 '24 12:02 shaf

This is pushing changes without even testing them locally or thinking them through.

StSaens avatar Feb 17 '24 13:02 StSaens

Going back tp 2024.2.1 and skipping 2024.2.2 Did solve it for now

akicker avatar Feb 17 '24 13:02 akicker

How to enable systemmonitor debugging?

logger:
  default: warning
  logs:
    homeassistant.components.systemmonitor: debug

?

garry0garry avatar Feb 17 '24 13:02 garry0garry

processor_use_ returns False home-assistant_systemmonitor_2024-02-17T14-11-56.237Z.log

garry0garry avatar Feb 17 '24 14:02 garry0garry

@gjohansson-ST Starting from version 2024.2.2, the sensor does not display CPU load values for a long time after restarting Home Assistant. Why don't you plan to solve the problem? In addition, there is no information about CPU load in the debug logs (homeassistant.components.systemmonitor).

garry0garry avatar Feb 18 '24 09:02 garry0garry

https://github.com/home-assistant/core/issues/110839

garry0garry avatar Feb 18 '24 10:02 garry0garry

sensor.processor_use: [2024.02.18 12:32] CPU load unknown%. [2024.02.18 12:33] CPU load unknown%. [2024.02.18 12:34] CPU load unknown%. [2024.02.18 12:35] CPU load unknown%. [2024.02.18 12:36] CPU load unknown%. [2024.02.18 12:37] CPU load unknown%. [2024.02.18 12:38] CPU load 9%. [2024.02.18 12:39] CPU load 9%. [2024.02.18 12:40] CPU load unknown%. [2024.02.18 12:41] CPU load unknown%. [2024.02.18 12:42] CPU load 10%. [2024.02.18 12:43] CPU load 9%. [2024.02.18 12:44] CPU load unknown%. [2024.02.18 12:45] CPU load 10%. [2024.02.18 12:46] CPU load 9%. [2024.02.18 12:47] CPU load 9%. [2024.02.18 12:48] CPU load unknown%. [2024.02.18 12:49] CPU load 9%. [2024.02.18 12:50] CPU load unknown%.

garry0garry avatar Feb 18 '24 13:02 garry0garry

SELECT strftime('%Y-%m-%d %H:%M:%f', states.last_updated_ts, 'unixepoch', 'localtime') AS 'Time', states.state AS 'Value',  states_meta.entity_id AS 'Entity' 
FROM states 
JOIN states_meta ON states.metadata_id = states_meta.metadata_id 
WHERE states_meta.entity_id = 'sensor.processor_use' 
AND strftime('%Y-%m-%d %H:%M:%f', last_updated_ts, 'unixepoch', 'localtime') BETWEEN '2024-02-18 12:30:00' AND '2024-02-18 12:40:00'
AND states.state = 'unknown';

2024-02-18 12:30:56.775	unknown	sensor.processor_use
2024-02-18 12:34:56.323	unknown	sensor.processor_use
2024-02-18 12:37:41.321	unknown	sensor.processor_use
2024-02-18 12:38:26.322	unknown	sensor.processor_use
2024-02-18 12:39:26.321	unknown	sensor.processor_use

garry0garry avatar Feb 18 '24 17:02 garry0garry

Closing in favor of #103298 No need to have more than one issue for the same issue

gjohansson-ST avatar Feb 19 '24 13:02 gjohansson-ST