Monitor systems: Monitoring in HomeAssistant with Glances

 

For collecting system data from other operating systems, HomeAssistant offers Glances integration, among other things. Glances is a terminal program for monitoring system status such as CPU, memory or disk usage. The additional WebServer mode allows to retrieve the status without SSH. For information about the integration in Home-Assistant, see: Home-Assistant.

Prerequisite:

The Python based tool can be used on almost all operating systems where Python is available, see: github.com/nicolargo/glances.

Linux

Glances can be enabled on a Linux system as follows:

 sudo apt install glances python3-pip

For the WebServer mode the bottle module is required, otherwise the server thanks with the following message: Bottle module not found. Glances cannot start in web server mode.

Bottle can be activated with this command:

pip install bottle

For security reasons, a password should be set for access.

glances -w --password

And for Glances to start automatically, the package can be created as a service:

Start as service

echo "[Unit]" > /usr/lib/systemd/system/glances.service
echo "Description = Glances in Web Server Mode" >> /usr/lib/systemd/system/glances.service
echo "After = network.target" >> /usr/lib/systemd/system/glances.service
echo "" >> /usr/lib/systemd/system/glances.service
echo "[Service]" >> /usr/lib/systemd/system/glances.service
echo "ExecStart = /usr/bin/glances -w  --password" >> /usr/lib/systemd/system/glances.service
echo "" >> /usr/lib/systemd/system/glances.service
echo "[Install]" >> /usr/lib/systemd/system/glances.service
echo "WantedBy = multi-user.target" >> /usr/lib/systemd/system/glances.service
sudo systemctl enable glances.service
sudo systemctl start glances.service
sudo systemctl status glances.service

Optional Docker Integration

If you want to collect statistics on running Docker containers, you can do so with the following command:

pip install glances[docker]

Conclusion

Glances allows easy monitoring of various operating systems and their performance counters and provides a way to make them available in Home-Assistant, see: Home-Assistant.

positive Bewertung({{pro_count}})
Rate Post:
{{percentage}} % positive
negative Bewertung({{con_count}})

THANK YOU for your review!

Questions / Comments


By continuing to browse the site, you agree to our use of cookies. More Details