Este post também está disponível em:
Glances is a free, Open Source, cross-platform, real-time tool, just like other similar tools like top and htop.
It offers advanced features compared to similar ones, and it can run in different modes: as standalone, in client/server mode and in web server mode. As you will see below, it is not just another tool.
To run Glances in Web Server mode, we will need to install together a python module called bottle. In this post we will teach you how to install Glances, run it, some settings and demonstrate how useful this tool is in everyday life.
1 – Installing pip3 and devel module
Red Hat / CentOS
yum install python3-pip python3-devel -y
Debian / Ubuntu
apt install python3-pip python3-dev -y
2 – Installing Glances
Red Hat / CentOS
pip3 install glances
Debian / Ubuntu
pip3 install glances
3 – Installing bottle module
Red Hat / CentOS
yum install python3-bottle
Debian / Ubuntu
apt install python3-bottle
If you can’t install with the instructions above, you can try installing with yum or apt depending on your distribution. I approached the installation with pip3 because the available version is more up-to-date.
4 – Running Glances for the first time and getting to know the interface.
In your linux shell run
glances
On the Glances screen we have a lot of important information, CPU %, MEM, SWAP, Number of TCP Connections etc… and it doesn’t stop there, there are several features that can still be enabled or disabled.
5 – Running Glances in Web Server mode securely
Now let’s activate the Web Server mode with a password, so that you can access the Glances interface in your Browser. Before starting, release tcp port 61208 on your firewall
glances -w --password
When executing the above command, it will ask you to enter the password and confirm it, at the end it will ask if you want to save these changes. The user will be glances, the password will be the one you defined, at the end the glances will already be in server mode as shown in the image below, just access http://ipdoseserver:61208 , user glances and the password you defined.
When you want to stop web mode, just use ctrl + c in your terminal.
6 – A little about the glances.conf file
No configuration files are needed for Glances. The glances.conf just offers more features and settings. The intention is not to explain all the functionality of glances.conf, but to make clear what it does and how useful it can be in your monitoring.
Your glances.conf can be saved in ~/.config/glances or in /etc/glances
You can find a template of glances.conf at
/usr/local/share/doc/glances/glances.conf
If not, the file is available on the Glances project’s GitHub
In glances.conf you can set many things, for example the alert level for CPU, MEM, IOWAIT, NETWORK, NGINX STATUS, and many other features. This file is really worth seeing and studying a bit.
We at HelpSysAdmin use Glances a lot and optimize it on our customers’ servers