20 system monitoring tools that Linux O & M engineers should know

Source: Internet
Author: User
Need to monitor Linux server system performance? Try the following built-in system or attachment tools. Most Linux releases are equipped with a large number of monitoring tools. These tools provide metrics that can be used to obtain relevant information and system activities. You can use these tools to identify possible causes of performance problems. The tool discussed in this article is only part of the most basic tool for analyzing and debugging the following issues on the server. 1. Identify bottlenecks 2. Hard Disk (storage) bottlenecks 3. CPU and memory bottlenecks 4. network bottlenecks

Need to monitor Linux server system performance? Try the following built-in system or attachment tools. Most Linux releases are equipped with a large number of monitoring tools. These tools provide metrics that can be used to obtain relevant information and system activities. You can use these tools to identify possible causes of performance problems. The tool discussed in this article is only part of the most basic tool for analyzing and debugging the following issues on the server.

1. Identify bottlenecks

2. Hard Disk (storage) bottleneck

3. CPU and memory bottlenecks

4. Network bottleneck

#1: top-process activity

Top provides a real-time and dynamic view of the current running system, that is, the running process. By default, tasks with the highest CPU usage are displayed and refreshed every 5 seconds.

Figure 01. Linux top Command

Common hotkeys

T display abstract information switch. m Display memory information switch. A classification display system different resource users. It helps to quickly identify tasks that consume many resources in the system. F. add or delete the column to be displayed. o adjusted the order of the columns to be displayed. r. Adjust the Nice value of a running process. k. End a running process. z color/black/white display Switch

Link: How do I Find Out Linux CPU Utilization?

Recommended links for translators: top (original) essential tools for Linux System Administrators)

#2: vmstat-system activity, hardware, and system information

Run the vmstat command to obtain information about processes, memory, memory paging, blocking IO, traps, and CPU activity.

# Vmstat 3

Output example:

Procs ----------- memory ---------- --- swap -- ----- io ---- system -- ----- cpu ------
R B swpd free buff cache si so bi bo in cs us sy id wa st
0 0 0 2540988 522188 5130400 0 0 2 32 4 4 1 96 0
1 0 0 2540988 522188 5130400 0 0 720 1199 665 1 0 99 0 0
0 0 0 2540956 522188 5130400 0 0 0 1151 4 1 95 0 0
0 0 0 2540956 522188 0 0 0 6 5130500 1 0 99 0 0
0 0 0 2540940 522188 5130512 0 0 536 1189 932 1 0 98 0 0
0 0 0 2538444 522188 5130588 0 0 0 1187 4 1 96 0
0 0 0 2490060 522188 5130640 0 0 0 18 1253 5 1 94 0 0 Display memory usage details # vmstat-m Display memory activity/Inactivity Information

# Vmstat-

Related Links: How do I find out Linux Resource utilization to detect system bottlenecks?

Recommended by the translator: vmstat (original), a required tool for Linux System Administrators)

#3: w-show who has logged on and what are they doing?

W command to display the information of the current user and the running process of the system.

# W username
# W vivek

Output example:

17:58:47 up 5 days, 2 users, load average: 0.36, 0.26, 0.24
User tty from login @ IDLE JCPU PCPU WHAT
Root pts/0 10.1.3.145 5.00 s 0.04 s 0.02 s vim/etc/resolv. conf
Root pts/1 10.1.3.145 0.00 s 0.03 s 0.00 s w

#4: uptime-how long has the system been running?

In the past, the uptime command only showed how long the system was running. Now, you can see how long the system is running, how many users are currently logged on, and how much load is average in the past 1, 5, and 15 minutes.

# Uptime

Input example:

18:02:41 up 41 days, 1 user, load average: 0.00, 0.00, 0.00

1 can be considered as the optimal load value. The load changes with the system. Single CPU Systems 1-3 and SMP systems 6-10 are acceptable.

#5: ps-display process

The ps command displays the snapshot of the currently running process. Use-A or-e to display all processes.

# Ps-

Output example:

PID TTY TIME CMD
1? 00:00:02 init
2? 00:00:02 migration/0
3? 00:00:01 ksoftirqd/0
4? 00:00:00 watchdog/0
5? 00:00:00 migration/1
6? 00:00:15 ksoftirqd/1
....
.....
4881? 00:53:28 java
4885 tty1 00:00:00 mingetty
4886 tty2 00:00:00 mingetty
4887 tty3 00:00:00 mingetty
4888 tty4 00:00:00 mingetty
4891 tty5 00:00:00 mingetty
4892 tty6 00:00:00 mingetty
4893 ttyS1 00:00:00 agetty
12853? 00:00:00 cifsoplockd
12854? 00:00:00 cifsdnotifyd
14231? 00:10:34 lighttpd
14232? 00:00:00 php-cgi
54981 pts/0 00:00:00 vim
55465? 00:00:00 php-cgi
55546? Bind9-snmp-stat 00:00:00
55704 pts/1 00:00:00 psps are very similar to top, but ps provides more information. Output long format # ps-Al output additional full format (display parameters passed in during execution) # ps-AlF display process structure

# Ps-AlFH

Display thread after Process

# Ps-AlLm

Print all processes on the server

# Ps ax
# Ps axu

Print process tree

# Ps-ejH
# Ps axjf
# Pstree

Print Security Information

# Ps-eo euser, ruser, suser, fuser, f, comm, label
# Ps axZ
# Ps-eM

View processes run with the Vivek User Name

# Ps-U vivek-u vivek u

Set custom output format

# Ps-eo pid, tid, class, rtprio, ni, pri, psr, pcpu, stat, wchan: 14, comm
# Ps axo stat, euid, ruid, tty, tpgid, sess, pgrp, ppid, pid, pcpu, comm
# Ps-eopid, tt, user, fname, tmout, f, wchan

Only the Lighttpd process ID is displayed.

# Ps-C lighttpd-o pid =

Or

# Pgrep lighttpd

Or

# Pgrep-u vivek php-cgi

Display the process name with PID 55977

# P.m.-p 55977-o comm =

Find the top 10 processes that consume the most memory

# Ps-auxf | sort-nr-k 4 | head-10

Find the top 10 processes with the most CPU usage

# Ps-auxf | sort-nr-k 3 | head-10

#6: free-memory usage

The free command displays the idle and used physical memory, swap memory, and buffer used by the kernel.

# Free

Output example:

Total used free shared buffers cached
Mem: 12302896 9739664 2563232 0 523124 5154740
-/+ Buffers/cache: 4061800 8241096
Swap: 1052248 0 1052248 link: Linux Find Out Virtual Memory PAGESIZELinux Limit CPU Usage Per ProcessHow much RAM does my Ubuntu/Fedora Linux desktop PC have?

#7: iostat-average CPU load, hard disk Activity

The iostat command can report the statistical information of the central processor (CPU), input/output statistics of various devices, partitions, and network file systems.

# Iostat

Output example:

Linux 2.6.18-128.1.14.el5 (www03.nixcraft. in) 06/26/2009

Avg-cpu: % user % nice % system % iowait % steal % idle
3.50 0.09 0.51 0.03 0.00 95.86

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
Sda 22.04 31.88 512.03 16193351 260102868
Sda1 0.00 0.00 0.00 2166
Sda2 22.04 31.87 512.03 16189010
Sda3 0.00 0.00 0.00 0 0 link: Linux Track NFS Directory/Disk I/O Stats#8: sar-collect and report system activities

Sar commands are used to collect, report, and store system activity information. View network counters and enter:

# Sar-n DEV | more

Display network counters for the last 24 hours

# Sar-n DEV-f/var/log/sa/sa24 | more

You can also use sar to display real-time information.

# Sar 4 5

Output example:

Linux 2.6.18-128.1.14.el5 (www03.nixcraft. in) 06/26/2009

At 06:45:12 CPU % user % nice % system % iowait % steal % idle
06:45:16 all 2.00 0.00 0.22 0.00 0.00 97.78
06:45:20 all 2.07 0.00 0.38 0.03 0.00 97.52
06:45:24 all 0.94 0.00 0.28 0.00 0.00 98.78
06:45:28 all 1.56 0.00 0.22 0.00 0.00 98.22
06:45:32 all 3.53 0.00 0.25 0.03 0.00 96.19
Average: all 2.02 0.00 0.27 0.01 0.00

Related Links: How to collect Linux system utilization data into a file

#9: mpstat-multi-processor usage

The mpstat command displays the usage of all available processors. The processor number starts from 0. Mpstat-p all shows the average usage of each processor.

# Mpstat-P ALL

Output example:

Linux 2.6.18-128.1.14.el5 (www03.nixcraft. in) 06/26/2009

At 06:48:11 CPU % user % nice % sys % iowait % irq % soft % steal % idle intr/s
06:48:11 all 3.50 0.09 0.34 0.03 0.01 0.17 0.00 95.86 1218.04
06:48:11 PM 0 3.44 0.08 0.31 0.02 0.00 0.12 0.00 96.04 1000.31
06:48:11 PM 1 3.10 0.08 0.32 0.09 0.02 0.11 0.00 96.28 34.93
06:48:11 PM 2 4.16 0.11 0.36 0.02 0.00 0.11 0.00 95.25 0.00
06:48:11 PM 3 3.77 0.11 0.38 0.03 0.01 0.24 0.00 95.46 44.80
06:48:11 PM 4 2.96 0.07 0.29 0.04 0.02 0.10 0.00 96.52 25.91
06:48:11 PM 5 3.26 0.08 0.28 0.03 0.01 0.10 0.00 96.23 14.98
06:48:11 PM 6 4.00 0.10 0.34 0.01 0.00 0.13 0.00 95.42 3.75
06:48:11 PM 7 3.30 0.11 0.39 0.03 0.01 0.46 0.00 95.69 76.89

Link: Linux display each multiple smp cpu processors utilization individually.

#10: pmap-memory usage of processes

The pmap command can display the memory ing of processes. You can use this command to find out the cause of memory bottleneck.

# Pmap-d PID

Displays the memory information of processes whose PID is 47394.

# Pmap-d 47394

Output example:

47394:/usr/bin/php-cgi
Address Kbytes Mode Offset Device Mapping
0000000000400000 2584 r-x -- 0000000000000000 008:00002 php-cgi
0000000000886000 140 rw --- 0000000000286000 008:00002 php-cgi
00000000008a9000 52 rw --- 00000000008a9000 000:00000 [anon]
20171000000aa8000 76 rw --- 201710000002a8000 008:00002 php-cgi
000000000f678000 1980 rw --- 000000000f678000 000:00000 [anon]
201700314a600000 112 r-x -- 0000000000000000 008:00002 ld-2.5.so
201700314a81b000 4 r ---- 2017100000001b000 008:00002 ld-2.5.so
201700314a81c000 4 rw --- 2017100000001c000 008:00002 ld-2.5.so
201700314aa00000 1328 r-x -- 0000000000000000 008:00002 libc-2.5.so
201700314ab4c000 2048 ----- 2017100000014c000 008:00002 libc-2.5.so
.....
......
..
20172af8d48fd000 4 rw --- 0000000000006000 008:00002 xsl. so
20172af8d490c000 40 r-x -- 0000000000000000 008:00002 libnss_files-2.5.so
%2af8d4916000 2044 ----- %%%a000 008:00002 libnss_files-2.5.so
20172af8d4b15000 4 r ---- 0000000000009000 008:00002 libnss_files-2.5.so
20172af8d4b16000 4 rw --- 2017100000000a000 008:00002 libnss_files-2.5.so
20172af8d4b17000 768000 rw-s-0000000000000000 000:3859 zero (deleted)
20177fffc95fe000 84 rw --- 20177ffffea000 000:00000 [stack]
Ffffffffff600000 8192 ----- 0000000000000000 000:00000 [anon]
Mapped: 933712 K writeable/private: 4304 K shared: 768000 K

The last line is very important:

* Mapped: Memory ing space of 933712 KB

* Writeable/private: 4304 K private address space size

* Shared: 768000 kb shared address space

Link: Linux find the memory used by a program/process using pmap command

#11 and #12: netstat and ss-Network Information

Netstat can display network links, route table information, interface statistics, disguised links, and multicast members (multicast memberships). The ss command is used to display network socket information, which allows display of information similar to netstat. For details about how to use ss and netstat, refer to the following resources.

Related links:

Ss: Display Linux TCP/UDP Network and Socket InformationGet Detailed Information About particle IP address Connections Using netstat Command

#13: iptraf-real-time network information

Iptraf is an interactive IP network monitoring tool. It can generate a variety of network statistics, including TCP information, UDP quantity, ICMP and OSPF information, Ethernet load information, node status, IP address verification error, and so on. The following information formats are available:

Different network TCP connection transmission quantities different network interfaces IP transmission quantities different protocols network transmission quantities different TCP/UDP ports and different packet sizes network transmission quantities different layer 2 address network transmission volumes

Figure 02: general interface information: IP transfer volume of different network interfaces


Figure 03 TCP link transmission volume of different networks

#14: tcpdump: Detailed Network Traffic Analysis

Tcpdump is a simple network traffic dump tool. However, to use tcpdump well, you must be familiar with the TCP/IP protocol. For example, to display the network traffic of DNS, enter:

# Tcpdump-I eth1 'udp port 53'

Display All IPv4 HTTP packets in and out of port 80, that is, only the packets containing data are printed. For example, SYN, FIN, and ACK-only packet input:

# Tcpdump 'tcp port 80 and (ip [2]-(ip [0] & 0xf) <2 )) -(tcp [12] & 0xf0)> 2 ))! = 0 )'

Show all FTP sessions. Enter:

# Tcpdump-I eth1 'dst 202.54.1.5 and (port 21 or 20'

Show all HTTP sessions to 192.168.1.5

# Tcpdump-ni eth0 'dst 192.168.1.5 and tcp and port http'

Use wireshark to view details in the dump file. Enter:

# Tcpdump-n-I eth1-s 0-w output.txt src or dst port 80

#15: strace-system call

Trace system calls and models, which are useful for debugging Web servers and other servers. Learn how to track processes and their functions.

#16:/proc file system-various kernel information

The files in the/proc directory provide detailed information about different hardware devices and kernels. For more details, see Linux kernel/proc. General/proc example:

# Cat/proc/cpuinfo
# Cat/proc/meminfo
# Cat/proc/zoneinfo
# Cat/proc/mounts

#17: Nagios-server and network monitoring

Nagios is a very popular system and network monitoring software. You can easily monitor all hosts, network devices, and services. It can send alerts after a fault or recovery. FAN is short for "Fully Automated Nagios. The goal of FAN is to provide Nagios installation by the Nagios community. To make it easier to install the Nagios server, FAN provides a CD image in the standard ISO format. This release also contains a set of tools to enhance user experience.

#18: Cacti-Web-based monitoring tool

Cacti is a complete set of network graphical solutions, based on RRDTool data storage and graphical functions. Cacti provides a fast scanner, advanced graphical templates, multiple data collection methods, and user management functions. These features provide user-friendly interfaces to ensure that they can be deployed in a complex network containing hundreds of devices. It provides network, CPU, memory, logged-on users, Apache, DNS, and other information. For how to install and configure Cacti in CentOS/RHEL, see: http://www.cyberciti.biz/faq/fedora-rhel-install-cacti-monitoring-rrd-software/

#19: KDE System Guard

KSysguard is a networked system monitoring tool on the KDE Desktop. This tool can run through an SSH session. It provides many functions, such as monitoring the client/server architecture of the local and remote hosts. The front-end graphical interface uses the so-called sensors to obtain and display information. The sensor returns a simple value or a set of table information. One or more displays are provided for different information types. These displays are organized into multiple worksheets, which can be stored and loaded in a single worksheet. Therefore, KSysguard is not only a simple task manager, but also a powerful tool that can control multiple servers.

Figure 05: KDE System Guard

For detailed usage, see the KSysguard handbook

#20: Gnome System Monitor

System Monitor displays basic System information, monitoring System processes, System resources, and file System usage. You can also use System Monitor to Monitor and modify System behavior. Although KDE System Guard is not powerful, its basic information is very useful to beginners.

* Displays basic information about computer hardware and software.
* Linux kernel version
* GNOME version
* Hardware
* Installed memory
* Processor and its speed
* System status
* Available hard disk space
* Process
* Memory and swap space
* Network usage
* File System
* All mounted file systems and their basic information

Figure 06: The Gnome System Monitor application

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.