18 command line tools for Linux Performance Monitoring)

Source: Internet
Author: User
For system and network administrators to monitor and debug the performance of Linux systems every day is a heavy job. After working in the IT field as a Linux system administrator for 5 years, I gradually realized how difficult it is to monitor and keep the system up and running. For this reason, we have written a list of the 18 most commonly used command-line tools, which will help every Linux / Unix system administrator. These command-line tools can be used in various Linux systems and can be used to monitor and find the cause of performance problems. This list of command line tools provides enough tools, and you can choose the tools that are suitable for your monitoring scenario.

1.Top-Linux process monitoring

The Top command under Linux is a performance monitoring program. Many system administrators often use it to monitor Linux performance. This command is available in many Linux or Unix-like operating systems. The Top command is used to display all running and active real-time processes in a certain order, and will periodically update the display results. This command shows the CPU usage, memory usage, swap memory usage size, cache usage size, buffer usage size, process PID, commands used, and others. It can also show the memory and CPU usage of running processes. For system administrators, the top command is very useful, it can be used to monitor the system and take corrective actions when needed. Let us look at the actual top command.

# top
Top command examples

For more examples of Top commands, please read: 12 Examples of Using Top Commands in Linux.

2. VmStat-Virtual memory statistics

Linux's VmStat command is used to display statistics of virtual memory, kernel threads, disks, system processes, I / O blocks, interrupts, CPU activity, etc. By default, the vmstat command is not available on Linux systems. You need to install a sysstat package that contains the vmstat program. The common usage of the command format is:

# vmstat
procs ----------- memory ---------- --- swap-- ----- io ---- --system-- ----- cpu -----
 r b swpd free inact active si so bi bo in cs us sy id wa st
 1 0 0 810420 97380 70628 0 0 115 4 89 79 1 6 90 3 0
For more vmstat examples, please read: 6 Vmstat Command Examples under Linux

3. Lsof-list open files

The lsof command is available on many Linux or Unix-like systems. It is often used to display all open files and processes in a list. Open files include disk files, network sockets, pipes, devices, and processes. One of the main situations in which this command is used is when it is not possible to mount the disk and display an error message that a file is being used or opened. With this command, you can easily see which file is being used. The most common format of this command is as follows:

# lsof
init 1 root cwd DIR 104,2 4096 2 /
init 1 root rtd DIR 104,2 4096 2 /
init 1 root txt REG 104,2 38652 17710339 / sbin / init
init 1 root mem REG 104,2 129900 196453 /lib/ld-2.5.so
init 1 root mem REG 104,2 1693812 196454 /lib/libc-2.5.so
init 1 root mem REG 104,2 20668 196479 /lib/libdl-2.5.so
init 1 root mem REG 104,2 245376 196419 /lib/libsepol.so.1
init 1 root mem REG 104,2 93508 196431 /lib/libselinux.so.1
init 1 root 10u FIFO 0,17 953 / dev / initctl
For more information about the usage and examples of the lsof command, please refer to: 10 Examples of Using the lsof Command under Linux.

4.Tcpdump-network packet analyzer

Tcpdump is one of the most widely used network packet analyzers or packet monitoring programs. It is used to capture or filter TCP / IP packets received or transmitted on a specified interface on the network. It also has an option to save the captured package to a file for later analysis. In almost all major Linux distributions, tcpdump can be used.

# tcpdump -i eth0tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
22: 08: 59.617628 IP tecmint.com.ssh> P 2532133365: 2532133481 (116) ack 3561562349 win 9648
22: 09: 07.653466 IP tecmint.com.ssh> P 116: 232 (116) ack 1 win 9648
22: 08: 59.617916 IP> tecmint.com.ssh:. Ack 116 win 64347
For more information on the usage of tcpdump, please refer to: 12 Examples of Using Tcpdump Command under Linux.

5. Netstat-network status statistics

Netstat is a command-line tool for monitoring the statistics of packets entering and leaving the network and network interface. It is a very useful tool that system administrators can use to monitor network performance, locate and solve network-related problems.

# netstat -a | moreActive Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *: mysql *: * LISTEN
tcp 0 0 *: sunrpc *: * LISTEN
tcp 0 0 *: realm-rusd *: * LISTEN
tcp 0 0 *: ftp *: * LISTEN
tcp 0 0 localhost.localdomain: ipp *: * LISTEN
tcp 0 0 localhost.localdomain: smtp *: * LISTEN
tcp 0 0 localhost.localdomain: smtp localhost.localdomain: 42709 TIME_WAIT
tcp 0 0 localhost.localdomain: smtp localhost.localdomain: 42710 TIME_WAIT
tcp 0 0 *: http *: * LISTEN
tcp 0 0 *: ssh *: * LISTEN
tcp 0 0 *: https *: * LISTEN
For more examples of Netstat, please refer to: 20 Examples of Using Netstat Commands in Linux.

6. Htop-Linux process monitoring

Htop is a very advanced interactive real-time Linux process monitoring tool. It is very similar to the top command, but it has richer features, such as users can manage the process friendly, shortcut keys, vertical and horizontal display process and so on. Htop is a third-party tool, it is not included in the Linux system, you need to use the YUM package management tool to install it. For more information about installation, please read below.

# htop
Htop command examples

For Htop installation, please read: Install Htop in Linux (Linux Process Monitoring)

7.Iotop-Monitor Linux disk I / O

The Iotop command is also very similar to the top command and Htop program, but it has the function of monitoring and displaying real-time disk I / O and process statistics. This tool is very useful when searching for specific processes and using disk read and write processes extensively.

# iotop
Iotop command example For information on how to install and use iotop, please read: Installing Iotop under Linux.

8. Iostat-input / output statistics

Iostat is a simple tool for collecting and displaying the input and output status statistics of storage devices in the system. This tool is often used to track performance issues of storage devices, including storage devices, local disks, and remote disks such as NFS.

# iostat
Linux 2.6.18-238.9.1.el5 (tecmint.com) 09/13/2012

avg-cpu:% user% nice% system% iowait% steal% idle
           2.60 3.65 1.04 4.29 0.00 88.42

Device: tps Blk_read / s Blk_wrtn / s Blk_read Blk_wrtn
cciss / c0d0 17.79 545.80 256.52 855159769 401914750
cciss / c0d0p1 0.00 0.00 0.00 5459 3518
cciss / c0d0p2 16.45 533.97 245.18 836631746 384153384
cciss / c0d0p3 0.63 5.58 3.97 8737650 6215544
cciss / c0d0p4 0.00 0.00 0.00 8 0
cciss / c0d0p5 0.63 3.79 5.03 5936778 7882528
cciss / c0d0p6 0.08 2.46 2.34 3847771 3659776
For more information about iostat usage and examples, please visit: 6 Examples of Using iostat Commands under Linux.

9.IPTraf-Real-time LAN IP monitoring

IPTraf is an open source real-time network (LAN) monitoring application that runs on the Linux console. It collects a lot of information, such as IP traffic monitoring through the network, including TCP tags, ICMP detailed information, TCP / UDP traffic separation, TCP connection packets and bytes. It also collects common and detailed information about the status of the interface: TCP, UDP, IP, ICMP, non-IP, IP checksum error, interface activity, etc.

IP traffic monitoring

For usage of the IPTraf tool and more information, please visit: IPTraf Network Monitoring Tool.

10. psacct or acct-monitor user activity

The psacct or acct tool is used to monitor the activity of each user in the system. These two service processes run in the background, they closely monitor all activities of each user running on the system, and also monitor the resources used by these activities.

System administrators can use these two tools to track the activity of each user, such as what the user is doing, what commands they submitted, how many resources they used, how long they have been on the system, and so on.

For examples of installation and usage of these commands, see the article: Using psacct or acct to monitor user activity.

11.Monit-Linux process and service monitoring tool

Monit is a free and open source software and a web-based process monitoring tool. It can automatically monitor and manage system processes, programs, files, folders, permissions, sum verification codes and file systems.

This software can monitor services like Apache, MySQL, Mail, FTP, ProFTP, Nginx, SSH. You can check the system status through the command line or the network excuse provided by this software.

Monit Linux system monitoring

For more information, please refer to: Monitoring Linux Process with Monit

12. NetHogs- monitor the network bandwidth used by each process

NetHogs is a small open source program (similar to the top command under Linux), which closely monitors the network activity of each process on the system. It also tracks the real-time network bandwidth used by each program or application.

NetHogs: bandwidth monitoring under Linux

For more information, please refer to: Using NetHogs to monitor Linux network bandwidth usage.

13.iftop-monitor network bandwidth

iftop is another open source system monitoring application running on the console. It displays a list of network bandwidth usage (source host or destination host) of applications on the system through the network interface. This list is updated regularly. iftop is used to monitor network usage, and 'top' is used to monitor CPU usage. iftop is a member of the 'top' tool series, it is used to monitor the selected interface and display the current network bandwidth usage between the two hosts.

iftop-monitor network bandwidth

For more information, please see: iftop-monitor network bandwidth usage.

14 Monitorix-System and network monitoring

Monitorix is a free and lightweight application tool, which was originally designed to run and monitor Linux / Unix server systems and resources. It has an HTTP web server. This server regularly collects system and network information and displays it in a graphical form. It monitors the system's average load and usage, memory allocation, disk health, system services, network ports, mail statistics (Sendmail, Postfix, Dovecot, etc.), MySQL statistics, and more. It is used to monitor the overall performance of the system to help discover errors, bottlenecks and abnormal activities.

15. Arpwatch-Ethernet activity monitor

Arpwatch is designed to monitor Ethernet address resolution (changes in MAC and IP addresses) on Linux. He continued to monitor Ethernet activity for a period of time and output a log of IP and MAC address pair changes. It can also send an email notification to the administrator to warn about the addition and change of address matching. This is useful for detecting ARP attacks on the network.

For more information, please refer to: Arpwatch to Monitor Ethernet Activity

16. Suricata-network security monitoring

Suricata is an open source high-performance network security, intrusion detection and anti-monitoring tool that can run on Linux, FreeBSD and Windows. The non-profit organization OISF (Open Information Security Foundation) develops and owns the copyright.

For more information, please refer to: Suricata – A Network Intrusion Detection and Prevention System

17. VnStat PHP – network traffic monitoring

VnStat PHP is a web-based front-end rendering of the popular web tool "vnstat". VnStat PHP presents network usage in a beautiful graphical interface. He can display the upload and download traffic in hours, days and months and output a summary report.

For more information, please refer to: VnStat PHP – Monitoring Network Bandwidth

18. Nagios-network / server monitoring

Nagios is a leading and powerful open source monitoring system that allows network / system administrators to discover and resolve problems before they affect normal business. With the Nagios system, administrators can remotely detect Linux, Windows, switches, routers, and printers in a single window. It can warn you of danger and indicate whether the system / server is abnormal, which can indirectly help you take rescue measures before the problem occurs.

For more information, please refer to: Install Nagios Monitoring System to Monitor Remote Linux / Windows Hosts

We want to know: what monitoring program are you using to monitor the performance of your Linux server? If we missed the tool you think is important above, please let us know in the comments and do n’t forget to share it!


English text: 18 Command Line Tools to Monitor Linux Performance

Translation link: http://www.oschina.net/translate/command-line-tools-to-monitor-linux-performance

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.