How to use the command to monitor the server under Linux

  

If you want to know the current status of the Linux server, then you need to know the Linux server monitoring command, use the Linux server monitoring command, you can know what the current server is doing, then the Linux server monitoring What are the commands? Let's take a look at it with Xiaobian.

Some Linux distributions provide GUI programs for system monitoring. For example, SUSE Linux has a great and professional tool, YaST, and KDE's KDE System Guard is also excellent. Of course, to use these tools, you have to operate in front of the server, and these GUI programs take up a lot of system resources, so even though the GUI is used to do basic server health monitoring, it's good if you want to know what really happens. What, please turn off the GUI and start the command line tour.

You should only start the GUI when you need it, and turn it off when not in use. If you want to keep your server running at its best, you should set the Linux server's runlevel runlevel to 3, which is console mode. Use the startx command to start it when you need a graphical desktop.

If your server goes directly to the graphical interface after startup, you need to modify the configuration /etc/inittab to find initdefault and change id:5:initdefault to id:3:initdefault.

If you don't find the /etc/inittab file, create a new one and add id:3 to the file content. This will not enter the graphical interface the next time the server is started. If you don't want to wait until the server is restarted, you can execute the init 3 command.

Once your server is running in console mode, you can start what we have next.

iostat

The iostat command is used to display the details of the storage subsystem and is typically used to monitor disk I/O. Pay special attention to the %iowait value in the iostat statistics, which is too large to indicate that your system storage subsystem is underperforming.

meminfo and free

Meminfo allows you to get detailed memory information. You can use the cat and grep commands to display meminfo information:

cat /proc/meminfo

In addition, you can use the free command to display dynamic memory usage information. Free just gives you approximate memory information, and the information provided by meminfo is more detailed. For example, free on oschina command execution result:

mpstat

mpstat mpstat is MultiProcessor Statistics acronym is real-time system monitoring tools. It reports some statistics with the CPU, which is stored in the /proc/stat file. In a multi-CPUs system, it can view not only the average status information of all CPUs, but also the information of a specific CPU.

Let's look on the oschina mpstat command execution results:

mpstat on the implementation of the results of the parameters refer to the meaning of this article.

netstat

Netstat is similar to the ps command. It is a tool that Linux administrators use every day. It displays a lot of network-related information, such as socket usage, routing, interfaces, Protocols, networks, etc. Here are some common parameters:

-a Show all socket information

-r Show routing information

-i Show network interface statistics

-s Show network protocol statistics

nmon

Nmon, short for Nigel&squo;s Monitor, is a very popular open source tool for monitoring the performance of Linux systems. Nmon monitors performance data for multiple subsystems such as processor utilization, memory usage, queues, disk I/O statistics, network I/O statistics, memory page processing, and process information. Nmon also provides a graphical tool:

To run nmon, you can launch it from the command line, and then select to monitor subsystems that corresponds to a shortcut key, For example, input c to view CPU information, m to view memory, d to view disk information, etc. You can also use the -f command to save the execution result of nmon to a CSV file for later analysis.

In my daily monitoring work, I found nmon to be my most used tool.
Previous12Next Total 2 Pages

Copyright © Windows knowledge All Rights Reserved