It’s really very tough job for every System or Network administrator to monitor and debug Linux System Performance problems every day. After being a Linux Administrator for 5 years in IT industry, I came to know that how hard is to monitor and keep systems up and running. For this reason, we’ve compiled the list of Top 18 frequently used command line monitoring tools that might be useful for every Linux/Unix System Administrator. These commands are available under all flavors of Linux and can be useful to monitor and find the actual causes of performance problem. This list of commands shown here are very enough for you to pick the one that is suitable for your monitoring scenario. |
译者信息
对于系统和网络管理员来说每天监控和调试Linux系统的性能问题是一项繁重的工作。在IT领域作为一名Linux系统的管理员工作5年后,我逐渐认识到监控和保持系统启动并运行是多么的不容易。基于此原因,我们已编写了最常使用的18个命令行工具列表,这些工具将有助于每个Linux/Unix 系统管理员的工作。这些命令行工具可以在各种Linux系统下使用,可以用于监控和查找产生性能问题的原因。这个命令行工具列表提供了足够的工具,您可以挑选适用于您的监控场景的工具。 |
1. Top – Linux Process MonitoringLinux Top command is a performance monitoring program which is used frequently by many system administrators to monitor Linux performance and it is available under many Linux/Unix like operating systems. The top command used to dipslay all the running and active real-time processes in ordered list and updates it regularly. It display CPU usage, Memory usage, Swap Memory,Cache Size, Buffer Size, Process PID, User, Commands and much more. It also shows high memory and cpu utilization of a running processess. The top command is much userful for system administrator to monitor and take correct action when required. Let’s see top command in action. # top Top Command Example For more examples of Top command read : 12 TOP Command Examples in Linux |
译者信息
1.Top-Linux进程监控Linux下的Top命令是一个性能监控程序,许多系统管理员常常用它来监控Linux性能,在许多Linux或者类Unix操作系统里都有这个命令。Top命令用于按一定的顺序显示所有正在运行而且处于活动状态的实时进程,而且会定期更新显示结果。这条命令显示了CPU的使用率、内存使用率、交换内存使用大小、高速缓存使用大小、缓冲区使用大小,进程PID、所使用命令以及其他。它还可以显示正在运行进程的内存和CPU占用多的情况。对系统管理员来说,top命令式是一个非常有用的,它可用于监控系统并在需要的时候采取正确的处理动作。让我们看看实际中的top命令。 # top Top命令举例 |
2. VmStat – Virtual Memory StatisticsLinux VmStat command used to display statistics of virtual memory, kernerl threads, disks, system processes, I/O blocks, interrupts, CPU activity and much more. By default vmstat command is not available under Linux systems you need to install a package called sysstat that includes a vmstat program. The common usage of command format is. # vmstatprocs -----------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 read : 6 Vmstat Command Examples in Linux |
译者信息
2. VmStat – 虚拟内存统计Linux 的 VmStat 命令用于显示虚拟内存、内核线程、磁盘、系统进程、I/O 块、中断、CPU 活动 等的统计信息。缺省情况下, vmstat 命令在 Linux 系统下不可用,你需要安装一个包含了 vmstat 程序的 sysstat 软件包。命令格式的常见用法是: # 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
更多的 vmstat 例子,请阅读 : 6 Linux 下的 Vmstat 命令实例 |
3. Lsof – List Open FilesLsof command used in many Linux/Unix like system that is used to display list of all the open files and the processes. The open files included are disk files, network sockets, pipes, devices andprocesses. One of the main reason for using this command is when a disk cannot be unmounted and displays the error that files are being used or opened. With this commmand you can easily identify which files are in use. The most common format for this command is. # lsofCOMMAND PID USER FD TYPE DEVICE SIZE NODE NAME 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 More lsof command usage and examples : 10 lsof Command Examples in Linux |
译者信息
3.Lsof-列出打开的文件在许多Linux或者类Unix系统里都有lsof命令,它常用于以列表的形式显示所有打开的文件和进程。打开的文件包括磁盘文件、网络套接字、管道、设备和进程。使用这条命令的主要情形之一就是在无法挂载磁盘和显示正在使用或者打开某个文件的错误信息的时候。使用这条命令,你可以很容易地看到正在使用哪个文件。这条命令最常用的格式如下: # lsof COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME 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 有关lsof命令的用法和例子的更多信息,请参考: Linux下10个使用lsof命令的例子。 |
4. Tcpdump – Network Packet AnalyzerTcpdump one of the most widely used command-line network packet analyzer or packets sniffer program that is used capture or filter TCP/IP packets that received or transferred on a specific interface over a network. It also provides a option to save captured packages in a file for later analysis. tcpdump is almost available in all major Linux distributions. # 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 > 115.113.134.3.static-mumbai.vsnl.net.in.28472: P 2532133365:2532133481(116) ack 3561562349 win 9648 22:09:07.653466 IP tecmint.com.ssh > 115.113.134.3.static-mumbai.vsnl.net.in.28472: P 116:232(116) ack 1 win 9648 22:08:59.617916 IP 115.113.134.3.static-mumbai.vsnl.net.in.28472 > tecmint.com.ssh: . ack 116 win 64347 For more tcpdump usage read : 12 Tcpdump Command Examples in Linux |
译者信息
4.Tcpdump-网络包分析器Tcpdump是最广泛使用的网络包分析器或者包监控程序之一,它用于捕捉或者过滤网络上指定接口上接收或者传输的TCP/IP包。它还有一个选项用于把捕捉到的包保存到文件里,以便以后进行分析。在几乎所有主要的Linux发布里,tcpdump都可以使用。 # 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 > 115.113.134.3.static-mumbai.vsnl.net.in.28472: P 2532133365:2532133481(116) ack 3561562349 win 9648 22:09:07.653466 IP tecmint.com.ssh > 115.113.134.3.static-mumbai.vsnl.net.in.28472: P 116:232(116) ack 1 win 9648 22:08:59.617916 IP 115.113.134.3.static-mumbai.vsnl.net.in.28472 > tecmint.com.ssh: . ack 116 win 64347 要想获得更多有关tcpdump用法的信息,请参阅: Linux下12个使用Tcpdump命令的例子。 |
5. Netstat – Network StatisticsNetstat is a command line tool for monitoring incoming and outgoing network packets statistics as well as interface statistics. It is very useful tool for every system administrator to monitor network performance and troubleshoot 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 More Netstat examples : 20 Netstat Command Examples in Linux. |
译者信息
5.Netstat-网络状态统计Netstat是一个用于监控进出网络的包和网络接口统计的命令行工具。它是一个非常有用的工具,系统管理员可以用来监控网络性能,定位并解决网络相关问题。 # 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 有关Netstat更多的例子,请参阅: Linux下20个使用Netstat命令的例子。 |
6. Htop – Linux Process MonitoringHtop is a much advanced interactive and real time Linux process monitoring tool. This is much similar to Linux top command but it has some rich features like user friendly interface to manage process, shortcut keys, vertical and horizontal view of the processes and much more. Htop is a third party tool and doesn’t included in Linux systems, you need to install it using YUM package manager tool. For more information on installation read our article below. # htop Htop Command Example Screenshot For Htop installation read : Install Htop (Linux Process Monitoring) in Linux |
译者信息
6. Htop – Linux进程监控Htop 是一个非常高级的交互式的实时linux进程监控工具。 它和top命令十分相似,但是它具有更丰富的特性,例如用户可以友好地管理进程,快捷键,垂直和水平方式显示进程等等。 Htop是一个第三方工具,它不包含在linux系统中,你需要使用YUM包管理工具去安装它。 关于安装的更多信息,请阅读下文. # htop
Htop 命令示例截图 对于Htop的安装,请读 : 在Linux安装Htop(Linux进程监控) |
7. Iotop – Monitor Linux Disk I/OIotop is also much similar to top command and Htop program, but it has accounting function to monitor and display real time Disk I/O and processes. This tool is much useful for finding the exact process and high used disk read/writes of the processes. # iotop Iotop Command Example Screenshot For Ioptop installation and usage read : Install Iotop in Linux 8. Iostat – Input/Output StatisticsIoStat is simple tool that will collect and show system input and output storage device statistics. This tool is often used to trace storage device performance issues including devices, local disks,remote disks such as NFS. # iostatLinux 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 Iostat usage and examples visit : 6 Iostat Command Examples in Linux |
译者信息
7.Iotop-监控Linux磁盘I/OIotop命令同样也非常类似于top命令和Htop程序,不过它具有监控并显示实时磁盘I/O和进程的统计功能。在查找具体进程和大量使用磁盘读写进程的时候,这个工具就非常有用。 # iotop Iotop命令举例的截图 8.Iostat-输入/输出统计Iostat是一个用于收集显示系统存储设备输入和输出状态统计的简单工具。这个工具常常用来追踪存储设备的性能问题,其中存储设备包括设备、本地磁盘,以及诸如使用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 有关iostat用法和举例的更多信息,请访问: Linux下6个使用iostat命令的例子。 |
9. IPTraf – Real Time IP LAN MonitoringIPTraf is an open source console-based real time network (IP LAN) monitoring utility for Linux. It collects a variety of information such as IP traffic monitor that passes over the network, including TCP flag information, ICMP details, TCP/UDP traffic breakdowns, TCP connection packet and byne counts. It also gathers information of general and detaled interface statistics of TCP, UDP, IP, ICMP, non-IP, IP checksum errors, interface activity etc. IP Traffic Monitor For more information and usage of IPTraf tool, please visit : IPTraf Network Monitoring Tool |
译者信息
9.IPTraf-实时局域网IP监控IPTraf是一个在Linux控制台运行的、开放源代码的实时网络(局域网)监控应用。它采集了大量信息,比如通过网络的IP流量监控,包括TCP标记、ICMP详细信息、TCP/UDP流量分离、TCP连接包和字节数。同时还采集有关接口状态的常见信息和详细信息:TCP、UDP、IP、ICMP、非IP,IP校验和错误,接口活动等。 IP流量监控 |
10. Psacct or Acct – Monitor User Activitypsacct or acct tools are very useful for monitoring each users activity on the system. Both daemons runs in the background and keeps a close watch on the overall activity of each user on the system and also what resources are being consumed by them. These tools are very useful for system administrators to track each users activity like what they are doing, what commands they issued, how much resources are used by them, how long they are active on the system etc. For installation and example usage of commands read the article on Monitor User Activity with psacct or acct |
译者信息
10. psacct 或者 acct - 监视用户活动psacct或者acct工具用于监视系统里每个用户的活动状况。这两个服务进程运行在后台,它们对系统上运行的每个用户的所有活动进行近距离监视,同时还监视这些活动所使用的资源情况。 系统管理员可以使用这两个工具跟踪每个用户的活动,比如用户正在做什么,他们提交了那些命令,他们使用了多少资源,他们在系统上持续了多长时间等等。 有关这些命令的安装和用法举例信息,请参阅文章:使用psacct或者acct监视用户活动。 |
11. Monit – Linux Process and Services MonitoringMonit is a free open source and web based process supervision utility that automatically monitors and managers system processes, programs, files, directories, permissions, checksums and filesystems. It monitors services like Apache, MySQL, Mail, FTP, ProFTP, Nginx, SSH and so on. The system status can be viewed from the command line or using it own web interface. Monit Linux Process Monitoring Read More : Linux Process Monitoring with Monit |
译者信息
11.Monit - Linux进程和服务监控工具Monit是一个免费的开源软件,也是一个基于网络的进程监控工具。它能自动监控和管理系统进程,程序,文件,文件夹,权限,总和验证码和文件系统。 这个软件能监控像Apache, MySQL, Mail, FTP, ProFTP, Nginx, SSH这样的服务。你可以通过命令行或者这个软件提供的网络借口来查看系统状态。 Monit Linux系统监控 更多内容请参阅:用Monit监控Linux进程 |
12. NetHogs – Monitor Per Process Network BandwidthNetHogs is an open source nice small program (similar to Linux top command) that keeps a tab on each process network activity on your system. It also keeps a track of real time network traffic bandwidth used by each program or application. NetHogs Linux Bandwidth Monitoring Read More : Monitor Linux Network Bandwidth Using NetHogs |
译者信息
12.NetHogs-监视每个进程使用的网络带宽NetHogs是一个开放源源代码的很小程序(与Linux下的top命令很相似),它密切监视着系统上每个进程的网络活动。同时还追踪着每个程序或者应用所使用的实时网络带宽。 NetHogs:Linux下的带宽监视 |
13. iftop – Network Bandwidth Monitoringiftop is another terminal-based free open source system monitoring utility that displays a frequently updated list of network bandwidth utilization (source and destination hosts) that passing through the network interface on your system. iftop is considered for network usage, what ‘top‘ does for CPU usage. iftop is a ‘top‘ family tool that monitor a selected interface and displays a current bandwidth usage between two hosts. iftop – Network Bandwidth Monitoring Read More : iftop – Monitor Network Bandwidth Utilization |
译者信息
13.iftop-监视网络带宽iftop是另一个在控制台运行的开放源代码系统监控应用,它显示了系统上通过网络接口的应用网络带宽使用(源主机或者目的主机)的列表,这个列表定期更新。iftop用于监视网络的使用情况,而‘top‘用于监视CPU的使用情况。iftop是‘top‘工具系列中的一员,它用于监视所选接口,并显示两个主机间当前网络带宽的使用情况。 iftop-监视网络带宽。 更多信息请参阅:iftop-监视网络带宽的使用情况。 |
14. Monitorix – System and Network MonitoringMonitorix is a free lightweight utility that is designed to run and monitor system and network resources as many as possible in Linux/Unix servers. It has a built in HTTP web server that regularly collects system and network information and display them in graphs. It Monitors system load average and usage, memory allocation, disk driver health, system services, network ports, mail statistics (Sendmail, Postfix, Dovecot, etc), MySQL statistics and many more. It designed to monitor overall system performance and helps in detecting failures, bottlenecks, abnormal activities etc. Monitorix Monitoring Read More : Monitorix a System and Network Monitoring Tool for Linux |
译者信息
14 Monitorix-系统和网络监控 Monitorix 是一个免费的轻量级应用工具,它的设计初衷是运行和监控Linux/Unix服务器系统和资源等。它有一个HTTP 网络服务器,这个服务器有规律的收集系统和网络的信息并以图形化的形式展示出来。它监控系统的平均负载和使用,内存分配、磁盘健康状况、系统服务、网络端口、邮件统计(Sendmail,Postfix,Dovecot等),MySQL统计,等等。它就是用来监控系统的总体性能,帮助发现失误、瓶颈和异常活动的。 |
15. Arpwatch – Ethernet Activity MonitorArpwatch is a kind of program that is designed to monitor Address Resolution (MAC and IP address changes) of Ethernet network traffic on a Linux network. It continuously keeps watch on Ethernet traffic and produces a log of IP and MAC address pair changes along with a timestamps on a network. It also has a feature to send an email alerts to administrator, when a pairing added or changes. It is very useful in detecting ARP spoofing on a network. Read More : Arpwatch to Monitor Ethernet Activity 16. Suricata – Network Security MonitoringSuricata is an high performance open source Network Security and Intrusion Detection and Prevention Monitoring System for Linux, FreeBSD and Windows.It was designed and owned by a non-profit foundation OISF (Open Information Security Foundation). Read More : Suricata – A Network Intrusion Detection and Prevention System |
译者信息
15. Arpwatch – 以太网活动监视器Arpwatch被设计用来监控Linux上的以太网地址解析 (MAC和IP地址的变化)。他在一段时间内持续监控以太网活动并输出IP和MAC地址配对变动的日志。它还可以向管理员发送邮件通知,对地址配对的增改发出警告。这对于检测网络上的ARP攻击很有用。 更多信息请参阅 : Arpwatch to Monitor Ethernet Activity 16. Suricata – 网络安全监控Suricata 是一个开源的高性能网络安全、入侵检测和反监测工具,可以运行Linux、FreeBSD和Windows上。非营利组织OISF (Open Information Security Foundation)开发并拥有其版权。 更多信息请参阅 : Suricata – A Network Intrusion Detection and Prevention System |
17. VnStat PHP – Monitoring Network BandwidthVnStat PHP a web based frontend application for most popular networking tool called “vnstat“. VnStat PHP monitors a network traffic usage in nicely graphical mode. It displays a total IN andOUT network traffic usage in hourly, daily, monthly and full summary report. Read More : VnStat PHP – Monitoring Network Bandwidth 18. Nagios – Network/Server MonitoringNagios is an leading open source powerful monitoring system that enables network/system administrators to identify and resolve server related problems before they affect major business processes. With the Nagios system, administrators can able to monitor remote Linux, Windows, Switches, Routers and Printers on a single window. It shows critical warnings and indicates if something went wrong in your network/server which indirectly helps you to begin remediation processes before they occur. Read More : Install Nagios Monitoring System to Monitor Remote Linux/Windows Hosts We would like to know what kind of monitoring programs you use to monitor performance of your Linux servers? If we’ve missed any important tool that you would like us to include in this list, please inform us via comments and please don’t forget to share it. |
译者信息
17. VnStat PHP – 网络流量监控VnStat PHP 是流行网络工具"vnstat"的基于web的前端呈现。VnStat PHP 将网络使用情况呈现在漂亮的图形界面中。他可以显示以小时、日、月计的上传和下载流量并输出总结报告。 更多信息请参阅 : VnStat PHP – Monitoring Network Bandwidth 18. Nagios – 网络/服务器监控Nagios是领先而强大的开源监控系统,他可以让网络/系统管理员在问题影响到正常的业务之前发现并解决它们。有了Nagios系统,管理员可以在单个窗口内远程检测Linux、Windows、开关、路由器和打印机。它可以危险警告并指出系统/服务器是否有异常,这可以间接帮助你在问题发生之前采取抢救措施。 更多信息请参阅 : Install Nagios Monitoring System to Monitor Remote Linux/Windows Hosts 我们想知道:你在用什么监控程序来监控Linux服务器的性能呢?如果我们在上面错过了你认为重要的工具,请在评论中告诉我们,不要忘了分享它! |