18 Command Line Tools to Monitor Linux Performance(转)

标签: command line tools | 发表时间:2014-02-09 18:51 | 作者:lnnujxxy
出处:http://www.iteye.com

18 Command Line Tools to Monitor Linux Performance

By  Ravi Saive Under:  Linux CommandsMonitoring Tools On: December 26, 2013

 
 

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 yearsin  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 Command Line Monitoring

 

Linux Command Line Monitoring

 

1. Top – Linux Process Monitoring

Linux  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 usageSwap MemoryCache SizeBuffer SizeProcess PIDUserCommands 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

 

Top Command Example

For more examples of Top command read :  12 TOP Command Examples in Linux

2. VmStat – Virtual Memory Statistics

Linux  VmStat command used to display statistics of  virtual memorykernerl threadsdisks, system processesI/O blocksinterruptsCPU activity and much more. By default vmstat command is not available under Linux systems you need to install a package called  sysstatthat includes a vmstat program. The common usage of 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 read :  6 Vmstat Command Examples in Linux

3. Lsof – List Open Files

Lsof 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 filesnetwork socketspipesdevicesand  processes. 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.

    # 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

More lsof command usage and examples :  10 lsof Command Examples in Linux

4. Tcpdump – Network Packet Analyzer

Tcpdump 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 eth0

tcpdump: 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

5. Netstat – Network Statistics

Netstat 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 | more

Active 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.

6. Htop – Linux Process Monitoring

Htop 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 processshortcut keysvertical 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

Htop Command Example Screenshot

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

7. Iotop – Monitor Linux Disk I/O

Iotop 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

Iotop Command Example Screenshot

For Ioptop installation and usage read :  Install Iotop in Linux

8. Iostat – Input/Output Statistics

IoStat 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 disksremote 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 Iostat usage and examples visit :  6 Iostat Command Examples in Linux

9. IPTraf – Real Time IP LAN Monitoring

IPTraf 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

 

IP Traffic Monitor

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

10. Psacct or Acct – Monitor User Activity

psacct 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

11. Monit – Linux Process and Services Monitoring

Monit 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

 

Monit Linux Process Monitoring

Read More :  Linux Process Monitoring with Monit

12. NetHogs – Monitor Per Process Network Bandwidth

NetHogs 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

 

NetHogs Linux Bandwidth Monitoring

Read More :  Monitor Linux Network Bandwidth Using NetHogs

13. iftop – Network Bandwidth Monitoring

iftop 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

 

iftop – Network Bandwidth Monitoring

Read More :  iftop – Monitor Network Bandwidth Utilization

14. Monitorix – System and Network Monitoring

Monitorix 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 usagememory allocationdisk driver healthsystem services, network portsmail statistics ( SendmailPostfixDovecot, etc),  MySQL statistics and many more. It designed to monitor overall system performance and helps in detecting failures, bottlenecks, abnormal activities etc.

Monitorix Monitoring

 

Monitorix Monitoring

Read More :  Monitorix a System and Network Monitoring Tool for Linux

15. Arpwatch – Ethernet Activity Monitor

Arpwatch is a kind of program that is designed to monitor Address Resolution ( MAC and  IPaddress 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 Monitoring

Suricata is an high performance open source  Network Security and  Intrusion Detection and Prevention Monitoring System for  LinuxFreeBSD 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

17. VnStat PHP – Monitoring Network Bandwidth

VnStat 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 and OUT network traffic usage in  hourlydailymonthly and  full summary report.

Read More :  VnStat PHP – Monitoring Network Bandwidth

18. Nagios – Network/Server Monitoring

Nagios 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.

Ravi Saive

Owner at  TecMint.com
Simple Word a Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on


已有 0 人发表留言,猛击->> 这里<<-参与讨论


ITeye推荐



相关 [command line tools] 推荐:

18 Command Line Tools to Monitor Linux Performance(转)

- - Linux - 操作系统 - ITeye博客
This list of commands shown here are very enough for you to pick the one that is suitable for your monitoring scenario.. 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.

Let's make a SOAP request from command line(curl)?

- -
There could be a chance where you need to make a request from your command line rather than installing a tool such.

Debugging .NET Core app from a command line on Linux - Dots and Brackets: Code Blog

- -
Million years ago, way before the ice age, I was preparing small C++ project for “Unix Programming” university course and at some point had to debug it via command line.

Google 发布 Command Line Tool,通过命令行操作 Google 各种服务

- xiao - UED TEAM,用户体验设计,web前端开发
命令行控们总是希望用键盘搞定一切,于是Google发布了GoogleCL(Google Command Line Tool),通过命令行即可操作Google各种服务. 比如你想批量将硬盘里某个文件夹里的所有图片创建一个 Picasa相册. 再比如你想将硬盘里的某个网页发布为一篇Blogger博文、增加一个Google Calendar的日程、编辑一篇Google Docs文档:.

Cookiel劫持测试工具 – Cookie Injecting Tools

- - FreeBuf.COM
‍‍Cookie Injecting Tools 是一款简单的开源cookie利用工具,是Chrome浏览器上开发的一个扩展插件,能够灵活地进行SQL注入测试,编辑以及添加删除COOKIE,界面简洁,易于使用‍‍. 可以直接下载打包好的CRX文件,源码就包含其中,当然也可以直接下载源码运行‍‍. ‍‍‍‍ 有两种方式‍‍.

the-book-of-secret-knowledge: A collection of inspiring lists, manuals, cheatsheets, blogs, hacks, one-liners, cli/web tools and more.

- -
If you find something which doesn't make sense, or something doesn't seem right, please make a pull request and please add valid and well-reasoned explanations about your changes or comments..

【茶包射手日記】使用IE Dev Tools追查Javascript效能問題

- - 黑暗執行緒
同事回報某個網頁出現"在IE8下,使用jquery.blockUI遮蔽某個div後,輸入時,每打一個字都要等1-2秒字元才會顯示"的問題. 開啟VM使用IE8可重現問題;而同樣網頁在IE9下則運作正常. 針對此一IE下的JavaScript茶包,決定交由 JavaScript效能茶包一哥--IE Dev Tools Profiler工具進行獵殺!.

The Smurfs 2011 R5 LiNE XviD-ViSUALiSE 蓝精灵/蓝色小精灵(台)

- biAji - 沒有水的魚 - 115网盘 国外网盘下载
◎译  名 蓝精灵/蓝色小精灵(台). ◎类  别 动画/家庭/奇幻/喜剧. ◎IMDB评分 4.2/10(1,032 votes). ◎IMDB链接 http://www.imdb.com/title/tt0472181. ◎文件格式 XviD + MP3. ◎视频尺寸 720 x 400. ◎文件大小 1CD 1.37GB.

丟掉 Viber、Whatsapp,換上免費又可愛的 Line app 吧!

- 同道|贾怀军 - T客邦
iPhone 和 Android 上最有名的通訊軟體就是 Viber 和 Whatsapp,不過現在又推出了一個殺手級的可愛通訊軟體. 名為 Line 的通訊軟體一開放就同時支援 iPhone 和 Android,而且能傳訊息還能打語音電話,更重要的是這個程式是免費下載. 你還不丟掉 Viber 和 Whatsapp 嗎.

台灣手機使用者愛用 LINE 勝過 Facebook

- - Inside全文
照片來源:〈 【東京直擊. 創市際 ARO 公佈台灣首份智慧型手機使用行為測量報告 〉 刊載於 創市際®市場研究顧問公司網站. 台北,2013年3月23日-創市際ARO公佈台灣首份智慧型手機使用行為測量報告. 創市際為瞭解消費者使用智慧型手機的狀況,在2012年11月到2013年1月,與美國行動流量監控先驅Arbitron公司合作,經過台灣超過500位智慧型手機用戶的同意,在其智慧型手機中安裝應用程式,藉以偵測使用行為,取得包含使用時間、內容、方式、應用程式、網路瀏覽、手機作業系統、通信業者分佈等資訊.