16 Linux server monitoring commands that you must know

  

Do you want to know what your server is doing? Then you need to know the basic commands described in this article. Once you are familiar with these commands, you have laid the foundation for becoming a professional Linux system administrator.

You can get a lot of information from these shell commands through a graphical user interface (GUI) program, depending on which Linux distribution you use. For example, SUSE Linux has an excellent, graphical configuration and management tool, YaST, and KDE's KDE System Guard is equally good.

However, one common thread Linux administrators need to understand is that the GUI should be run on the server only when absolutely necessary. That's because the Linux GUI consumes system resources that could otherwise be used more reasonably elsewhere. So, while using GUI programs is a good place to do a basic check on server health, if you want to know what's going on, close the GUI and start using these tools from the Linux command shell.

This also means that you should open the GUI on the server whenever you need it; turn it off when you don't need it. To ensure optimal performance, the Linux server should run at runlevel 3, which fully supports the network and multiple users, but does not open the GUI when the machine boots. If you really need a graphical desktop, you can always get a graphical desktop by running startx from the shell prompt.

If your server is booted into a graphical desktop, you will need to change this. To do this, go to the terminal window, use the su command to switch to the root user, and then open the /etc/inittab file with your favorite editor.

Once inside the file, find the initdefault line and change id:5:initdefault: to id:3:initdefault:.

If there is no /etc/inittab file, create one and add the id:3 line. Save and exit. The next time you boot into the server, it will boot into run level 3. If you don't want to restart after making this change, you can also set the run level of the server immediately with the command init 3.

Once your server is running in init 3, you can start using the following shells to see what's going on in your server.

iostat

The iostat command details the storage subsystem aspect. You usually use iostat to monitor how the storage subsystem is generally healthy, and to detect slow input/output problems before users notice that the server is slow. Believe me, you should find these problems before users find these problems!

meminfo and free

meminfo shows you the memory aspect in detail. You can usually use another program, such as cat and grep, to access the information of meminfo. For example, cat /proc/meminfo shows you in detail how the server's memory is used at any one time.

If you want to quickly get an overview of the memory, you can use the free command. In short, free gives you an overview; meminfo gives you detailed information.
mpstat


The mpstat command reports the activity of each available processor on a multiprocessor server. Today, due to multi-core processors, this command is available for almost all servers. Mpstat can also report the average activity of processors on all servers. It allows you to display total processor statistics by system or by processor. This summary information can alert you to potential application issues before they provoke users.

netstat

netstat, like ps, is also a Linux tool used by Linux administrators every day. It shows a lot of information about the network, such as socket usage, routing, interfaces, protocols, network statistics, and more. Some of the most common options are as follows:

-a Display all information about the socket

-r Display routing information

-i Display statistics for network interfaces

-s Display statistics for network protocols

nmon

nmon is short for Nigel&squo;s Monitor, a popular open source tool for monitoring the performance of Linux systems. Nmon can monitor performance information for multiple subsystems such as processor utilization, memory usage, run queue information, disk input/output statistics, network input/output statistics, memory paging activity, and process metrics. Then, you can view nmon's real-time system measurement results through the curses & ldquo; graphical & rdquo; interface.

Copyright © Windows knowledge All Rights Reserved