Since some time HA reports resources consumption in Supervisor->Specific add-on tab. Memory and CPU consumption are shown there for each active add-on. Is there any way to get this information as sensor, similarly to what we get via System Monitor sensors for HA itself? Since this information is already available to HA, there should be some way to expose it to front end as well…
Yes there is but I would advise against it. The docker API calls are excessively CPU intensive.
In case you want to try anyway or anyone else that stumbles across this thread. Install glances from the add-on store then add the integration.
Glances monitors container stats?
That’s interesting. I used to use individual API calls, e.g.
- platform: command_line
name: Grafana CPU
command: 'curl -sSL -H "Authorization: Bearer $SUPERVISOR_TOKEN" http://supervisor/addons/a0d7b954_grafana/stats'
unit_of_measurement: '%'
value_template: "{{ (value_json.data.cpu_percent|float/4)|round(2) }}"
scan_interval: 60
json_attributes:
- data
- platform: template
sensors:
grafana_memory:
friendly_name: "Grafana RAM"
value_template: "{{ (state_attr('sensor.grafana_cpu', 'data')|to_json|from_json).memory_percent }}"
unit_of_measurement: '%'
This is the page available from the add-on/tool bar, adding the integration adds sensors for most of what you see. I’ve found the integration cpu intensive and thought that was what you were referring too.
I guess glances has to use the same docker API calls that the home assistant supervisor API uses.
Hm… too much to implement just to satisfy my curiosity, given additional complexity and load on CPU. My hope was that since this information is readily available in HA, it should be easy to present this as sensor, but I just overlooked how to make it in documentation. Anyhow, thanks a lot for advises!
I have glaces installed and am trying to track down why my green suddenly becomes unresponsive once a day, since about 3-5 days ago.
I suspect Music Assistant 2 (beta). It has been installed a month or two but receives regular updates.
However, when the system goes down, supervisor doesn’t recover and the console is completely unresponsive it so I think it is due to something higher up the chain. This seemed to be confirmed today as I left the console running ‘top’ and following today’s freeze it showed swap at 100%, possibly indicating thrashing being the culprit.
Top also showed that Music Assistant was using 40% of the 4GB RAM.
I’d like to be able to track the RAM usage of plugins (MA specifically) and have them added to the recorder so I can determine any trends.
Are there further developments in the line of this thread that could enable this?
Cheers for any suggestions.
Now in 2024 this is easy. You only need to enable the sensors entity (they are disabled by default).
Thanks a lot @dCatfish! I’ve already forgot that I was looking for this info and then bang - here is the answer!