Skip to content

Instantly share code, notes, and snippets.

@andmax
Last active September 28, 2020 18:54
Show Gist options
  • Save andmax/5e079f8cc9fc90455743a863c7f012b0 to your computer and use it in GitHub Desktop.
Save andmax/5e079f8cc9fc90455743a863c7f012b0 to your computer and use it in GitHub Desktop.
Use glances to monitor a server resources (CPU, GPU) using browser
1- Install glances from its script to have latest version
2- (Ubuntu package is an old version), run with sudo -E -H
3- for root access preserving user environment and home dir
$ curl -L https://bit.ly/glances | sudo -E -H /bin/bash
4- Maybe py3nvml should also be installed for GPU monitoring:
$ sudo -E -H pip install py3nvml
5- Create dir: /etc/glances if it does not exist and edit:
6- /etc/glances/glances.conf; to allow some file systems and
7- hide others that may be cluttering the file systems list:
[fs]
allow=nfs,overlayfs
hide=/dev/loop*,/var/*,/usr/local/*
8- Create a systemd service to start glances web interface
$ sudo vim /etc/systemd/system/glancesweb.service
9- Content of glancesweb.service:
[Unit]
Description = Glances in Web Server Mode
After = network.target
[Service]
ExecStart = /usr/local/bin/glances --port 9123 --meangpu -w -t 5
[Install]
WantedBy = multi-user.target
10- Enable, start and check status of the new systemd service:
$ sudo systemctl daemon-reload
$ sudo systemctl enable glancesweb.service
$ sudo systemctl start glancesweb.service
$ sudo systemctl status glancesweb.service
11- Or use service command to start or check status of the service:
$ sudo service glancesweb start
$ sudo service glancesweb status
12- Keep in mind the first glances web access take several minutes to show
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment