+5 votes
378 views
How to install Glances to remotely monitor by Linux web

in Linux / Unix by (552k points)
reopened | 378 views

1 Answer

+3 votes
Best answer

1. Install Glances on Linux
2. Enable the firewall for Glances on Linux
3. Use Glances in Linux

Frequent monitoring of the systems we administer allows us to be one step ahead of the problems that may arise in the short, medium or long term, helping the general administration in a completely integral way..

There are hundreds of tools that allow us to see the status of software and hardware with its different parameters but this time we will talk about a utility called Glances which goes much further allowing us to manage the equipment not only locally but also through any web browser , mobile device or other PC making it an integral solution since in some occasions we will not be able to face the equipment to be analyzed and it becomes the ideal solution to access remotely and see the behavior of the system.

What is Glances?
Glances is a tool for comprehensive monitoring of the operating system that can be executed in a multiplatform environment and has been written in Python for optimal development.

The objective with which Glances was created is to offer the administrator or user as much information as possible in a minimum space using the curses, local, or web-based interface. It is important to mention that this data can be dynamically adapted depending on the size of the user interface thus avoiding omitting details..

One of the outstanding features of Glances is that it has the ability to operate in client / server mode. Remote server monitoring can be executed through the terminal, the web interface or the API (XML-RPC and RESTful).

Statistics can also be exported to external files or databases for further administrative management..

As we have mentioned, Glances is written in Python and makes use of libraries to obtain information on the selected system. It is based on an open architecture where developers can add new add-ons or export modules thus increasing the usability and utility analysis.

What does Glances analyze
The components analyzed by Glances are:
  • CPU
  • Memory
  • Loading time
  • Process List
  • Network interface
  • I / O discs
  • IRQ / Raid
  • Sensors
  • System files and folders
  • Docker
  • Monitor
  • Alerts
  • System information
  • Login Time
  • Quicklook (CPU, MEM, LOAD)
Characteristics of Glances
When using Glances we will have the following advantages:
  • Glances can be run on multiple platforms such as GNU / Linux, FreeBSD, OS X and Windows.
  • Glances has an XML-RPC server and a RESTful JSON API which enables this utility to be used in additional software allowing remote administration.
  • It includes a web user interface which allows us to access information from any device.
  • By using Glances, it will be possible to export all system statistics to formats such as CSV, InfluxDB, Cassandra, OpenTSDB, StatsD, ElasticSearch or RabbitMQ. Glances also offers a Grafana board dedicated to data.
Requirements to use Glances
The basic requirements to use Glances are:
 python 2.7 or> = 3.3 psutil> = 2.0.0 
Some additional dependencies are:
 Bernhard (for the Riemann export module) bottle (for web server mode) cassandra-driver (for the Cassandra export module) couchdb (for CouchDB export module) docker (for Docker monitoring support), only on Linux elasticsearch (for the Elastic Search export module) hddtemp (for HDD temperature monitoring support), only on Linux influexdb (for InfluxDB export module) kafka-python (for the Kafka export module) matplotlib (for graphic / graphic support) netifaces (for the IP plugin) nvidia-ml-py3 (for the GPU plugin) pika (for RabbitMQ / ActiveMQ export module) potsdb (for the OpenTSDB export module) prometheus_client (for Prometheus export module) py-cpuinfo (for the Quicklook CPU information module) pymdstat (for RAID support), only on Linux pysnmp (for SNMP support) pystache (for the script action function) pyzmq (for the ZeroMQ export module) requests (for ports, cloud add-ons and restful export module) scandir (for the Folders plugin), Only for Python <3.5 statsd (for the StatsD export module) wifi (for the wifi plugin), only on Linux zeroconf (for autodetection mode) 

1. Install Glances on Linux

Step 1

To run the Glances utility in the web server mode, it must be installed together with the Python Bootle module, which is a fast, simple and lightweight WSGI micro-framework, we can execute one of the following options:
 sudo apt install glances python-bottle (Debian / Ubuntu) sudo yum install glances python-bottle (RHEL / CentOS) sudo dnf install glancespython-bottle (Fedora 22+) 
image
Step 2

Alternatively we have the following installation options:
  • If we use PIP we can execute the following:
 sudo pip install bottle 
  • If we want to install dependencies using this method we can execute:
 pip install glances [action, browser, cloud, cpuinfo, chart, docker, export, folders, gpu, ip, raid, snmp, web, wifi] 
Step 3

To update Glances we will use:
 pip install --upgrade glances pip install --upgrade glances 
Step 4

To install both dependencies and the latest version ready for production of Glances we must execute one of the following commands:
 curl -L https://bit.ly/glances | / bin / bash wget -O- https://bit.ly/glances | / bin / bash 
Note
This option only applies in GNU / Linux environments.
Step 5

If we are lovers of using Docker, Glances has an available container which includes the HEAD development version, if we want to use this method we will execute:
  • Get the container of Glances:
 docker pull nicolargo / glances 
  • Run the container in console mode:
 docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it docker.io/nicolargo/glances 
Step 6

If we have other operating systems we can execute the following:
FreeBSD
 pkg install py27-glances (Install the Glances binaries) cd / usr / ports / sysutils / py-glances / (Install Glances from Ports) make install clean 
macOS
 brew install glances (Installation using HomeBrew) sudo port install glances (Installation using MacPors) 
Windows
We must have Python installed in the system and execute the following:
 pip install glances 
Android
We will need a rooted device and the Termux application which we obtain for free at the following link:
Termux

Then we will execute the following from it:

 apt update apt upgrade apt install clang python python-dev pip install bottle pip install glances 
Finally, if we want to install Glances from a resource we can execute:
 wget https://github.com/nicolargo/glances/archive/vX.Y.tar.gz -O - | tar xz cd glances- * python setup.py install 

2. Enable the firewall for Glances on Linux


Because Glances can be accessed through the web it is necessary that we grant permission to the port for web access.
Step 1

If we use Firewalld we must execute the following lines:
 sudo firewall-cmd --permanent --add-port = 61208 / tcp sudo firewall-cmd –reload 
Step 2

In case of using UFW we can execute the following:
 sudo ufw status sudo ufw enable sudo ufw allow 61208 / tcp sudo ufw reload 
image

3. Use Glances in Linux

Step 1

Glances can be executed locally or remotely, to execute it locally, simply use the following line:
 Glances 
Step 2

Pressing Enter we will see a complete summary of the system parameters: image
Step 3

If we want to run the client / server mode we must use the following line:
 glances -s 
Step 4

To enable the web access mode, ideal in this tutorial, we must run the following command in the background:
 glances -w 
image
Step 5

This action must be left in execution to enable remote access, and as we see, the syntax to access is:
 http: // Server_IP: 61208 / 
Step 6

If we access from a browser, in this case Google Chrome, we will see all the distribution information where Glances has been installed: image
Step 7

We can still access from our Smartphone:

image

Step 8

As we can see, each category that encompasses Glances will be displayed there.
Glances uses a color scale to determine the priority or status of services which are:

image

Step 9

The options available with Glances are:
m
Sort the processes by MEM%.
p
Sort the processes by name.
C
Sort the processes by CPU%.
d
Show or hide disk I / O statistics.
to
Sort the processes automatically.
F
Show or hide the statshddtemp file system.
j
Sort the processes by I / O rate.
s
Show or hide sensor statistics.
Y
Show or hide hddtemp statistics.
l
Show or hide records.
n
Show or hide network statistics.
x
Eliminate warnings and critical records.
h
Show or hide the help screen.
that
Exit the utility.
w
Delete warning records.

We have seen how this practical utility will be of great help for administration tasks in multiple operating systems.


by (3.5m points)
edited

Related questions

+3 votes
1 answer
asked Sep 22, 2019 in Linux / Unix by backtothefuture (552k points) | 238 views
+5 votes
1 answer
asked Feb 11, 2020 in Linux / Unix by backtothefuture (552k points) | 1.7k views
+3 votes
1 answer
asked Jun 23, 2020 in Android Tutorial by backtothefuture (552k points) | 248 views
+4 votes
1 answer
asked Jun 12, 2020 in Linux / Unix by backtothefuture (552k points) | 859 views
+3 votes
1 answer
asked Oct 22, 2019 in Linux / Unix by backtothefuture (552k points) | 248 views
Sponsored articles cost $40 per post. You can contact us via Feedback

Most popular questions within the last 30 days

10,659 questions
10,791 answers
510 comments
3 users