Centos performance monitoring series 2: initial solution of Collectl

Source: Internet
Author: User
Tags disk usage linux mint

Centos performance monitoring series 2: initial solution of Collectl


For a Linux system administrator, it is the primary responsibility to ensure that the system managed by the Administrator is in a good state.
Linux administrators can find many tools to help them monitor and display processes in the system, such as top and htop.
Today, we will introduce collectl, a tool that is easy to use;
Introduction:Collectl is an excellent utility with rich command line functions. You can use it to collect performance data describing the current system status. Unlike most other system monitoring tools, collectl is not limited to limited system metrics. Instead, it can collect information about many different types of system resources, such as cpu, disk, memory, network, sockets, tcp, inodes, infiniband, lustre, memory, nfs, processes, quadrics, slabs, and buddyinfo.
Another benefit of using collectl is that it can replace other tools for specific purposes, such as top, ps, iotop, and so on. So what are the features of collectl that make it a useful tool?


Collectl features

It can run interactively, as a daemon, or simultaneously.

Output can be displayed in multiple formats.

Monitors almost all subsystems.

It can replace many tools such as ps, top, iotop, and vmstat.

You can record and play back captured data.

You can export data to multiple data formats. (This is useful when you want to use external tools to analyze data)

It can be used as a service to monitor remote machines or the entire server cluster.

Data can be displayed on the terminal and written to a file or a socket.

How to install collectl on Linux

Collectl can run on all Linux distributions. The only requirement is the perl language. Therefore, before installing collectl, make sure that Perl is installed on your computer.

For Debian/Ubuntu/Linux Mint

The following command can be used to install collectl On Debian-based devices such as Ubuntu.

For RHEL/CentOS/Fedora 

If you are using a red hat-based release, you can use the yum command to easily obtain it.

Some collectl instances 

After the collectl tool is installed, you can run it easily on the terminal without specifying any options. The following command displays cpu, hard disk, and network information in a short and easy-to-read format.

 

As shown on the terminal above, it is easy to observe the System Metric value output by this command, because it is displayed in one line at a time.

The following sub-system information is displayed when you execute collectl without adding any parameters.

$ Sudo apt-get install collectl # yum install collectl # collectl waiting for 1 second sample... # cpu sys inter ctxsw KBRead Reads KBWrit Writes KBIn PktIn KBOut PktOut13 5 790 1322 0 0 0 92 7 4 13 0 510 2 719 0 0 0 0 0 3 9 0 1186 412 753 0 0 0 52 3 2 5 0 613 2 733 0 0 0 0 1 1 0 1063 2 125 834 0 0 0 0 1 1 0 1375 2 128 870 0 36 7 1 1 0 1424 3 949 2271 0 0 44 3 1 1 0 117 2 809 0 0 0 0 1 6 0 1384 2 616 0 0 0 1 1 0 732 4 1348 0 0 56 3 1 2 0 3 CPU
Disk
Network

 

But how do you use it to monitor cpu usage? The '-S' option can be used to control which subsystem's data needs to be collected and played back.

For example, the following command can be used to summarize the cpu usage.

 

 

 

The above output is useful when you want to learn more about memory usage, idle memory, or important information related to your system performance.

What if I want to collect some tcp Data? Run the following command.

 

When you are proficient in a certain degree, you can easily get the desired results. For example, you can combine the "t" option about tcp and the "c" option about cpu. The following command is used.

 

The following is a simple example;

 

 

It is very difficult for the general public to remember these options, so here I have compiled a list to summarize the options supported by this tool.

# Collectl-SC waiting for 1 second sample... # cpu sys inter ctxsw15 2 749 115516 3 772 144514 2 793 124727 4 887 129224 1 796 1 125816 1 743 1 111315 743 1 117914 1 706 107815 764 # collectl-st waiting for 1 second sample... # IP Tcp Udp Icmp0 0 0 00 0 00 0 00 0 00 0 0 00 0 00 0 0 00 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 0 0 # collectl-stc waiting for 1 second sample... # cpu sys inter ctxsw IP Tcp Udp Icmp23 8 961 3136 0 0 0 024 5 916 3662 0 0 021 8 848 2408 0 0 0 0 0 030 10 916 2674 0 0 0 038 3 826 1752 0 0 0 031 3 820 1408 0 0 0 0 15 5 781 0 0 0 0 017 3 1335 0 0 0 0 0 802 0 0 0 0 0 0 0 0 0 0 2 1314 0 0 0 0 0 0 0 B -buddy info (memory fragment)
C-CPU
D-Disk
F-NFS V3 Data
I-Inode and File System
J-Interrupts
L-Lustre
M-Memory
N-Networks
S-Sockets
T-TCP
X-Interconnect
Y-Slabs (System Object cache)

One of the most important data for a system administrator or Linux user is the usage of the hard disk. The following command can help you monitor hard disk usage.

 

You can also use the "-sD" option to collect data from a single hard disk, but you must know that this will not display all the hard disk information.

 

You can also use other detailed subsystems to collect detailed data. The following is a list of detailed subsystems.

# Collectl-sd waiting for 1 second sample... # KBRead Reads KBWrit Writes0 0 00 0 00 0 00 0 92 70 0 0 00 0 36 30 0 00 0 0 00 0 0 100 70 0 0 0 0 # collectl-sD waiting for 1 second sample... # disk statistics (/sec) # Pct # Name KBytes Merged IOs Size RWSize QLen Wait SvcTim Utilsda 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0sda 0 0 0 0 24 0 2 12 12 0 0 0 0sda 0 0 0 0 152 0 4 38 38 0 0 0 0 0sda 0 0 0 0 192 45 3 64 1 20 20 5sda 0 0 0 204 0 2 102 0 0 0 0 0sda 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0sda 0 0 0 0 0 102 26 3 39 38 1 16 16 4sda 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 32 5 3 11 10 1 16 4sda 0 0 0 0 0 0 0 0 0 0 0 0C-CPU
D-Disk
E-Environmental data (fan, power, temp), via ipmitool
F-NFS Data
J-Interrupts
L-Lustre OST detail OR client Filesystem detail
N-Networks
T-65 TCP counters only available in plot format
X-Interconnect
Y-Slabs (system object caches)
Z-Processes

 

The collectl tool has many options, but it cannot be described in just one article. However, using it as a top and ps tool is worth mentioning.

It is easy to use collectl as top, as long as you run the following command on a Linux terminal, you will see the output similar to the top tool.

For more information, enter the following command on your terminal.

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.