Is there any way to get the memory and cpu used by each container rather than just docker in total with the Glances integration? I see this if I go to the Glances GUI…
If you can pull/scrape the JSON item you wanted then you can.
I pull the file system space left on one mount point using this.
- platform: rest
resource: http://192.168.1.115:61208/api/2/fs
name: Downloader Storage Used
value_template: '{{ value_json[1].percent }}'
unit_of_measurement: "%"
Please note the formatting is prob all messed up from my phone
I’m already using a json/rest sensor with Phil Hawthorne’s HADockermon…
I haven’t seen that resource before - is it documented?
Tried it in a web browser and I get a 404 error (after authenticating)
Edit: changed to api/3 and I get data but seems to be free disk space? Makes sense. But I’m after memory and cpu for docker containers… maybe google is my friend…
YES IT IS! Api/3/all gives it all… hmm…
Seems I can get da=ta via this URL:
http://10.90.11.100:61208/api/3/docker/containers
Which returns:
{"containers": [{"key": "name", "name": "addon_a0d7b954_glances", "Names": ["addon_a0d7b954_glances"], "Id": "091751949b762d3a595bff4d538d6a36a847bfea8c490202ae51509db2aca37f", "Image": ["hassioaddons/glances-amd64:0.7.0"], "Status": "running", "Command": ["/init"], "cpu": {"total": 48.02419523160763}, "cpu_percent": 48.02419523160763, "memory": {"usage": 76931072, "limit": 7929602048, "max_usage": 103342080}, "memory_usage": 76931072, "io": {"time_since_update": 7.866706371307373, "ior": 0, "iow": 0, "cumulative_ior": 1998848, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {}, "network_rx": null, "network_tx": null}, {"key": "name", "name": "homeassistant", "Names": ["homeassistant"], "Id": "6a239f47017d56e80f63936091ba9fd51a40e04ddab6009d5c156ff12f548216", "Image": ["homeassistant/intel-nuc-homeassistant:0.106.0b4"], "Status": "running", "Command": ["/bin/entry.sh"], "cpu": {"total": 26.981084791238878}, "cpu_percent": 26.981084791238878, "memory": {"usage": 421117952, "limit": 7929602048, "max_usage": 607215616}, "memory_usage": 421117952, "io": {"time_since_update": 7.864121913909912, "ior": 0, "iow": 1966080, "cumulative_ior": 82919424, "cumulative_iow": 1229373440}, "io_r": 0, "io_w": 1966080, "network": {}, "network_rx": null, "network_tx": null}, {"key": "name", "name": "sonarr", "Names": ["sonarr"], "Id": "230e14de63fd7a15bf42ff4b9210252fb1f48ab7b1c74089c144fe018a6758ad", "Image": ["linuxserver/sonarr:preview"], "Status": "running", "Command": ["/init"], "cpu": {"total": 4.998698455598456}, "cpu_percent": 4.998698455598456, "memory": {"usage": 368283648, "limit": 7929602048, "max_usage": 4474834944}, "memory_usage": 368283648, "io": {"time_since_update": 7.866653203964233, "ior": 0, "iow": 0, "cumulative_ior": 8949760, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.8666441440582275, "rx": 0, "tx": 0, "cumulative_rx": 313015197, "cumulative_tx": 664213546}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_a0d7b954_appdaemon", "Names": ["addon_a0d7b954_appdaemon"], "Id": "6db499a17640c70ea4560e3de8c873b8eab791d23e17dc807093607e9ef8c070", "Image": ["hassioaddons/appdaemon-amd64:0.2.1"], "Status": "running", "Command": ["/init"], "cpu": {"total": 3.1609011796982167}, "cpu_percent": 3.1609011796982167, "memory": {"usage": 37212160, "limit": 7929602048, "max_usage": 39632896}, "memory_usage": 37212160, "io": {"time_since_update": 7.865100622177124, "ior": 0, "iow": 0, "cumulative_ior": 9486336, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.865109205245972, "rx": 0, "tx": 0, "cumulative_rx": 589678875, "cumulative_tx": 24638542}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "sabnzbd", "Names": ["sabnzbd"], "Id": "d129a5e87a0839a6a0a0b608a91e532e6cd19ef16fc48b65c84770d290e21160", "Image": ["linuxserver/sabnzbd:latest"], "Status": "running", "Command": ["/init"], "cpu": {"total": 3.089992005494506}, "cpu_percent": 3.089992005494506, "memory": {"usage": 175656960, "limit": 7929602048, "max_usage": 4605181952}, "memory_usage": 175656960, "io": {"time_since_update": 7.866118669509888, "ior": 0, "iow": 0, "cumulative_ior": 21733376, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.8661181926727295, "rx": 0, "tx": 0, "cumulative_rx": 14002781024, "cumulative_tx": 173887994}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_a0d7b954_zerotier", "Names": ["addon_a0d7b954_zerotier"], "Id": "fbfc8fd08ae99c797c31b893b5648fb95e94a01beec456c2049757f3c920821a", "Image": ["hassioaddons/zerotier-amd64:0.7.0"], "Status": "running", "Command": ["/init"], "cpu": {"total": 1.5620217586912066}, "cpu_percent": 1.5620217586912066, "memory": {"usage": 5685248, "limit": 7929602048, "max_usage": 9125888}, "memory_usage": 5685248, "io": {"time_since_update": 7.865957498550415, "ior": 0, "iow": 4096, "cumulative_ior": 106496, "cumulative_iow": 10780672}, "io_r": 0, "io_w": 4096, "network": {}, "network_rx": null, "network_tx": null}, {"key": "name", "name": "radarr", "Names": ["radarr"], "Id": "116f89a0f853344d07e77255200d7b3fda024585aadd3cffb3d51bb1dc7690a0", "Image": ["linuxserver/radarr:latest"], "Status": "running", "Command": ["/init"], "cpu": {"total": 0.423962722940776}, "cpu_percent": 0.423962722940776, "memory": {"usage": 324239360, "limit": 7929602048, "max_usage": 4760154112}, "memory_usage": 324239360, "io": {"time_since_update": 7.862757444381714, "ior": 0, "iow": 0, "cumulative_ior": 319488, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.862766742706299, "rx": 0, "tx": 0, "cumulative_rx": 25951263, "cumulative_tx": 37504428}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "hassio_supervisor", "Names": ["hassio_supervisor"], "Id": "053172a31cf8395d286438014f5037909c4c80b72e23fdf80e72690c0f71fe22", "Image": ["homeassistant/amd64-hassio-supervisor:latest"], "Status": "running", "Command": ["/bin/entry.sh"], "cpu": {"total": 0.32243756164383564}, "cpu_percent": 0.32243756164383564, "memory": {"usage": 662376448, "limit": 7929602048, "max_usage": 1474211840}, "memory_usage": 662376448, "io": {"time_since_update": 7.8769371509552, "ior": 0, "iow": 0, "cumulative_ior": 3424256, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.87699031829834, "rx": 0, "tx": 0, "cumulative_rx": 74224678, "cumulative_tx": 1314784}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_fe41fc28_caddy", "Names": ["addon_fe41fc28_caddy"], "Id": "f29021db5e4ff6c4a038bbcae857e966494fae3b87bc780f4f7b50015bea0e9e", "Image": ["korylprince/hassio-caddy-amd64:1.6"], "Status": "running", "Command": null, "cpu": {"total": 0.30390046391752573}, "cpu_percent": 0.30390046391752573, "memory": {"usage": 20197376, "limit": 7929602048, "max_usage": 34709504}, "memory_usage": 20197376, "io": {"time_since_update": 7.867704391479492, "ior": 0, "iow": 0, "cumulative_ior": 1626112, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {}, "network_rx": null, "network_tx": null}, {"key": "name", "name": "addon_core_mosquitto", "Names": ["addon_core_mosquitto"], "Id": "665ac3d6743204bc74c119ebff071be417bf8cf0f5e28147ebdbff4e760963c7", "Image": ["homeassistant/amd64-addon-mosquitto:5.1"], "Status": "running", "Command": null, "cpu": {"total": 0.15699887748117727}, "cpu_percent": 0.15699887748117727, "memory": {"usage": 10592256, "limit": 7929602048, "max_usage": 31805440}, "memory_usage": 10592256, "io": {"time_since_update": 7.86919379234314, "ior": 0, "iow": 0, "cumulative_ior": 30068736, "cumulative_iow": 6987776}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.869199275970459, "rx": 0, "tx": 0, "cumulative_rx": 129948603, "cumulative_tx": 51107091}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "hassio_dns", "Names": ["hassio_dns"], "Id": "52ca3e9b12ccb46c3885fc0692ae3f99d4222cadc6e6d528f830098dfbb53aa6", "Image": ["homeassistant/amd64-hassio-dns:1"], "Status": "running", "Command": null, "cpu": {"total": 0.09333055865921787}, "cpu_percent": 0.09333055865921787, "memory": {"usage": 15806464, "limit": 7929602048, "max_usage": 39018496}, "memory_usage": 15806464, "io": {"time_since_update": 7.873098134994507, "ior": 0, "iow": 0, "cumulative_ior": 720896, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.873104572296143, "rx": 0, "tx": 0, "cumulative_rx": 142920454, "cumulative_tx": 85533248}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_core_configurator", "Names": ["addon_core_configurator"], "Id": "5e29bbcfa024af9f6c143fd954713b6c9e72bc7a20e90482de39f1e96bc5efc0", "Image": ["homeassistant/amd64-addon-configurator:4.7"], "Status": "running", "Command": ["/init"], "cpu": {"total": 0.05470531873792659}, "cpu_percent": 0.05470531873792659, "memory": {"usage": 9089024, "limit": 7929602048, "max_usage": 17653760}, "memory_usage": 9089024, "io": {"time_since_update": 7.8675947189331055, "ior": 0, "iow": 0, "cumulative_ior": 630784, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.867594242095947, "rx": 0, "tx": 0, "cumulative_rx": 11122513, "cumulative_tx": 452}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "lazylibrarian", "Names": ["lazylibrarian"], "Id": "413e41b0eb610e03ca12142b8db3fae0a34a51a8dedad2ae0dd2d33f57fd91e9", "Image": ["linuxserver/lazylibrarian:latest"], "Status": "running", "Command": ["/init"], "cpu": {"total": 0.04072215258855586}, "cpu_percent": 0.04072215258855586, "memory": {"usage": 89722880, "limit": 7929602048, "max_usage": 100806656}, "memory_usage": 89722880, "io": {"time_since_update": 7.864665985107422, "ior": 0, "iow": 0, "cumulative_ior": 3756032, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.864654541015625, "rx": 0, "tx": 0, "cumulative_rx": 77697861, "cumulative_tx": 13704068}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_core_samba", "Names": ["addon_core_samba"], "Id": "778f59d4c13170536c95ade7cd37244dc15985c229839b4c989e1bf9689b4747", "Image": ["homeassistant/amd64-addon-samba:9.0"], "Status": "running", "Command": null, "cpu": {"total": 0.028758335607094135}, "cpu_percent": 0.028758335607094135, "memory": {"usage": 24543232, "limit": 7929602048, "max_usage": 38248448}, "memory_usage": 24543232, "io": {"time_since_update": 7.868988275527954, "ior": 0, "iow": 0, "cumulative_ior": 622592, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {}, "network_rx": null, "network_tx": null}, {"key": "name", "name": "addon_a0d7b954_sonweb", "Names": ["addon_a0d7b954_sonweb"], "Id": "aa56f902be58c0358c2b5b5a568dd81e5d34aa942ae7fc5efb34d45aa70ca466", "Image": ["hassioaddons/sonweb-amd64:0.10.0"], "Status": "running", "Command": ["/init"], "cpu": {"total": 0.021715930457179653}, "cpu_percent": 0.021715930457179653, "memory": {"usage": 14327808, "limit": 7929602048, "max_usage": 203264000}, "memory_usage": 14327808, "io": {"time_since_update": 7.866141319274902, "ior": 0, "iow": 0, "cumulative_ior": 5992448, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.866130352020264, "rx": 0, "tx": 0, "cumulative_rx": 25670390, "cumulative_tx": 15498400}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_a0d7b954_ssh", "Names": ["addon_a0d7b954_ssh"], "Id": "9df927fd30021047fd1dff2595e15d40194d25a7bde6ec980f59cb59011a0b71", "Image": ["hassioaddons/ssh-amd64:7.1.0"], "Status": "running", "Command": ["/init"], "cpu": {"total": 0.01998900193174501}, "cpu_percent": 0.01998900193174501, "memory": {"usage": 13262848, "limit": 7929602048, "max_usage": 81076224}, "memory_usage": 13262848, "io": {"time_since_update": 7.870575189590454, "ior": 0, "iow": 0, "cumulative_ior": 987136, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {}, "network_rx": null, "network_tx": null}, {"key": "name", "name": "addon_a0d7b954_vscode", "Names": ["addon_a0d7b954_vscode"], "Id": "780fd42d5e8ed1c61adcfe8e19028a52a57431932747058400a1c2e2e49ddf23", "Image": ["hassioaddons/vscode-amd64:2.1.0"], "Status": "running", "Command": ["/init"], "cpu": {"total": 0.016643243986254296}, "cpu_percent": 0.016643243986254296, "memory": {"usage": 29593600, "limit": 7929602048, "max_usage": 97574912}, "memory_usage": 29593600, "io": {"time_since_update": 7.870167255401611, "ior": 0, "iow": 0, "cumulative_ior": 3919872, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.870167016983032, "rx": 0, "tx": 0, "cumulative_rx": 70967008, "cumulative_tx": 252672}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "portainer", "Names": ["portainer"], "Id": "22b51f03e3da89a5f6abc62955952f54bac7004fd3da7873da42f6a51aeb316b", "Image": ["portainer/portainer:latest"], "Status": "running", "Command": ["/portainer"], "cpu": {"total": 0.01504547455295736}, "cpu_percent": 0.01504547455295736, "memory": {"usage": 29749248, "limit": 7929602048, "max_usage": 38539264}, "memory_usage": 29749248, "io": {"time_since_update": 7.8740599155426025, "ior": 0, "iow": 0, "cumulative_ior": 2195456, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.874078989028931, "rx": 0, "tx": 0, "cumulative_rx": 75623311, "cumulative_tx": 47285431}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_a0d7b954_logviewer", "Names": ["addon_a0d7b954_logviewer"], "Id": "1fbb7de6322d188f583e624936968fc06461faceb8aa34d93fe7e821dcb10c22", "Image": ["hassioaddons/log-viewer-amd64:0.8.0"], "Status": "running", "Command": ["/init"], "cpu": {"total": 0.008909800687285222}, "cpu_percent": 0.008909800687285222, "memory": {"usage": 16474112, "limit": 7929602048, "max_usage": 24592384}, "memory_usage": 16474112, "io": {"time_since_update": 7.8661277294158936, "ior": 0, "iow": 0, "cumulative_ior": 2244608, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.866132497787476, "rx": 0, "tx": 0, "cumulative_rx": 23397440, "cumulative_tx": 117605}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_7be23ff5_dropbox_sync", "Names": ["addon_7be23ff5_dropbox_sync"], "Id": "7285ebc3e1cdbf2ae81dcced69ef0f2908f7cd19ae4fee55f3b77cae5c4d56f6", "Image": ["dwelch2101/dropbox-sync-amd64:1.3.0"], "Status": "running", "Command": null, "cpu": {"total": 0.008351678035470668}, "cpu_percent": 0.008351678035470668, "memory": {"usage": 16932864, "limit": 7929602048, "max_usage": 124162048}, "memory_usage": 16932864, "io": {"time_since_update": 7.872159242630005, "ior": 0, "iow": 0, "cumulative_ior": 70569984, "cumulative_iow": 2065846272}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.872158765792847, "rx": 0, "tx": 0, "cumulative_rx": 127290569, "cumulative_tx": 2443710462}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_a0d7b954_jupyterlablite", "Names": ["addon_a0d7b954_jupyterlablite"], "Id": "5344c9cda6c6f15204c88a19ac20dbdade7d940878de3a1a399b380569cd376d", "Image": ["hassioaddons/jupyterlablite-amd64:0.3.1"], "Status": "running", "Command": ["/init"], "cpu": {"total": 0.007104510309278351}, "cpu_percent": 0.007104510309278351, "memory": {"usage": 11419648, "limit": 7929602048, "max_usage": 100446208}, "memory_usage": 11419648, "io": {"time_since_update": 7.871636629104614, "ior": 0, "iow": 0, "cumulative_ior": 36147200, "cumulative_iow": 81920}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.871628046035767, "rx": 0, "tx": 0, "cumulative_rx": 68812218, "cumulative_tx": 3821}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "ha_dockermon", "Names": ["ha_dockermon"], "Id": "0b223d2a75ce56b144847dfe618c562251393c880b7a2248f8ca5acabfaf0702", "Image": ["philhawthorne/ha-dockermon:latest"], "Status": "running", "Command": null, "cpu": {"total": 0.0}, "cpu_percent": 0.0, "memory": {"usage": 23478272, "limit": 7929602048, "max_usage": 84070400}, "memory_usage": 23478272, "io": {"time_since_update": 7.878678560256958, "ior": 0, "iow": 0, "cumulative_ior": 5693440, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.878678560256958, "rx": 0, "tx": 0, "cumulative_rx": 167675855, "cumulative_tx": 149567384}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "watchtower", "Names": ["watchtower"], "Id": "b1ff137ab3542a65407d7c5d48bef545e4cdd146d9f65a4944f27d884c9f5958", "Image": ["v2tec/watchtower:latest"], "Status": "running", "Command": ["/watchtower"], "cpu": {"total": 0.0}, "cpu_percent": 0.0, "memory": {"usage": 9728000, "limit": 7929602048, "max_usage": 14192640}, "memory_usage": 9728000, "io": {"time_since_update": 7.877869367599487, "ior": 0, "iow": 0, "cumulative_ior": 2301952, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.877878665924072, "rx": 0, "tx": 0, "cumulative_rx": 68841751, "cumulative_tx": 0}, "network_rx": 0, "network_tx": 0}]}
not sure how I then extract the cpu and memory for each container. I tend to suck a bit at this lol…
Yea, sorry my glances is V2, then FS part is the file system part.
I just messed around with the number in square brackets till it matched the item I wanted.
Sorry for being vague, I kinda just stumbled upon doing this as my root drive and my mount point randomly swapped sensor number so automations I had wouldn’t work correctly.
I think you you get a JSON explorer you could work out the part you need to pull.
I would say try replacing value_json[1].percent with value_json[1].cpu
that might get you the 1st occurrence of cpu
so this might work…
{% set my_test_json = {"containers": [{"key": "name", "name": "addon_a0d7b954_glances", "Names": ["addon_a0d7b954_glances"], "Id": "091751949b762d3a595bff4d538d6a36a847bfea8c490202ae51509db2aca37f", "Image": ["hassioaddons/glances-amd64:0.7.0"], "Status": "running", "Command": ["/init"], "cpu": {"total": 48.02419523160763}, "cpu_percent": 48.02419523160763, "memory": {"usage": 76931072, "limit": 7929602048, "max_usage": 103342080}, "memory_usage": 76931072, "io": {"time_since_update": 7.866706371307373, "ior": 0, "iow": 0, "cumulative_ior": 1998848, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {}, "network_rx": null, "network_tx": null}, {"key": "name", "name": "homeassistant", "Names": ["homeassistant"], "Id": "6a239f47017d56e80f63936091ba9fd51a40e04ddab6009d5c156ff12f548216", "Image": ["homeassistant/intel-nuc-homeassistant:0.106.0b4"], "Status": "running", "Command": ["/bin/entry.sh"], "cpu": {"total": 26.981084791238878}, "cpu_percent": 26.981084791238878, "memory": {"usage": 421117952, "limit": 7929602048, "max_usage": 607215616}, "memory_usage": 421117952, "io": {"time_since_update": 7.864121913909912, "ior": 0, "iow": 1966080, "cumulative_ior": 82919424, "cumulative_iow": 1229373440}, "io_r": 0, "io_w": 1966080, "network": {}, "network_rx": null, "network_tx": null}, {"key": "name", "name": "sonarr", "Names": ["sonarr"], "Id": "230e14de63fd7a15bf42ff4b9210252fb1f48ab7b1c74089c144fe018a6758ad", "Image": ["linuxserver/sonarr:preview"], "Status": "running", "Command": ["/init"], "cpu": {"total": 4.998698455598456}, "cpu_percent": 4.998698455598456, "memory": {"usage": 368283648, "limit": 7929602048, "max_usage": 4474834944}, "memory_usage": 368283648, "io": {"time_since_update": 7.866653203964233, "ior": 0, "iow": 0, "cumulative_ior": 8949760, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.8666441440582275, "rx": 0, "tx": 0, "cumulative_rx": 313015197, "cumulative_tx": 664213546}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_a0d7b954_appdaemon", "Names": ["addon_a0d7b954_appdaemon"], "Id": "6db499a17640c70ea4560e3de8c873b8eab791d23e17dc807093607e9ef8c070", "Image": ["hassioaddons/appdaemon-amd64:0.2.1"], "Status": "running", "Command": ["/init"], "cpu": {"total": 3.1609011796982167}, "cpu_percent": 3.1609011796982167, "memory": {"usage": 37212160, "limit": 7929602048, "max_usage": 39632896}, "memory_usage": 37212160, "io": {"time_since_update": 7.865100622177124, "ior": 0, "iow": 0, "cumulative_ior": 9486336, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.865109205245972, "rx": 0, "tx": 0, "cumulative_rx": 589678875, "cumulative_tx": 24638542}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "sabnzbd", "Names": ["sabnzbd"], "Id": "d129a5e87a0839a6a0a0b608a91e532e6cd19ef16fc48b65c84770d290e21160", "Image": ["linuxserver/sabnzbd:latest"], "Status": "running", "Command": ["/init"], "cpu": {"total": 3.089992005494506}, "cpu_percent": 3.089992005494506, "memory": {"usage": 175656960, "limit": 7929602048, "max_usage": 4605181952}, "memory_usage": 175656960, "io": {"time_since_update": 7.866118669509888, "ior": 0, "iow": 0, "cumulative_ior": 21733376, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.8661181926727295, "rx": 0, "tx": 0, "cumulative_rx": 14002781024, "cumulative_tx": 173887994}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_a0d7b954_zerotier", "Names": ["addon_a0d7b954_zerotier"], "Id": "fbfc8fd08ae99c797c31b893b5648fb95e94a01beec456c2049757f3c920821a", "Image": ["hassioaddons/zerotier-amd64:0.7.0"], "Status": "running", "Command": ["/init"], "cpu": {"total": 1.5620217586912066}, "cpu_percent": 1.5620217586912066, "memory": {"usage": 5685248, "limit": 7929602048, "max_usage": 9125888}, "memory_usage": 5685248, "io": {"time_since_update": 7.865957498550415, "ior": 0, "iow": 4096, "cumulative_ior": 106496, "cumulative_iow": 10780672}, "io_r": 0, "io_w": 4096, "network": {}, "network_rx": null, "network_tx": null}, {"key": "name", "name": "radarr", "Names": ["radarr"], "Id": "116f89a0f853344d07e77255200d7b3fda024585aadd3cffb3d51bb1dc7690a0", "Image": ["linuxserver/radarr:latest"], "Status": "running", "Command": ["/init"], "cpu": {"total": 0.423962722940776}, "cpu_percent": 0.423962722940776, "memory": {"usage": 324239360, "limit": 7929602048, "max_usage": 4760154112}, "memory_usage": 324239360, "io": {"time_since_update": 7.862757444381714, "ior": 0, "iow": 0, "cumulative_ior": 319488, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.862766742706299, "rx": 0, "tx": 0, "cumulative_rx": 25951263, "cumulative_tx": 37504428}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "hassio_supervisor", "Names": ["hassio_supervisor"], "Id": "053172a31cf8395d286438014f5037909c4c80b72e23fdf80e72690c0f71fe22", "Image": ["homeassistant/amd64-hassio-supervisor:latest"], "Status": "running", "Command": ["/bin/entry.sh"], "cpu": {"total": 0.32243756164383564}, "cpu_percent": 0.32243756164383564, "memory": {"usage": 662376448, "limit": 7929602048, "max_usage": 1474211840}, "memory_usage": 662376448, "io": {"time_since_update": 7.8769371509552, "ior": 0, "iow": 0, "cumulative_ior": 3424256, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.87699031829834, "rx": 0, "tx": 0, "cumulative_rx": 74224678, "cumulative_tx": 1314784}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_fe41fc28_caddy", "Names": ["addon_fe41fc28_caddy"], "Id": "f29021db5e4ff6c4a038bbcae857e966494fae3b87bc780f4f7b50015bea0e9e", "Image": ["korylprince/hassio-caddy-amd64:1.6"], "Status": "running", "Command": null, "cpu": {"total": 0.30390046391752573}, "cpu_percent": 0.30390046391752573, "memory": {"usage": 20197376, "limit": 7929602048, "max_usage": 34709504}, "memory_usage": 20197376, "io": {"time_since_update": 7.867704391479492, "ior": 0, "iow": 0, "cumulative_ior": 1626112, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {}, "network_rx": null, "network_tx": null}, {"key": "name", "name": "addon_core_mosquitto", "Names": ["addon_core_mosquitto"], "Id": "665ac3d6743204bc74c119ebff071be417bf8cf0f5e28147ebdbff4e760963c7", "Image": ["homeassistant/amd64-addon-mosquitto:5.1"], "Status": "running", "Command": null, "cpu": {"total": 0.15699887748117727}, "cpu_percent": 0.15699887748117727, "memory": {"usage": 10592256, "limit": 7929602048, "max_usage": 31805440}, "memory_usage": 10592256, "io": {"time_since_update": 7.86919379234314, "ior": 0, "iow": 0, "cumulative_ior": 30068736, "cumulative_iow": 6987776}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.869199275970459, "rx": 0, "tx": 0, "cumulative_rx": 129948603, "cumulative_tx": 51107091}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "hassio_dns", "Names": ["hassio_dns"], "Id": "52ca3e9b12ccb46c3885fc0692ae3f99d4222cadc6e6d528f830098dfbb53aa6", "Image": ["homeassistant/amd64-hassio-dns:1"], "Status": "running", "Command": null, "cpu": {"total": 0.09333055865921787}, "cpu_percent": 0.09333055865921787, "memory": {"usage": 15806464, "limit": 7929602048, "max_usage": 39018496}, "memory_usage": 15806464, "io": {"time_since_update": 7.873098134994507, "ior": 0, "iow": 0, "cumulative_ior": 720896, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.873104572296143, "rx": 0, "tx": 0, "cumulative_rx": 142920454, "cumulative_tx": 85533248}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_core_configurator", "Names": ["addon_core_configurator"], "Id": "5e29bbcfa024af9f6c143fd954713b6c9e72bc7a20e90482de39f1e96bc5efc0", "Image": ["homeassistant/amd64-addon-configurator:4.7"], "Status": "running", "Command": ["/init"], "cpu": {"total": 0.05470531873792659}, "cpu_percent": 0.05470531873792659, "memory": {"usage": 9089024, "limit": 7929602048, "max_usage": 17653760}, "memory_usage": 9089024, "io": {"time_since_update": 7.8675947189331055, "ior": 0, "iow": 0, "cumulative_ior": 630784, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.867594242095947, "rx": 0, "tx": 0, "cumulative_rx": 11122513, "cumulative_tx": 452}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "lazylibrarian", "Names": ["lazylibrarian"], "Id": "413e41b0eb610e03ca12142b8db3fae0a34a51a8dedad2ae0dd2d33f57fd91e9", "Image": ["linuxserver/lazylibrarian:latest"], "Status": "running", "Command": ["/init"], "cpu": {"total": 0.04072215258855586}, "cpu_percent": 0.04072215258855586, "memory": {"usage": 89722880, "limit": 7929602048, "max_usage": 100806656}, "memory_usage": 89722880, "io": {"time_since_update": 7.864665985107422, "ior": 0, "iow": 0, "cumulative_ior": 3756032, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.864654541015625, "rx": 0, "tx": 0, "cumulative_rx": 77697861, "cumulative_tx": 13704068}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_core_samba", "Names": ["addon_core_samba"], "Id": "778f59d4c13170536c95ade7cd37244dc15985c229839b4c989e1bf9689b4747", "Image": ["homeassistant/amd64-addon-samba:9.0"], "Status": "running", "Command": null, "cpu": {"total": 0.028758335607094135}, "cpu_percent": 0.028758335607094135, "memory": {"usage": 24543232, "limit": 7929602048, "max_usage": 38248448}, "memory_usage": 24543232, "io": {"time_since_update": 7.868988275527954, "ior": 0, "iow": 0, "cumulative_ior": 622592, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {}, "network_rx": null, "network_tx": null}, {"key": "name", "name": "addon_a0d7b954_sonweb", "Names": ["addon_a0d7b954_sonweb"], "Id": "aa56f902be58c0358c2b5b5a568dd81e5d34aa942ae7fc5efb34d45aa70ca466", "Image": ["hassioaddons/sonweb-amd64:0.10.0"], "Status": "running", "Command": ["/init"], "cpu": {"total": 0.021715930457179653}, "cpu_percent": 0.021715930457179653, "memory": {"usage": 14327808, "limit": 7929602048, "max_usage": 203264000}, "memory_usage": 14327808, "io": {"time_since_update": 7.866141319274902, "ior": 0, "iow": 0, "cumulative_ior": 5992448, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.866130352020264, "rx": 0, "tx": 0, "cumulative_rx": 25670390, "cumulative_tx": 15498400}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_a0d7b954_ssh", "Names": ["addon_a0d7b954_ssh"], "Id": "9df927fd30021047fd1dff2595e15d40194d25a7bde6ec980f59cb59011a0b71", "Image": ["hassioaddons/ssh-amd64:7.1.0"], "Status": "running", "Command": ["/init"], "cpu": {"total": 0.01998900193174501}, "cpu_percent": 0.01998900193174501, "memory": {"usage": 13262848, "limit": 7929602048, "max_usage": 81076224}, "memory_usage": 13262848, "io": {"time_since_update": 7.870575189590454, "ior": 0, "iow": 0, "cumulative_ior": 987136, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {}, "network_rx": null, "network_tx": null}, {"key": "name", "name": "addon_a0d7b954_vscode", "Names": ["addon_a0d7b954_vscode"], "Id": "780fd42d5e8ed1c61adcfe8e19028a52a57431932747058400a1c2e2e49ddf23", "Image": ["hassioaddons/vscode-amd64:2.1.0"], "Status": "running", "Command": ["/init"], "cpu": {"total": 0.016643243986254296}, "cpu_percent": 0.016643243986254296, "memory": {"usage": 29593600, "limit": 7929602048, "max_usage": 97574912}, "memory_usage": 29593600, "io": {"time_since_update": 7.870167255401611, "ior": 0, "iow": 0, "cumulative_ior": 3919872, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.870167016983032, "rx": 0, "tx": 0, "cumulative_rx": 70967008, "cumulative_tx": 252672}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "portainer", "Names": ["portainer"], "Id": "22b51f03e3da89a5f6abc62955952f54bac7004fd3da7873da42f6a51aeb316b", "Image": ["portainer/portainer:latest"], "Status": "running", "Command": ["/portainer"], "cpu": {"total": 0.01504547455295736}, "cpu_percent": 0.01504547455295736, "memory": {"usage": 29749248, "limit": 7929602048, "max_usage": 38539264}, "memory_usage": 29749248, "io": {"time_since_update": 7.8740599155426025, "ior": 0, "iow": 0, "cumulative_ior": 2195456, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.874078989028931, "rx": 0, "tx": 0, "cumulative_rx": 75623311, "cumulative_tx": 47285431}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_a0d7b954_logviewer", "Names": ["addon_a0d7b954_logviewer"], "Id": "1fbb7de6322d188f583e624936968fc06461faceb8aa34d93fe7e821dcb10c22", "Image": ["hassioaddons/log-viewer-amd64:0.8.0"], "Status": "running", "Command": ["/init"], "cpu": {"total": 0.008909800687285222}, "cpu_percent": 0.008909800687285222, "memory": {"usage": 16474112, "limit": 7929602048, "max_usage": 24592384}, "memory_usage": 16474112, "io": {"time_since_update": 7.8661277294158936, "ior": 0, "iow": 0, "cumulative_ior": 2244608, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.866132497787476, "rx": 0, "tx": 0, "cumulative_rx": 23397440, "cumulative_tx": 117605}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_7be23ff5_dropbox_sync", "Names": ["addon_7be23ff5_dropbox_sync"], "Id": "7285ebc3e1cdbf2ae81dcced69ef0f2908f7cd19ae4fee55f3b77cae5c4d56f6", "Image": ["dwelch2101/dropbox-sync-amd64:1.3.0"], "Status": "running", "Command": null, "cpu": {"total": 0.008351678035470668}, "cpu_percent": 0.008351678035470668, "memory": {"usage": 16932864, "limit": 7929602048, "max_usage": 124162048}, "memory_usage": 16932864, "io": {"time_since_update": 7.872159242630005, "ior": 0, "iow": 0, "cumulative_ior": 70569984, "cumulative_iow": 2065846272}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.872158765792847, "rx": 0, "tx": 0, "cumulative_rx": 127290569, "cumulative_tx": 2443710462}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_a0d7b954_jupyterlablite", "Names": ["addon_a0d7b954_jupyterlablite"], "Id": "5344c9cda6c6f15204c88a19ac20dbdade7d940878de3a1a399b380569cd376d", "Image": ["hassioaddons/jupyterlablite-amd64:0.3.1"], "Status": "running", "Command": ["/init"], "cpu": {"total": 0.007104510309278351}, "cpu_percent": 0.007104510309278351, "memory": {"usage": 11419648, "limit": 7929602048, "max_usage": 100446208}, "memory_usage": 11419648, "io": {"time_since_update": 7.871636629104614, "ior": 0, "iow": 0, "cumulative_ior": 36147200, "cumulative_iow": 81920}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.871628046035767, "rx": 0, "tx": 0, "cumulative_rx": 68812218, "cumulative_tx": 3821}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "ha_dockermon", "Names": ["ha_dockermon"], "Id": "0b223d2a75ce56b144847dfe618c562251393c880b7a2248f8ca5acabfaf0702", "Image": ["philhawthorne/ha-dockermon:latest"], "Status": "running", "Command": null, "cpu": {"total": 0.0}, "cpu_percent": 0.0, "memory": {"usage": 23478272, "limit": 7929602048, "max_usage": 84070400}, "memory_usage": 23478272, "io": {"time_since_update": 7.878678560256958, "ior": 0, "iow": 0, "cumulative_ior": 5693440, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.878678560256958, "rx": 0, "tx": 0, "cumulative_rx": 167675855, "cumulative_tx": 149567384}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "watchtower", "Names": ["watchtower"], "Id": "b1ff137ab3542a65407d7c5d48bef545e4cdd146d9f65a4944f27d884c9f5958", "Image": ["v2tec/watchtower:latest"], "Status": "running", "Command": ["/watchtower"], "cpu": {"total": 0.0}, "cpu_percent": 0.0, "memory": {"usage": 9728000, "limit": 7929602048, "max_usage": 14192640}, "memory_usage": 9728000, "io": {"time_since_update": 7.877869367599487, "ior": 0, "iow": 0, "cumulative_ior": 2301952, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.877878665924072, "rx": 0, "tx": 0, "cumulative_rx": 68841751, "cumulative_tx": 0}, "network_rx": 0, "network_tx": 0}]} %}
{{ my_test_json.containers[2].memory }}
returns:
{‘usage’: 368283648, ‘limit’: 7929602048, ‘max_usage’: 4474834944}
But the order of the container in the string changes in some random way. So I need to extract the name as the state and then add attributes for memory and cpu… I’m really hoping to do this with one rest sensor but I can ‘feel’ a shell script coming on! I can 100% do this in bash
Save yourself the headache !
I output my temperatures in bash and then pipe them into mqtt… I’m sure there is another way, but thats the beauty of Linux.
Yeah MQTT works but when I do this kind of thing I prefer to not use it unless I have to… I can just use a token and curl to write sensors… It works right now using hadockermon but I have about 20 lines in my log on startup telling me rest is taking longer than 10 seconds to setup… so it’s not an urgent priority as I have a working solution - I’d just like to make it less resource intensive.
Hey guys I’m trying to track down why I am seeing CPU spikes without any correlating reason that I can find.
I’ve been looking for a way to track CPU by container and figured I should be able to get it from Glances since it shows it in the GUI.
I don’t understand from this thread how you did it @DavidFW1960, could you educate me?
Like I said I’m not using glances for this but HAdockermon. You can see my code in my sysmonitor package here
And I use a custom card in lovelace like here:
I am interested in Memory not CPU but the same could be used for CPU.
Sorry to go backwards in time - but you can call those attributes directly - as long as they exist
{% set my_test_json = {"containers": [{"key": "name", "name": "addon_a0d7b954_glances", "Names": ["addon_a0d7b954_glances"], "Id": "091751949b762d3a595bff4d538d6a36a847bfea8c490202ae51509db2aca37f", "Image": ["hassioaddons/glances-amd64:0.7.0"], "Status": "running", "Command": ["/init"], "cpu": {"total": 48.02419523160763}, "cpu_percent": 48.02419523160763, "memory": {"usage": 76931072, "limit": 7929602048, "max_usage": 103342080}, "memory_usage": 76931072, "io": {"time_since_update": 7.866706371307373, "ior": 0, "iow": 0, "cumulative_ior": 1998848, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {}, "network_rx": null, "network_tx": null}, {"key": "name", "name": "homeassistant", "Names": ["homeassistant"], "Id": "6a239f47017d56e80f63936091ba9fd51a40e04ddab6009d5c156ff12f548216", "Image": ["homeassistant/intel-nuc-homeassistant:0.106.0b4"], "Status": "running", "Command": ["/bin/entry.sh"], "cpu": {"total": 26.981084791238878}, "cpu_percent": 26.981084791238878, "memory": {"usage": 421117952, "limit": 7929602048, "max_usage": 607215616}, "memory_usage": 421117952, "io": {"time_since_update": 7.864121913909912, "ior": 0, "iow": 1966080, "cumulative_ior": 82919424, "cumulative_iow": 1229373440}, "io_r": 0, "io_w": 1966080, "network": {}, "network_rx": null, "network_tx": null}, {"key": "name", "name": "sonarr", "Names": ["sonarr"], "Id": "230e14de63fd7a15bf42ff4b9210252fb1f48ab7b1c74089c144fe018a6758ad", "Image": ["linuxserver/sonarr:preview"], "Status": "running", "Command": ["/init"], "cpu": {"total": 4.998698455598456}, "cpu_percent": 4.998698455598456, "memory": {"usage": 368283648, "limit": 7929602048, "max_usage": 4474834944}, "memory_usage": 368283648, "io": {"time_since_update": 7.866653203964233, "ior": 0, "iow": 0, "cumulative_ior": 8949760, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.8666441440582275, "rx": 0, "tx": 0, "cumulative_rx": 313015197, "cumulative_tx": 664213546}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_a0d7b954_appdaemon", "Names": ["addon_a0d7b954_appdaemon"], "Id": "6db499a17640c70ea4560e3de8c873b8eab791d23e17dc807093607e9ef8c070", "Image": ["hassioaddons/appdaemon-amd64:0.2.1"], "Status": "running", "Command": ["/init"], "cpu": {"total": 3.1609011796982167}, "cpu_percent": 3.1609011796982167, "memory": {"usage": 37212160, "limit": 7929602048, "max_usage": 39632896}, "memory_usage": 37212160, "io": {"time_since_update": 7.865100622177124, "ior": 0, "iow": 0, "cumulative_ior": 9486336, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.865109205245972, "rx": 0, "tx": 0, "cumulative_rx": 589678875, "cumulative_tx": 24638542}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "sabnzbd", "Names": ["sabnzbd"], "Id": "d129a5e87a0839a6a0a0b608a91e532e6cd19ef16fc48b65c84770d290e21160", "Image": ["linuxserver/sabnzbd:latest"], "Status": "running", "Command": ["/init"], "cpu": {"total": 3.089992005494506}, "cpu_percent": 3.089992005494506, "memory": {"usage": 175656960, "limit": 7929602048, "max_usage": 4605181952}, "memory_usage": 175656960, "io": {"time_since_update": 7.866118669509888, "ior": 0, "iow": 0, "cumulative_ior": 21733376, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.8661181926727295, "rx": 0, "tx": 0, "cumulative_rx": 14002781024, "cumulative_tx": 173887994}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_a0d7b954_zerotier", "Names": ["addon_a0d7b954_zerotier"], "Id": "fbfc8fd08ae99c797c31b893b5648fb95e94a01beec456c2049757f3c920821a", "Image": ["hassioaddons/zerotier-amd64:0.7.0"], "Status": "running", "Command": ["/init"], "cpu": {"total": 1.5620217586912066}, "cpu_percent": 1.5620217586912066, "memory": {"usage": 5685248, "limit": 7929602048, "max_usage": 9125888}, "memory_usage": 5685248, "io": {"time_since_update": 7.865957498550415, "ior": 0, "iow": 4096, "cumulative_ior": 106496, "cumulative_iow": 10780672}, "io_r": 0, "io_w": 4096, "network": {}, "network_rx": null, "network_tx": null}, {"key": "name", "name": "radarr", "Names": ["radarr"], "Id": "116f89a0f853344d07e77255200d7b3fda024585aadd3cffb3d51bb1dc7690a0", "Image": ["linuxserver/radarr:latest"], "Status": "running", "Command": ["/init"], "cpu": {"total": 0.423962722940776}, "cpu_percent": 0.423962722940776, "memory": {"usage": 324239360, "limit": 7929602048, "max_usage": 4760154112}, "memory_usage": 324239360, "io": {"time_since_update": 7.862757444381714, "ior": 0, "iow": 0, "cumulative_ior": 319488, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.862766742706299, "rx": 0, "tx": 0, "cumulative_rx": 25951263, "cumulative_tx": 37504428}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "hassio_supervisor", "Names": ["hassio_supervisor"], "Id": "053172a31cf8395d286438014f5037909c4c80b72e23fdf80e72690c0f71fe22", "Image": ["homeassistant/amd64-hassio-supervisor:latest"], "Status": "running", "Command": ["/bin/entry.sh"], "cpu": {"total": 0.32243756164383564}, "cpu_percent": 0.32243756164383564, "memory": {"usage": 662376448, "limit": 7929602048, "max_usage": 1474211840}, "memory_usage": 662376448, "io": {"time_since_update": 7.8769371509552, "ior": 0, "iow": 0, "cumulative_ior": 3424256, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.87699031829834, "rx": 0, "tx": 0, "cumulative_rx": 74224678, "cumulative_tx": 1314784}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_fe41fc28_caddy", "Names": ["addon_fe41fc28_caddy"], "Id": "f29021db5e4ff6c4a038bbcae857e966494fae3b87bc780f4f7b50015bea0e9e", "Image": ["korylprince/hassio-caddy-amd64:1.6"], "Status": "running", "Command": null, "cpu": {"total": 0.30390046391752573}, "cpu_percent": 0.30390046391752573, "memory": {"usage": 20197376, "limit": 7929602048, "max_usage": 34709504}, "memory_usage": 20197376, "io": {"time_since_update": 7.867704391479492, "ior": 0, "iow": 0, "cumulative_ior": 1626112, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {}, "network_rx": null, "network_tx": null}, {"key": "name", "name": "addon_core_mosquitto", "Names": ["addon_core_mosquitto"], "Id": "665ac3d6743204bc74c119ebff071be417bf8cf0f5e28147ebdbff4e760963c7", "Image": ["homeassistant/amd64-addon-mosquitto:5.1"], "Status": "running", "Command": null, "cpu": {"total": 0.15699887748117727}, "cpu_percent": 0.15699887748117727, "memory": {"usage": 10592256, "limit": 7929602048, "max_usage": 31805440}, "memory_usage": 10592256, "io": {"time_since_update": 7.86919379234314, "ior": 0, "iow": 0, "cumulative_ior": 30068736, "cumulative_iow": 6987776}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.869199275970459, "rx": 0, "tx": 0, "cumulative_rx": 129948603, "cumulative_tx": 51107091}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "hassio_dns", "Names": ["hassio_dns"], "Id": "52ca3e9b12ccb46c3885fc0692ae3f99d4222cadc6e6d528f830098dfbb53aa6", "Image": ["homeassistant/amd64-hassio-dns:1"], "Status": "running", "Command": null, "cpu": {"total": 0.09333055865921787}, "cpu_percent": 0.09333055865921787, "memory": {"usage": 15806464, "limit": 7929602048, "max_usage": 39018496}, "memory_usage": 15806464, "io": {"time_since_update": 7.873098134994507, "ior": 0, "iow": 0, "cumulative_ior": 720896, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.873104572296143, "rx": 0, "tx": 0, "cumulative_rx": 142920454, "cumulative_tx": 85533248}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_core_configurator", "Names": ["addon_core_configurator"], "Id": "5e29bbcfa024af9f6c143fd954713b6c9e72bc7a20e90482de39f1e96bc5efc0", "Image": ["homeassistant/amd64-addon-configurator:4.7"], "Status": "running", "Command": ["/init"], "cpu": {"total": 0.05470531873792659}, "cpu_percent": 0.05470531873792659, "memory": {"usage": 9089024, "limit": 7929602048, "max_usage": 17653760}, "memory_usage": 9089024, "io": {"time_since_update": 7.8675947189331055, "ior": 0, "iow": 0, "cumulative_ior": 630784, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.867594242095947, "rx": 0, "tx": 0, "cumulative_rx": 11122513, "cumulative_tx": 452}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "lazylibrarian", "Names": ["lazylibrarian"], "Id": "413e41b0eb610e03ca12142b8db3fae0a34a51a8dedad2ae0dd2d33f57fd91e9", "Image": ["linuxserver/lazylibrarian:latest"], "Status": "running", "Command": ["/init"], "cpu": {"total": 0.04072215258855586}, "cpu_percent": 0.04072215258855586, "memory": {"usage": 89722880, "limit": 7929602048, "max_usage": 100806656}, "memory_usage": 89722880, "io": {"time_since_update": 7.864665985107422, "ior": 0, "iow": 0, "cumulative_ior": 3756032, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.864654541015625, "rx": 0, "tx": 0, "cumulative_rx": 77697861, "cumulative_tx": 13704068}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_core_samba", "Names": ["addon_core_samba"], "Id": "778f59d4c13170536c95ade7cd37244dc15985c229839b4c989e1bf9689b4747", "Image": ["homeassistant/amd64-addon-samba:9.0"], "Status": "running", "Command": null, "cpu": {"total": 0.028758335607094135}, "cpu_percent": 0.028758335607094135, "memory": {"usage": 24543232, "limit": 7929602048, "max_usage": 38248448}, "memory_usage": 24543232, "io": {"time_since_update": 7.868988275527954, "ior": 0, "iow": 0, "cumulative_ior": 622592, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {}, "network_rx": null, "network_tx": null}, {"key": "name", "name": "addon_a0d7b954_sonweb", "Names": ["addon_a0d7b954_sonweb"], "Id": "aa56f902be58c0358c2b5b5a568dd81e5d34aa942ae7fc5efb34d45aa70ca466", "Image": ["hassioaddons/sonweb-amd64:0.10.0"], "Status": "running", "Command": ["/init"], "cpu": {"total": 0.021715930457179653}, "cpu_percent": 0.021715930457179653, "memory": {"usage": 14327808, "limit": 7929602048, "max_usage": 203264000}, "memory_usage": 14327808, "io": {"time_since_update": 7.866141319274902, "ior": 0, "iow": 0, "cumulative_ior": 5992448, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.866130352020264, "rx": 0, "tx": 0, "cumulative_rx": 25670390, "cumulative_tx": 15498400}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_a0d7b954_ssh", "Names": ["addon_a0d7b954_ssh"], "Id": "9df927fd30021047fd1dff2595e15d40194d25a7bde6ec980f59cb59011a0b71", "Image": ["hassioaddons/ssh-amd64:7.1.0"], "Status": "running", "Command": ["/init"], "cpu": {"total": 0.01998900193174501}, "cpu_percent": 0.01998900193174501, "memory": {"usage": 13262848, "limit": 7929602048, "max_usage": 81076224}, "memory_usage": 13262848, "io": {"time_since_update": 7.870575189590454, "ior": 0, "iow": 0, "cumulative_ior": 987136, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {}, "network_rx": null, "network_tx": null}, {"key": "name", "name": "addon_a0d7b954_vscode", "Names": ["addon_a0d7b954_vscode"], "Id": "780fd42d5e8ed1c61adcfe8e19028a52a57431932747058400a1c2e2e49ddf23", "Image": ["hassioaddons/vscode-amd64:2.1.0"], "Status": "running", "Command": ["/init"], "cpu": {"total": 0.016643243986254296}, "cpu_percent": 0.016643243986254296, "memory": {"usage": 29593600, "limit": 7929602048, "max_usage": 97574912}, "memory_usage": 29593600, "io": {"time_since_update": 7.870167255401611, "ior": 0, "iow": 0, "cumulative_ior": 3919872, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.870167016983032, "rx": 0, "tx": 0, "cumulative_rx": 70967008, "cumulative_tx": 252672}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "portainer", "Names": ["portainer"], "Id": "22b51f03e3da89a5f6abc62955952f54bac7004fd3da7873da42f6a51aeb316b", "Image": ["portainer/portainer:latest"], "Status": "running", "Command": ["/portainer"], "cpu": {"total": 0.01504547455295736}, "cpu_percent": 0.01504547455295736, "memory": {"usage": 29749248, "limit": 7929602048, "max_usage": 38539264}, "memory_usage": 29749248, "io": {"time_since_update": 7.8740599155426025, "ior": 0, "iow": 0, "cumulative_ior": 2195456, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.874078989028931, "rx": 0, "tx": 0, "cumulative_rx": 75623311, "cumulative_tx": 47285431}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_a0d7b954_logviewer", "Names": ["addon_a0d7b954_logviewer"], "Id": "1fbb7de6322d188f583e624936968fc06461faceb8aa34d93fe7e821dcb10c22", "Image": ["hassioaddons/log-viewer-amd64:0.8.0"], "Status": "running", "Command": ["/init"], "cpu": {"total": 0.008909800687285222}, "cpu_percent": 0.008909800687285222, "memory": {"usage": 16474112, "limit": 7929602048, "max_usage": 24592384}, "memory_usage": 16474112, "io": {"time_since_update": 7.8661277294158936, "ior": 0, "iow": 0, "cumulative_ior": 2244608, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.866132497787476, "rx": 0, "tx": 0, "cumulative_rx": 23397440, "cumulative_tx": 117605}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_7be23ff5_dropbox_sync", "Names": ["addon_7be23ff5_dropbox_sync"], "Id": "7285ebc3e1cdbf2ae81dcced69ef0f2908f7cd19ae4fee55f3b77cae5c4d56f6", "Image": ["dwelch2101/dropbox-sync-amd64:1.3.0"], "Status": "running", "Command": null, "cpu": {"total": 0.008351678035470668}, "cpu_percent": 0.008351678035470668, "memory": {"usage": 16932864, "limit": 7929602048, "max_usage": 124162048}, "memory_usage": 16932864, "io": {"time_since_update": 7.872159242630005, "ior": 0, "iow": 0, "cumulative_ior": 70569984, "cumulative_iow": 2065846272}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.872158765792847, "rx": 0, "tx": 0, "cumulative_rx": 127290569, "cumulative_tx": 2443710462}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "addon_a0d7b954_jupyterlablite", "Names": ["addon_a0d7b954_jupyterlablite"], "Id": "5344c9cda6c6f15204c88a19ac20dbdade7d940878de3a1a399b380569cd376d", "Image": ["hassioaddons/jupyterlablite-amd64:0.3.1"], "Status": "running", "Command": ["/init"], "cpu": {"total": 0.007104510309278351}, "cpu_percent": 0.007104510309278351, "memory": {"usage": 11419648, "limit": 7929602048, "max_usage": 100446208}, "memory_usage": 11419648, "io": {"time_since_update": 7.871636629104614, "ior": 0, "iow": 0, "cumulative_ior": 36147200, "cumulative_iow": 81920}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.871628046035767, "rx": 0, "tx": 0, "cumulative_rx": 68812218, "cumulative_tx": 3821}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "ha_dockermon", "Names": ["ha_dockermon"], "Id": "0b223d2a75ce56b144847dfe618c562251393c880b7a2248f8ca5acabfaf0702", "Image": ["philhawthorne/ha-dockermon:latest"], "Status": "running", "Command": null, "cpu": {"total": 0.0}, "cpu_percent": 0.0, "memory": {"usage": 23478272, "limit": 7929602048, "max_usage": 84070400}, "memory_usage": 23478272, "io": {"time_since_update": 7.878678560256958, "ior": 0, "iow": 0, "cumulative_ior": 5693440, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.878678560256958, "rx": 0, "tx": 0, "cumulative_rx": 167675855, "cumulative_tx": 149567384}, "network_rx": 0, "network_tx": 0}, {"key": "name", "name": "watchtower", "Names": ["watchtower"], "Id": "b1ff137ab3542a65407d7c5d48bef545e4cdd146d9f65a4944f27d884c9f5958", "Image": ["v2tec/watchtower:latest"], "Status": "running", "Command": ["/watchtower"], "cpu": {"total": 0.0}, "cpu_percent": 0.0, "memory": {"usage": 9728000, "limit": 7929602048, "max_usage": 14192640}, "memory_usage": 9728000, "io": {"time_since_update": 7.877869367599487, "ior": 0, "iow": 0, "cumulative_ior": 2301952, "cumulative_iow": 0}, "io_r": 0, "io_w": 0, "network": {"time_since_update": 7.877878665924072, "rx": 0, "tx": 0, "cumulative_rx": 68841751, "cumulative_tx": 0}, "network_rx": 0, "network_tx": 0}]} %}
All: {{ my_test_json.containers[2].memory }}
Usage: {{ my_test_json.containers[2].memory.usage }}
Max Usage: {{ my_test_json.containers[2].memory.max_usage }}
Limit: {{ my_test_json.containers[2].memory.limit }}
Yeah but how to get those for each addon… individually… not just a total
Put the above in the template editor and it returns:
All: {'usage': 368283648, 'limit': 7929602048, 'max_usage': 4474834944}
Usage: 368283648
Max Usage: 4474834944
Limit: 7929602048
Like I said:
Yeah I think this is where the rest sensor is limited - have you looked at docker_monitor rather then ha_dockermon?
docker_monitor? Never heard of it. HA Dockermon is working fine as you can see - I caqn extract everything I need using that. I aso use HADockermon to stop and start containers as well. Anyway I was responding to someone asking me a question (@Hurricane) rather than wanting to revive this thread.