18 command-line tools to monitor Linux performance

Source: Internet
Author: User

Transferred from: http://www.kuqin.com/shuoit/20140219/338066.html

For system and network administrators, it is a heavy task to monitor and debug the performance of Linux systems on a daily basis. After 5 years working as an administrator in the IT field as a Linux system, I gradually realized how difficult it was 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 that will help each Linux/unix system administrator work. These command-line tools can be used under a variety of Linux systems and can be used to monitor and find the cause of performance problems. This list of command-line tools provides enough tools to pick and choose the tools for your monitoring scenario.

1.top-linux Process Monitoring

The top command under Linux is a performance Monitor that many system administrators often use to monitor Linux performance, and this command is available in many Linux or Unix-like operating systems. The top command is used to display all live processes that are running and active in a certain order, and the display results are updated periodically. This command shows CPU usage, memory usage, swap memory usage size, cache usage size, buffer usage size, process PID, commands used, and more. It can also show the memory and CPU usage of the running process. For system administrators, the top command is a very useful one that can be used to monitor the system and take the correct processing action when needed. Let's take a look at the top command in action.

#top

2. vmstat– Virtual Memory Statistics

The Linux vmstat command is used to display statistics for virtual memory, kernel threads, disks, system processes, I/O blocks, interrupts, CPU activity, and so on. By default, the Vmstat command is not available under the Linux system, and you need to install a Sysstat package that contains the Vmstat program. Common uses of the command format are:

#vmstatprocs-----------Memory-------------swap-------IO------system-------CPU-----Rbswpdfreeinactactivesisobiboincsussyid wast10081042097380706280011548979169030
3.lsof-to list open files

In many Linux or Unix-like systems, there are lsof commands, which are often used to display all open files and processes in the form of a list. Open files include disk files, network sockets, pipelines, devices, and processes. One of the main scenarios for using this command is when you cannot mount a disk and display an error message that you are using or opening a file. With this command, you can easily see which file is in use. The most common format for this command is as follows:

#lsofCOMMANDPIDUSERFDTYPEDEVICESIZENODENAMEinit1rootcwdDIR104, 240962/init1rootrtddir104,240962/ init1roottxtreg104,23865217710339/sbin/initinit1rootmemreg104,2129900196453/lib/ld-2.5.soinit1rootmemreg104, 21693812196454/lib/libc-2.5.soinit1rootmemreg104,220668196479/lib/libdl-2.5.soinit1rootmemreg104,2245376196419 /lib/libsepol.so.1init1rootmemreg104,293508196431/lib/libselinux.so.1init1root10ufifo0,17953/dev/initctl

4.tcpdump-Network Packet Analyzer

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

#tcpdump-IETH0TCPDUMP:VERBOSEOUTPUTSUPPRESSED,USE-VOR-VVFORFULLPROTOCOLDECODELISTENINGONETH0,LINK-TYPEEN10MB ( Ethernet), capturesize96bytes22:08:59.617628iptecmint.com.ssh>115.113.134.3.static-mumbai.vsnl.net.in.28472: p2532133365:2532133481 (ack3561562349win964822:09:07.653466iptecmint.com.ssh>115.113.134.3). static-mumbai.vsnl.net.in.28472:p116:232 (ack1win964822:0) 8:59.617916ip115.113.134.3.static-mumbai.vsnl.net.in.28472>tecmint.com.ssh:.ack116win64347

5.netstat-Network Status statistics

Netstat is a command-line tool for monitoring packet and network interface statistics for incoming and outgoing networks. It is a very useful tool that system administrators can use to monitor network performance, locate and troubleshoot network-related issues.

#netstat-a|moreactiveinternetconnections (serversandestablished) protorecv-qsend-qlocaladdressforeignaddressstatetcp00*:mysql*:* listentcp00*:sunrpc*:* LISTENtcp00*:realm-rusd*: *listentcp00*:ftp*:* listentcp00localhost.localdomain:ipp*:* listentcp00localhost.localdomain:smtp*:* Listentcp00localhost.localdomain:smtplocalhost.localdomain:42709time_waittcp00localhost.localdomain: smtplocalhost.localdomain:42710time_waittcp00*:http*:* listentcp00*:ssh*:* listentcp00*:https*:* LISTEN

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 user-friendly management of processes, shortcut keys, vertical and horizontal display of processes, and so on. Htop is a third-party tool that is not included in a Linux system and you need to use the Yum Package management tool to install it. For more information on installation, please read below.

#htop

7.iotop-Monitoring Linux disk I/O

The Iotop command is also very similar to the top command and the Htop program, but it has the ability to monitor and display real-time disk I/O and process statistics. This tool is useful when you are looking for specific processes and lots of disk read and write processes.

#iotop

8.iostat-Input/Output statistics

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

#iostatLinux2.6.18-238.9.1.el5 (tecmint.com) 09/13/2012avg-cpu:%user%nice%system%iowait%steal% idle2.603.651.044.290.0088.42device:tpsblk_read/sblk_wrtn/sblk_readblk_wrtncciss/ c0d017.79545.80256.52855159769401914750cciss/c0d0p10.000.000.0054593518cciss/ C0d0p216.45533.97245.18836631746384153384cciss/c0d0p30.635.583.9787376506215544cciss/c0d0p40.000.000.0080cciss /c0d0p50.633.795.0359367787882528cciss/c0d0p60.082.462.3438477713659776

9.iptraf-real-time LAN IP monitoring

Iptraf is an open source real-time network (LAN) monitoring application running on the Linux console. It collects a lot of information, such as IP traffic monitoring over the network, including TCP tokens, ICMP details, TCP/UDP traffic separation, TCP connection packets, and bytes. It also collects common information and details about the state of the interface: TCP, UDP, IP, ICMP, non-IP,IP checksum error, interface activity, and so on.

Psacct or acct– monitoring user activity

PSACCT or Acct tools are used to monitor the activity status of each user in the system. These two service processes run in the background, and they are closely monitored for all activities of each user running on the system, while also monitoring the resources used by these activities.

The system administrator can use these two tools to track each user's activity, such as what the user is doing, how many resources they are using, how much time they have spent on the system, and so on.

11.monit–linux process and service monitoring tools

Monit is a free 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, and so on. You can use the command line or the network excuse provided by this software to view the status of the system.

12.nethogs-monitoring the network bandwidth used by each process

Nethogs is a very small program of Open source code (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.

13.iftop-Monitoring network bandwidth

Iftop is another open source system monitoring application running in the console that shows a list of application network bandwidth usage (source host or destination host) on the system over the network interface, which is updated periodically. Iftop is used to monitor network usage, while ' top ' is used to monitor CPU usage. Iftop is a member of the ' top ' tool family that monitors the selected interface and displays the current network bandwidth usage among the two hosts.

monitorix-System and Network monitoring

Monitorix is a free lightweight application tool designed to run and monitor Linux/unix server systems and resources. It has an HTTP Web server that has a regular collection of information about the system and the network and displays it graphically. It monitors the average load and usage of the system, memory allocations, disk health, system services, network ports, message statistics (SENDMAIL,POSTFIX,DOVECOT, etc.), MySQL statistics, and so on. It is used to monitor the overall performance of the system to help detect errors, bottlenecks, and abnormal activity.

arpwatch– Ethernet Activity Monitor

The Arpwatch is designed to monitor Ethernet address resolution (changes in Mac and IP addresses) on Linux. He continuously monitors Ethernet activity for a period of time and outputs a log of changes in IP and MAC address pairs. It can also send an email notification to an administrator, alerting you to an increase in address pairing. This is useful for detecting ARP attacks on a network.

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. Nonprofit organization OISF (Open Information Security Foundation) develops and owns its copyrights.

Vnstat php– Network traffic monitoring

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

nagios– Network/server monitoring

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

18 command-line tools for monitoring 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.