`
844604778
  • 浏览: 548813 次
文章分类
社区版块
存档分类
最新评论

17 Command Line Tools to Monitor Linux Performance

 
阅读更多

It’s really very tough job for everySystemorNetworkadministrator to monitor and debugLinux System Performanceproblems every day. After being aLinux Administratorfor5 yearsinIT 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 ofTop 17frequently used command line monitoring tools that might be useful for everyLinux/Unix System Administrator. These commands are available under all flavors ofLinuxand 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.

1. Top – Linux Process Monitoring

LinuxTopcommand is a performance monitoring program which is used frequently by many system administrators to monitor Linux performance and it is available under manyLinux/Unixlike operating systems. The top command used to dipslay all the running and active real-time processes in ordered list and updates it regularly. It displayCPU usage,Memory usage,Swap Memory,Cache Size,Buffer Size,Process PID,User,Commands and much more. It also shows highmemoryandcpuutilization 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

LinuxVmStatcommand used to display statistics ofvirtual memory,kernerl threads,disks,system processes,I/O blocks,interrupts,CPU activityand much more. By default vmstat command is not available under Linux systems you need to install a package calledsysstatthat 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

Lsofcommand used in manyLinux/Unixlike system that is used to display list of all the open files and the processes. The open files included aredisk files,network sockets,pipes,devicesandprocesses. 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

Tcpdumpone of the most widely used command-linenetwork packet analyzerorpackets snifferprogram that is used capture or filterTCP/IPpackets 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

Netstatis a command line tool for monitoringincomingandoutgoing networkpackets 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

Htopis a much advanced interactive and real time Linux process monitoring tool. This is much similar to Linuxtop commandbut it has some rich features likeuser friendly interface to manage process,shortcut keys,vertical and horizontal view of the processesand much more. Htop is a third party tool and doesn’t included in Linux systems, you need to install it usingYUMpackage 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

Iotopis also much similar totop commandandHtop program, but it has accounting function to monitor and display real timeDisk I/Oandprocesses. 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

IoStatis simple tool that will collect and show systeminputandoutputstorage device statistics. This tool is often used to trace storage device performance issues includingdevices,local disks,remote diskssuch asNFS.

# 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

IPTrafis an open source console-based real time network (IP LAN) monitoring utility forLinux. 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 onMonitor User Activity with psacct or acct

11. Monit – Linux Process and Services Monitoring

Monitis 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

NetHogsis an open source nice small program (similar to Linuxtop 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

iftopis 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

Monitorixis a free lightweight utility that is designed to run and monitor system and network resources as many as possible inLinux/Unixservers. It has a built inHTTPweb server that regularly collects system and network information and display them in graphs. It Monitorssystem load average and usage,memory allocation,disk driver health,system services,network ports,mail statistics(Sendmail,Postfix,Dovecot, etc),MySQL statisticsand 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

Arpwatchis a kind of program that is designed to monitor Address Resolution (MACandIPaddress changes) ofEthernetnetwork traffic on a Linux network. It continuously keeps watch on Ethernet traffic and produces a log ofIPandMACaddress 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 detectingARPspoofing on a network.

Read More:Arpwatch to Monitor Ethernet Activity

16. Suricata – Network Security Monitoring

Suricatais an high performance open sourceNetwork SecurityandIntrusion DetectionandPrevention Monitoring SystemforLinux,FreeBSDandWindows.It was designed and owned by a non-profit foundationOISF(Open Information Security Foundation).

Read More:Suricata – A Network Intrusion Detection and Prevention System

17. VnStat PHP – Monitoring Network Bandwidth

VnStat PHPa web based frontend application for most popular networking tool called “vnstat“.VnStat PHPmonitors a network traffic usage in nicely graphical mode. It displays a totalINandOUTnetwork traffic usage inhourly,daily,monthlyandfull summaryreport.

Read More:VnStat PHP – Monitoring Network Bandwidth

We would like to know what kind ofmonitoring programsyou use tomonitor 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.

分享到:
评论

相关推荐

    Apache Accumulo for Developers

    You will also learn how to monitor the cluster (single-node or multi-node) to find any performance bottlenecks, and then integrate to Amazon EC2, Google Cloud Platform, Rackspace, and Windows Azure....

    8-07-14_MegaCLI for linux_windows

    LSIP200232954 (DFCT) Need to Support all the MFC default values in the command AdpSettings. LSIP200245968 (DFCT) In EFICLI not able to flash latest firmware to controller without using -nosigchk -...

    Windows Server 2003 Resource Kit Tools

    Csccmd.exe: Client-Side Caching Command-Line Options Custreasonedit.exe: Custom Reason Editor (documented in Readme.htm) Delprof.exe: User Profile Deletion Utility,用户配置删除 Dh.exe: Display ...

    CCNA五天培训教程精选(下)

    3.Use the command-line interface to accurately determine network device operational status and network performance 通过功能线去确定网络设备的运行状态和网络性能 4.Manage operating system image files ...

    CCNA五天培训教程精选(上)

    3.Use the command-line interface to accurately determine network device operational status and network performance 通过功能线去确定网络设备的运行状态和网络性能 4.Manage operating system image files ...

    UE(官方下载)

    We are often asked if it is possible to run an UltraEdit macro or script on a file from the command line. The answer is yes - and it's not only possible, it's extremely simple! Using find/replace ...

    微软内部资料-SQL性能优化2

     For each hypothesis generated, identify at least two other non-System Monitor pieces of information that would help to confirm or reject your hypothesis.  Identify at least five counters for each...

    Microsoft Windows 7 In Depth.pdf

    Scripting, Automation, and Command Line Tools, which is due to be published in the fall of 2009. From the Library of Lee Bogdanoff Introduction Even when you’ve become a Windows 7 pro, we think you’...

    微软内部资料-SQL性能优化3

    Intent locks improve performance because SQL Server examines intent locks only at the table level to determine whether a transaction can safely acquire a lock on that table. This removes the ...

    EurekaLog_7.5.0.0_Enterprise

    4)....Added "--el_injectjcl", "--el_createjcl", and "--el_createdbg" command-line options for ecc32/emake to inject JEDI/JCL debug info, create .jdbg file, and create .dbg file (Microsoft debug format...

    微软内部资料-SQL性能优化5

     Describe the different types of indexes and how indexes can be used to improve performance.  Describe what statistics are used for and how they can help in optimizing query performance.  ...

    pro_apache_third_edition..pdf

    Networking Tools...............................................................................................26 Server Hardware..........................................................................

Global site tag (gtag.js) - Google Analytics