Remote Monitoring with Glances
The basic problem is to get the data from the remote host. Starting with psutil
The Glances sensor sensor uses that API to get all needed data.
In this post a default Fedora 22 Workstation installation is used on the host that should be monitored. In fact, it doesn’t matter if the system is the local one or a remote one as long as Glances is available. With some adjustments it should work on your own systems too. The difference will be the package and the firewall management tools.
First some extra packages are needed beside Glances, especially the bottle
sudo dnf -y install glances python-bottle
On Fedora the Firewall settings are strict. Let’s open port 61208 to allow other hosts to connect to that port. This is not needed if you just want to observe your local machine.
sudo firewall-cmd --permanent --add-port=61208/tcp
sudo firewall-cmd --reload
Launch glances
and keep an eye on the output.
$ glances -w
Glances web server started on http://0.0.0.0:61208/
Now browse to http://IP_ADRRESS:61208/. You should see the webified view of Glances.
Glances web interface
Another check is to access the API located at http://IP_ADRRESS:61208/api/2/mem/used and to confirm that a detail about your memory usage is provided as a JSON response. If so, you are good to proceed.
$ curl -X GET http://IP_ADDRESS:61208/api/2/mem/used
{"used": 203943936}
Add the glances sensor entry to your configuration.yaml
file and restart Home Assistant then.
# Example configuration.yaml entry
- platform: glances
name: NAS
host: IP_ADDRESS
resources:
- 'disk_use_percent'
- 'disk_use'
- 'disk_free'
If there are no error in the log file then you should see your new sensors.
The Glances sensors
Glances