Tuesday, March 20, 2012

16 Linux Server Monitoring Commands You Really Need To Know

Want to know what's really going on with your server? Then you need to know these essential commands. Once you've mastered them, you'll be well on your way to being an expert Linux system administrator.

Depending on the Linux distribution, you can run pull up much of the information that these shell commands can give you from a GUI program. SUSE Linux, for example, has an excellent, graphical configuration and management tool, YaST, and KDE's KDE System Guard is also excellent.
However, it's a Linux administrator truism that you should run a GUI on a server only when you absolutely must. That's because Linux GUIs take up system resources that could be better used elsewhere. So, while using a GUI program is fine for basic server health checkups, if you want to know what's really happening, turn off the GUI and use these tools from the Linux command shell.

This also means that you should only start a GUI on a server when it's required; don’t leave it running. For optimum performance, a Linux server should run at runlevel 3, which fully supports networking and multiple users but doesn't start the GUI when the machine boots. If you really need a graphical desktop, you can always get one by running startx from a shell prompt.

If your server starts by booting into a graphical desktop, you need to change this. To do so, head to a terminal window, su to the root user, and use your favorite editor on /etc/inittab.

Once there, find the initdefault line and change it from id:5:initdefault: to id:3:initdefault:
If there is no inittab file, create it, and add the id:3 line. Save and exit. The next time you boot into your server it will boot into runlevel 3. If you don't want to reboot after this change, you can also set your server's run level immediately with the command: init 3
Once your server is running at init 3, you can start using the following shell programs to see what's happening inside your server.

iostat
The iostat command shows in detail what your storage subsystem is up to. You usually use iostat to monitor how well your storage sub-systems are working in general and to spot slow input/output problems before your clients notice that the server is running slowly. Trust me, you want to spot these problems before your users do!

meminfo and free
Meminfo gives you a detailed list of what's going on in memory. Typically you access meminfo's data by using another program such as cat or grep. For example,

cat /proc/meminfo

Read more: InputOutput
QR: Inline image 1

Posted via email from Jasper-Net