In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use Glances under Linux, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
Glances is a cross-platform monitoring tool designed to provide a large amount of monitoring information through curses or Web-based interfaces.
Here's what it looks like. The terminal in the screenshot below has been beautified with the Pywal tool and can automatically change color according to the wallpaper.
You can also integrate it into tools like Grafana to monitor statistics in an intuitive dashboard.
It is written in Python, which means that most of its features can be used on most platforms.
The function of Glances
Glances Data In Grafana Dashboard
Let's take a quick look at the main features provided by Glances:
You can monitor as many as 15 metrics on the system (including Docker containers). Flexible usage mode: stand-alone mode, client-server mode, through SSH and Web mode. Various REST API and XML-RPC API that can be used for integration. Support for easy export of data to different services and databases. Highly configurable and adaptable to different needs. Very comprehensive documentation. Install Glances on Ubuntu and other Linux distributions
Glances is available in the official libraries of many Linux distributions. This means that you can easily install it using your distribution's package manager.
On Debian/Ubuntu-based distributions, you can use the following command:
Sudo apt install glances
You can also install the latest Glances using the snap package:
Sudo snap install glances
Since Glances is based on Python, you can also use PIP to install it on most Linux distributions. Install PIP first, and then use it to install Glances:
Sudo pip3 install glances
If there is no other way, you can also use the automatic installation script provided by the Glances developer. While we don't recommend running scripts directly on your system, it's entirely up to you:
Curl-L https://bit.ly/glances | / bin/bash
You can see other ways to install Glances in their documentation, and you can even install it as a Docker container.
Use Glances to monitor Linux system resources on the local system (stand-alone mode)
You can easily start Glances to monitor your local machine by running this command on the terminal:
Glances
You can immediately observe that it integrates a lot of different information on one screen. I like it to display the public and private IP of computers at the top:
Introduction of Glances function of Multi-function Linux system Monitoring tool introduction of Glances function of Multi-function Linux system Monitoring tool
Glances is also interactive, which means you can use commands to interact with it while it is running. You can press s to display the sensor on the screen, k to display the list of TCP connections on the screen, and 1 to expand the CPU statistics to display a single thread.
You can also use the arrow keys to move through the process list and sort the table by different metrics.
You can start Glances with a variety of command line options. In addition, it has a lot of interactive commands. You can find a complete list in their rich documentation.
Press Ctrl+C to exit Glances.
Use Glances to monitor remote Linux systems (client-server mode)
To monitor remote computers, you can use Glances in client-server mode. You need to install Glances on both systems.
On a remote Linux system, start Glances in server mode using the-s option:
Glances-s
On the client system, start Glances in client mode and connect to the server using the following command:
Glances-c server_ip_address
You can also access any computer through SSH and start Glances, which works perfectly. For more information about the client-server mode, see here.
Use Glances to monitor Linux system resources in a Web browser (Web mode)
Glances can also run in Web mode. This means that you can use a Web browser to access Glances. Unlike the previous client-server model, you do not need to install Glances on the client system.
To start Glances in Web mode, use the-w option:
Glances-w
Note that even on a Linux server, it may display "Glances Web User Interface started on http://0.0.0.0:61208", when in fact it uses the IP address of the server."
The most important thing is that it uses the 61208 port number, which you can use to access Glances through a web browser. Just enter the port number after the IP address of the server, such as http://123.123.123.123:61208.
You can also use http://0.0.0.0:61208/ or https://localhost:61208/ access on your local system.
The Web mode also mimics what the terminal looks like. The web version is based on responsive design principles and looks good even on mobile phones.
You may want to protect Web mode with a password so that only authorized people can use it. The default user name is glances.
Root@localhost:~# glances-w-- passwordDefine the Glances webserver password (glances username): Password (confirm): Do you want to save the password? [Yes/No]: nGlances Web User Interface started on http://0.0.0.0:61208/
You can find more information about configuring passwords in the Quick start Guide.
Export Glances data to different services
One of the biggest advantages of using Glances is out of the box, which supports the export of data to various databases, services, and seamless integration into various data pipelines.
You can use this command to export to CSV while monitoring:
Glances-- export csv--export-csv-file / tmp/glances.csv
/ tmp/glances.csv is the location of the file. The data is filled in neatly in the form of a time series.
You can also export to other large applications, such as Prometheus, to enable conditional triggers and notifications.
It can be plugged directly into messaging services (such as RabbitMQ, MQTT) and streaming media platforms (such as Kafka), and export time series data to a database (such as InfluxDB), and use Grafana for visualization.
You can view the entire list of services and export options here.
Integrate Glances with other services using REST API
This is my favorite feature in the whole stack. Glances can not only bring various indicators together, but also expose them through API.
This simple and powerful feature makes it very easy to build custom applications, services, and middleware applications for any particular use case.
When you start Glances in Web mode, the REST API server starts automatically. To start it in API server mode, you can use the following command:
Glances-w-- disable-webui
REST API's documentation is comprehensive and its response is easy to integrate with Web applications. This makes it easy to build a unified dashboard to monitor multiple servers using tools like Node-RED.
Thank you for reading this article carefully. I hope the article "how to use Glances under Linux" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.