Linux Performance monitoring Tools

Source: Internet
Author: User
Tags system log cpu usage disk usage dmesg

When there is a problem with the Linux system, we not only need to look at the system log information, but also use a lot of performance monitoring tools to determine what part (memory, CPU, hard disk ...). ) out of the question. In the Linux system, all the operating parameters are saved in the virtual directory/proc, in other words, we use the Performance monitoring tool to get the data value is actually derived from this directory, when it comes to the system is overrated, we can modify the/proc directory of the relevant parameters, of course, some can not be changed. Let's look at these common performance monitoring tools below.




Tools




Function description




Uptime----System average load rate DMESG----hardware/System Information top-----process Status

Iostat--------CPU and disk average usage Vmstat---------system operating State SAR---------Real-time collection system use status KDE system Guard---Graphical monitoring tool free------------ ---memory utilization

Traffic-vis------------Network Monitoring (only SuSE has) pmap-------------process memory usage strace---------Tracker run status Ulimit---------system resource Usage limits Mpstat-------------Multi-processor utilization




1, uptime




The uptime command is used to see how long the server has been running and how many users are logged in to quickly learn about the load on the server.




The output of the uptime contains a load of average, which shows the last 1, 5, and 15-minute loads. Its value represents the number of processes waiting to be processed by the CPU, and if the CPU does not have time to process these processes, the load average value will rise; The best value for load average is 1, which means that each process can be processed immediately and no CPU cycles is lost. For a single-CPU machine, 1 or 2 is an acceptable value, and for a multi-CPU machine, the load average value can be between 8 and 10.




You can also use the Uptime command to determine network performance. For example, a network application performance is very low, by running uptime to see if the server load is very high, if not, then the problem should be caused by the network. The following is a running instance of uptime:




9:24am up 19:06, 1 user, Load average:0.00, 0.00, 0.00




You can also view the/proc/loadavg and/proc/uptime two files, note that you cannot edit the files in/proc, and you want to view them with commands such as cat, such as:




liyawei:~ # CAT/PROC/LOADAVG 0.00 0.00 0.00 1/55 5505




  2, DMESG




The DMESG command is primarily used to display kernel information. The use of DMESG can effectively diagnose machine hardware failures or add hardware problems.




Also, use DMESG to determine which hardware your server has installed. Every time the system restarts, the system checks all the hardware and logs the information. You can view the record by executing the/BIN/DMESG command. DMESG Input instance:




ReiserFS:hda6:checking transaction log (HDA6) ReiserFS:hda6:Using R5 hash to sort names

Adding 1044184k swap On/dev/hda5. Priority:-1 extents:1 across:1044184k Parport_pc:via 686a/8231 detected

Parport_pc:probing Current configuration parport_pc:current parallel port base:0x378

Parport0:pc-style at 0x378 (0x778), IRQ 7, using FIFO [PCSPP,TRISTATE,COMPAT,ECP] Parport_pc:via parallel port:io=0x378 , irq=7 lp0:using parport0 (Interrupt-driven).

E100:intel (R) pro/100 Network Driver, 3.5.10-k2-napi e100:copyright (c) 1999-2005 Intel Corporation

Acpi:pci Interrupt 0000:00:0d.0[a], GSI (level, low), IRQ 169

E100:eth0:e100_probe:addr 0xd8042000, IRQ 169, MAC addr 00:02:55:1e:35:91 usbcore:registered new driver Usbfs Usbcore: Registered New Driver Hub

HDC:ATAPI 48X CD-ROM drive, 128kB Cache, UDMA (Uniform) CD-ROM driver revision:3.20

USB Universal Host Controller Interface driver v2.3 3, top


The top command displays the activity status of the processor. By default, the most CPU-intensive tasks are displayed, and a refresh occurs every 5 seconds.




The value of the process priority determines the order of the CPU processing process. The Liunx kernel adjusts the size of the value as needed. Nice value is limited to priority. The value of priority cannot be less than nice value (the lower the Nice value value, the higher the precedence). You can not directly modify the value of the process priority, but you can change the process priority value indirectly by adjusting the nice level value, however this method is not available at all times. If a process is running abnormally slow, you can allocate more CPUs to the process by lowering the nice level.




The nice levels supported by Linux is from 19 (priority low) to 20 (high priority) and the default value is 0. Execute the/bin/ps command to see what is happening to the current process.



4, Iostat


Iostat is released by Red Hat Enterprise Linux as. At the same time Iostat is also part of Sysstat, can be downloaded to, the URL is http://perso.wanadoo.fr/sebastien.godard/




The average CPU time that the Execute Iostat command can be from the system boot, similar to uptime. In addition, Iostat also reports on the activity of creating a server disk subsystem. The report consists of two parts: CPU usage and disk usage.




Iostat Display instance:




AVG-CPU:%user%nice%system%iowait%steal%idle 0.16 0.01 0.03 0.10 0.00 99.71

Device:tps blk_read/s blk_wrtn/s blk_read blk_wrtn hda 0.31 4.65 4.12 327796 290832 avg-cpu:%user%nice%system%iowait %steal%idle 1.00 0.00 0.00 0.00 0.00 100.00

Device:tps blk_read/s blk_wrtn/s blk_read blk_wrtn hda 0.00 0.00 0.00 0 0 Avg-cpu:%user%nice%system%iowait%steal%id Le 0.00 0.00 0.00 0.00 0.00 99.01

Device:tps blk_read/s blk_wrtn/s blk_read blk_wrtn hda 0.00 0.00 0.00 0 0



CPU usage includes four pieces of content


%user: CPU Usage when User level (applications) is displayed. %nice: Displays the CPU occupancy of the user level at Nice. %sys: The CPU usage when displaying the system level (kernel). %idle: Shows the percentage of CPU idle time. The disk usage report is divided into the following sections: device: The name of the block device




TPS: The number of I/O transmissions that the device has per second. Multiple I/O requests can be combined into one, and each I/O request transmits a different number of bytes, so multiple I/O requests can be combined into one. BLK_READ/S, BLK_WRTN/S: Represents the number of data blocks read and written from the device per second. The size of the block can vary, such as 1024, 2048, or 4048 bytes, depending on the size of the partition.




For example, execute the following command to get the data block size of the device/dev/sda1: Dumpe2fs-h/dev/sda1 |grep-f "block size" output is as follows:




DUMPE2FS 1.34 (25-jul-2003) Block size:1024


Blk_read, Blk_wrtn: Indicates the total number of data block reads/writes since the system started.


You can also view the contents of these files/proc/stat,/proc/partitions,/proc/diskstats.




 5, Vmstat


Vmstat provides processes, memory, paging, block I/O, traps, and CPU activity status


procs-----------Memory-------------Swap-------io-----system-------CPU------r B swpd free buff cache si so bi bo in c s US sy ID WA St 1 0 0 513072 52324 162404 0 0 2 2 261 32 0 0 100 0 0 0 0 0 513072 52324 162404 0 0 0 0 271 43 0 0 100 0 0 0 0 0 513072 52324 162404 0 0 0 0 255 27 0 0 100 0 0 0 0 0 513072 52324 162404 0 0 0 28 275 51 0 0 97 3 0 0 0 0 513072 52 324 162404 0 0 0 0 255 21 0 0 100 0 0 meaning of each output column: Process

–r:the number of processes waiting for runtime.

–b:the number of processes in uninterruptable sleep. Memory

–swpd:the amount of virtual memory used (KB). –free:the amount of idle memory (KB).

–buff:the amount of memory used as buffers (KB). Swap

–si:amount of memory swapped from the disk (KBPS).

–so:amount of memory swapped to the disk (KBPS). Io

–bi:blocks sent to a block device (BLOCKS/S).

–bo:blocks received from a block device (BLOCKS/S). System

–in:the number of interrupts per second, including the clock. –cs:the number of the context switches per second. CPU (These is percentages of total CPU time)

-Us:time spent running Non-kernel code (user time, including nice time). –sy:time spent running kernel code (System time).

–id:time spent idle. Prior to Linux 2.5.41, this included io-wait time.

–wa:time spent waiting for IO. Prior to Linux 2.5.41, this appeared as zero.


  6. Sar


The SAR is a tool issued by Red Hat Enterprise Linux As and is also one of the commands of the Sysstat toolset, which can be downloaded from the following URLs: http://perso.wanadoo.fr/sebastien.godard/


SAR is used to collect, report, or save system activity information. The SAR consists of three applications: SAR display data, SAR1, and sar2 for collecting and saving data.




With Sar1 and SAR2, the system can be configured to automatically crawl information and logs for analysis. Configuration Example: Add the following lines to the/etc/crontab




Similarly, you can run real-time reporting using SAR in command line mode.




Detailed CPU usage (%user,%nice,%system,%idle), memory page scheduling, network I/O, process activity, block device activity, and Interrupts/second liyawei:~ are available from the collected information


# Sar-u 3 10

Linux 2.6.16.21-0.8-default (Liyawei) 05/31/07

10:17:16 CPU%user%nice%system%iowait%idle 10:17:19 all 0.00 0.00 0.00 0.00 100.00 10:17:22 All 0.00 0.00 0.00 0.33 99 .10:17:25 All 0.00 0.00 0.00 0.00 100.00 10:17:28 All 0.00 0.00 0.00 0.00 100.00 10:17:31 All 0.00 0.00 0.00 0.00 100.0 0 10:17:34 All 0.00 0.00 0.00 0.00 100.00 7, KDE System Guard


KDE System Guard (ksysguard) is a task management and performance monitoring tool for the KDE graphical approach. Monitors hosts in the local and remote client/server architecture architecture.



This article is from "Ghost" blog, please make sure to keep this source http://fangwei009.blog.51cto.com/5234706/1773283

Linux Performance monitoring Tools

Related Article

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.