2015-12-27 iOS Development
For every system administrator or network administrator, it is very difficult to monitor and debug Linux system performance issues every day. I've had 5 years of experience working with Linux administrators and know how to monitor the system to keep it running properly.
To do this, we have written 20 command-line system monitoring tools that are useful and most commonly used by Linux/unix system administrators. These commands can be used under all versions of Linux to monitor and find the actual cause of system performance. These monitoring commands are sufficient for you to choose the right monitoring scenario for you.
1.top-linux System Process Monitoring
The top command is a performance monitor that can be used in many Linux/unix versions, and it is also a tool for monitoring system performance often used by Linux system administrators. The TOP command periodically displays all running and running and updates to the list, showing CPU usage, memory usage, swap memory, cache size, buffer size, process control, users, and more commands. It also shows running processes with high memory and CPU usage. The top command is very useful for system administrators when we need to monitor and take the right action on a Linux system. Let's take a look at the actual operation of the top command.
# Top
2.vmstat-Virtual Memory Statistics
The Vmstat command is used to display more information such as virtual memory, kernel threads, disks, system processes, I/O modules, interrupts, CPU active states, and more. In the default case, the Linux system is not vmstat this command, if you want to use it, you must install a package called Sysstat. The common usage of command format is as follows:
# 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
3.lsof-Open File List
The lsof command is available for many Linux/unix systems, and displays open files and processes primarily as a list.
Open files mainly include disk files, network sockets, pipelines, devices, and processes. The main reason for using this command is that a disk cannot be uninstalled and displays the error message that the file is being used or opened. This command makes it easy to see which files are being used. The most common format for this command:
# 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
4.tcpdump-Network Packet Analyzer
Tcpdump is one of the most widely used command line network packet analyzers or packet sniffing programs that are used primarily to capture and filter TCP/IP packets to receive or transfer specific pretext information on a network. It also provides an option parameter to save the captured package in a file for later analysis use, tcpdump is available in almost all Linux versions.
# tcpdump-i Eth0
Tcpdump:verbose output suppressed, use-v OR-VV for full protocol decode
Listening on eth0, Link-type EN10MB (Ethernet), capture size bytes
22:08:59.617628 IP tecmint.com.ssh > 115.113.134.3.static-mumbai.vsnl.net.in.28472:p 2,532,133,365:2,532,133,481 (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 ($) Ack 1 win 9648
22:08:59.617916 IP 115.113.134.3.static-mumbai.vsnl.net.in.28472 > Tecmint.com.ssh:. ACK-$ win 64347
5.netstat-Network Statistics
The netstat command is a command-line tool that monitors the incoming and outgoing statistical interfaces of a network packet. It is a very useful tool for many system administrators to monitor network performance and solve network-related issues.
# tcpdump-i Eth0
Tcpdump:verbose output suppressed, use-v OR-VV for full protocol decode
Listening on eth0, Link-type EN10MB (Ethernet), capture size bytes
22:08:59.617628 IP tecmint.com.ssh > 115.113.134.3.static-mumbai.vsnl.net.in.28472:p 2,532,133,365:2,532,133,481 (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 ($) Ack 1 win 9648
22:08:59.617916 IP 115.113.134.3.static-mumbai.vsnl.net.in.28472 > Tecmint.com.ssh:. ACK-$ win 64347
6.htop-Process Monitoring
Htop is a more advanced, interactive, real-time monitoring tool. Htop is very similar to the top command, but he has some very rich features, such as user-friendly interface management processes, shortcut keys, horizontal and vertical processes, and more. Htop is a third-party tool that is not included in a Linux system and you need to install it using the Package management tool.
# Htop
7.iotop-monitoring Linux disk I/O
Iotop is also similar to the top and Htop commands, but it will have a reporting function to monitor and display real-time disk I/O input and output program processes. This tool is useful for finding accurate, high-disk read/write processes.
# Htop
8.iostat-Input/Output statistics
Iostat is a simple tool for collecting and displaying system input and output storage device statistics. This tool is typically used to look for storage device performance issues, including devices, local disks, such as remote NFS disks.
# 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
9.iptraf-real-time IP LAN monitoring
Iptraf is a real-time network (IP Network) monitoring tool for Linux systems based on open source. It collects a wide variety of information, such as network-to-IP traffic monitoring, including TCP flag information, ICMP details, tcp/udp traffic failures, TCP-connected packets, and the Bayern count. It also collects interface statistics for general and detailed information such as TCP,UDP,ICMP,IP, non-IP,IP checksum errors, interface activity, and more.
10.Psacct or acct-Monitor user activity
Psacct or ACCT is a very useful tool for monitoring the active state of each user to the system. In the background there are two daemons running, one is keeping an eye on the overall activity of each user on the system, and the other process is concerned about what resources are consumed by them.
This tool is useful for system administrators to track each user's activity, to know what the user is doing, what commands are being issued, how much resources are being consumed, and how long it takes to be active on the system.
11.monit-Program and Service monitoring
This is a free open source Web-based program that automatically monitors and manages system processes, programs, files, directories, permissions, and checksum file systems. The services it monitors include Apache, MYSQL, Mail, FTP, Nginx, and more. The system state can be viewed from the command line or from its own network interface.
12.nethogs-monitoring the network bandwidth of each process
Nethogs is an open source nifty applet (similar to the top command above Linux) that maintains the network activity status of each process on your system. It also maintains a program or application for real-time network traffic bandwidth usage.
13.iftop-Network Bandwidth Monitoring
Iftop is another terminal-based, open-source system monitoring tool that displays a list of frequently updated network bandwidth utilization (i.e. source and destination hosts) through the network interface on your own system. Iftop monitors the use of the network, and top monitors the use of the CPU. The Iftop monitors a selected interface and displays the current bandwidth usage between the two hosts.
14.monitorix-System and Network monitoring
Monitorix is one of the most lightweight monitoring tools in Linux/unix, and the main design is to monitor running systems and network resources. It has a built-in HTTP Web service to periodically collect system and network information and display it as a picture. It can monitor the average load usage of the system, the allocation of memory, disk drives, system services, network ports, message statistics (Sendmail, Postfix, Dovecot, etc.), MYSQL database, and more. Its main purpose is to monitor the performance of the whole system, and help to monitor the failure, bottlenecks, abnormal activities and other conditions.
15.arpwatch-Ethernet Activity Monitor
Arpwatch is a program used to monitor the network traffic of Ethernet networks for Linux networks with address resolution (network address translation). It has been monitoring Ethernet traffic and generating logs for IP and MAC address pairs as the network timestamp changes. When an IP address or MAC address pair changes, it sends an email notification to the administrator.
Also, it is very useful in detecting ARP attacks.
16.suricata-Network Security Monitoring
Suricata is a high-performance open source network security and intrusion detection and prevention monitoring tool for Linux, FreeBSD, Windows and other operating systems. It is owned by a non-profit fund OISF (Open Information Security Foundation).
17.VnStat php-Monitoring network bandwidth
Vnstat PHP is one of the most popular social tools for WEB front-end applications called "Vnstat". Vnstat PHP uses a good graphics mode to monitor network traffic usage. It shows the usage of network traffic in the summary report for each time, day, and month.
18.nagios-Network/server monitoring
Nagios is a leading open source, powerful monitoring system where network/system administrators identify and resolve server-related issues before they affect major business processes. Nagios can monitor remote Linux, Windows, switches, single-window routers, and printers. It can show your network and server critical alarms and help you solve problems before they are reversed.
19.nmon-Monitoring Linux system performance
All the resources that the Nmon (i.e. Nigel Performance Monitor) tool uses to monitor Linux systems include: CPU, memory, disk usage, processes on the network, NFS, kernels, and so on. This tool has two modes: Online mode and capture mode. The online mode is suitable for real-time monitoring, and the capture mode is used to store the processing after the output is in CSV format.
20.collectl-Integrated Performance Testing Tool
Collectl is another powerful command-line-based monitoring tool that collects information about system resources, including CPU usage, memory, networks, nodes, processes, NFS, TCP sockets, and more.
We would like to know what monitoring program you use to monitor your server's performance? If we miss any of the tools you want, please tell us by comment and don't forget to share him.
Content Source: Linuxstory
FOREST
Original link: http://www.linuxstory.org/command-line-tools-to-monitor-linux-performance/
20 most common command-line tools for monitoring Linux system performance