Real-time monitoring of the Linux system by Swiss Army knife--glances

Source: Internet
Author: User
Tags cpu usage disk usage server port linux mint

Earlier, we mentioned that there are many Linux system monitoring tools that can be used to monitor system performance. But we estimate that perhaps more users will tend to have tools with most Linux distributions (Top command).

The top command is a real-time task Manager under Linux, and is also a common system monitoring tool used to look for system performance bottlenecks in the Gnu/linux release and help us do the right thing. She has a very simple interface and comes with a small number of practical options that can help us quickly understand system performance.

However, there are times when it may be difficult to find an application or process that occupies a large amount of system resources. because the top command itself does not help us highlight programs that eat too much CPU, memory, or other resources.

To achieve this goal, here we will introduce a super-awesome system monitoring program--glances. She can automatically highlight programs that utilize the highest system resources and provide as much information as possible to the Linux/unix server.

What is glances?

Glances is a curses-based, cross-platform command-line system monitoring tool written by Python that uses Psutil libraries authoring to crawl information from the system. With glances, we can monitor the utilization of CPU, average load, memory, network traffic, disk I/O, other processors and file system space.

Glances is a GPL-licensed free software used to monitor the Gnu/linux and FreeBSD operating systems.

Glances also offers a number of practical options. One of the main features that we can see in the profile is setting the key values and corresponding tags (careful[caution], warning[warning] and critical[critical]), and then she will automatically help us to mark the system with different colors to reach a bottleneck of the information.

Glances main functions
    • CPU information (user related applications, system core programs and idle programs)
    • Total memory information, including physical memory, swap space and free memory, etc.
    • Average CPU load for the previous 1 minutes, 5 minutes, and 15 minutes
    • Downlink and upstream speed for network links
    • Total number of processors, and their active status
    • Hard disk I/O correlation (read/write) speed details
    • Disk usage for the current mounted device
    • High CPU and memory use of the process name, and the location of the associated application
    • Display the current date and time at the bottom
    • The process that consumes the highest system resources is marked in red

The following is a glances use:

Glances View

Installing the glances in the Linux/unix system

Although this tool is released late, you can still install it through the EPEL software source in Red Hat systems. Install in terminal with the following command:

For the Rhel/centos/fedora release
    1. # Yum install -y glances
For Debian/ubuntu/linux Mint Release
    1. $ sudo apt-add-repository ppa:Arnaud-Hartmann/glances- stable
    2. $ sudo apt-get update
    3. $ sudo apt-get install glances
How to use Glances

First, you need to enter the following command in the terminal

    1. # Glances

Glances Preview–ubuntu 13.10

Press ' Q ' (' ESC ' and ' ctrl-c ') to exit the glances terminal. Here is another one intercepted from CentOS 6.5:

Glances Preview–centos 6.5

The default refresh rate for Glances is 1 (seconds), but you can manually define its refresh rate by specifying parameters in the terminal

    1. # Glances -t 2
The meaning of color in glances

Glances will use several colors to represent the state:

    • Green: OK (everything works)
    • Blue: Careful (attention required)
    • Purple: WARNING (Warning)
    • Red: CRITICAL (severe)

Thresholds can be set in the configuration file, and general thresholds are set by default (Careful=50, warning=70, critical=90).

We can customize it according to our needs in the configuration file (default in/etc/glances/glances.conf).

Options for Glances

In addition to a number of command-line options, glances provides more shortcuts for switching output information options at run time, here are some examples:

    • A – automatic sequencing of processes
    • C – Process Sort by CPU percentage
    • M – Process Sort by percentage of memory
    • P – Process Sort by Process name Master Order
    • I – Process sequencing by read/write frequency (I/O)
    • D – Show/Hide disk I/O statistics
    • F – Show/Hide file system statistics
    • n – Show/Hide Network interface statistics
    • S-Show/Hide sensor statistics
    • Y – Show/hide hard drive temperature statistics
    • L – Show/Hide logs (log)
    • b – Switching network I/O units (bytes/bits)
    • W – Deleting warning logs
    • X – Delete warnings and critical logs
    • --Switch global CPU usage and usage per CPU
    • H – Show/hide this help screen
    • T-browsing Network I/O in a combined form
    • U Browse Network I/O in cumulative form
    • Q – Exit (' ESC ' and ' ctrl&c ' also available)
Remote use of Glances

You can even monitor remote systems with glances. To use ' glances ' on the remote system, you need to run the ' glances-s ' (-S boot server/client mode) command on the server.

    1. # glances -
    2.  
    3. define the password for the glances< Span class= "PLN" > server
    4. password :
    5. password (confirm
    6. glances server is running on 0.0 . 0.0:61209

Note: When you execute the ' glances ' command, she will let you set the password for the glances server.

When you are done, you will see the message "Glances server is running on 0.0.0.0:61209" (the glances server is running on port 61209 of 0.0.0.0).

When the glances server is started, execute the following command locally to specify the server IP address or hostname to link to.

Note: The ' 172.16.27.56 ' here is the IP address of my glances server.

    1. # Glances -C -P 172.16. 27.56

Here are some things to know when using server/client mode:

* In server mode, you can use '-B address ' to set the binding address, or through the '-P port ' to bind the listening TCP port * In the client mode, you can specify the server port via the same '-P port ' * The default binding address is 0.0.0.0, but doing so will listen to all networks The specified port of the interface * in server/client mode, the limit threshold will be determined by the settings of the server * You can also use the '-p password ' at the command line to set a password for the server side.
Summarize

Glances is a tool for most users to provide too much information on system resources. But if you are a system administrator who wants to get the overall status of the system from the command line, this tool is definitely a must.

Translator note
    1. Please do not confuse glances (the tool in this article) with glance (an OpenStack tool) these two packages
    2. Ubuntu official Extra Source glances because the problem with the Python library move is not working properly but can be fixed temporarily by creating a soft link: sudo ln-s/usr/lib/python2.7/dist-packages/glance S/usr/share/pyshared/glances

via:http://www.tecmint.com/glances-an-advanced-real-time-system-monitoring-tool-for-linux/

Translator: Vizv Proofreading: Wxy

This article by LCTT original translation, Linux China honors launch

Real-time monitoring of the Linux system by Swiss Army knife--glances

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.