Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make monitoring of apt optional #37

Closed
johny-mnemonic opened this issue Jun 7, 2020 · 7 comments
Closed

Make monitoring of apt optional #37

johny-mnemonic opened this issue Jun 7, 2020 · 7 comments

Comments

@johny-mnemonic
Copy link

While I agree, that monitoring of apt updates can be useful on many systems, on pre-built systems (like Hassio itself), it is not very useful and when you want to run system-sensors in docker, it doesn't make sense at all.

I want to monitor my RPi 3 running Hassio, but I am reluctant to install something directly into it's OS.
So I tried to run system-sensors as a docker container and apart from those apt updates, it works just fine without much effort.
I can provide a short how-to for anyone interested, but I was lazy and didn't even bother to create new docker image for it, so it is a bit dirty ;-)

@Sennevds
Copy link
Owner

Sennevds commented Jun 7, 2020

For a system running Hass itself you have all the sensors with a build in sensor. This script just reproduce the component. Does it give any errors for the apt updates or does it show just 0 updates?

@johny-mnemonic
Copy link
Author

The issue in docker is that it makes no sense to try to detect it's apt status, as it's apt cache is always clean. That's why I didn't want to install python3-apt in the first place. Now I tried and it would install lot of dependencies, as that base python image is stripped down as much as possible.
And thanks to that, your script fails right on the line "import apt".

I am not sure, whether it would be possible to talk to apt of host system from docker container to get it's apt status.
Maybe similar trick as talking to vcgencmd could be used, but I would leave that to someone smarter than me ;-)

BTW: Could you direct me where to find those built in sensors?
I didn't find temperature, boot time or swap and quite honestly I liked your Lovelace card config and wanted to have it the same for Hassio RPi as for other RPi's in my house ;-)

@Sennevds
Copy link
Owner

Sennevds commented Jun 8, 2020

For a device running Hass you could use system-monitor https://www.home-assistant.io/integrations/systemmonitor
I've updated the code to make the apt updates optional(haven't had the time to test it so if you could pull the latest version and try it that would be nice!

@johny-mnemonic
Copy link
Author

@Sennevds Thanks a lot! It works.

@johny-mnemonic
Copy link
Author

johny-mnemonic commented Jun 9, 2020

I am afraid, I was too fast reporting it works correctly.
The script works, but HA fails to parse it as there is an issue with the json output of last_boot. There seems to be missing quote:
{"temperature": 69.3, "disk_use": 13.4, "memory_use": 69.6, "cpu_usage": 9.1, "swap_usage": 100.0, "power_status": "Everything is working as intended", "last_boot": "2020-05-28T23:58:38+02:00, "last_message": "Tue Jun 9 12:00:42 2020"}

The missing quote got lost here: 94e7138#diff-1f786a78bd19509da3007e84eaf2df1fL85

@johny-mnemonic johny-mnemonic reopened this Jun 9, 2020
@Sennevds
Copy link
Owner

Sennevds commented Jun 9, 2020

I've changed the code but can't test right now could you test it?

@johny-mnemonic
Copy link
Author

Yep, the missing quote is back and HA can parse it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants