How to monitor your Linux server
There are essentially two types of remote monitoring you can perform on your server. One is preventative monitoring directly from the command line or control panel, and the other is uptime monitoring, which is normally done by an external service. Both are important for disaster prevention and disaster recovery. It is not a question of if your server will ever go down. The real question is when. Therefore, it is better to be prepared.
In a previous post, you learned how to monitor system logs. This is only one part of the equation. You can also monitor system processes. For example, if you are concerned about certain applications using too much CPU and/or RAM, you can run a simple command to monitor the most intense processes. From a secure shell (SSH) prompt, simply type:
top
Top will show you memory usage, number of users logged in, load averages, CPU consumption, total uptime, virtual memory, and how long each process has been running. It also shows you what user is running each process so that you can investigate any suspicious ones. When you are finished with top, press the “q” key to quit.
Despite its usefulness, top will only show you the most CPU intensive processes. Another tool that monitors all processes is called “ps”. With it you can get a list of every process running, the user running it, and even what action it is taking. To see running processes, type:
ps aux
If you want it to display on your screen one page at a time, type;
ps aux | less
If you ever find a process that needs to be stopped (also known as a runaway process), you should look for the process ID (PID) found in the ps list. Find it and make a note of it. Then, when you are ready to stop it, type:
kill 9999
Replace “9999″ with the real process number. You can also kill all processes running under a particular command by typing:
killall command-name
With those few simple commands, you will have a little more peace of mind knowing your server is running smoothly.
Related Posts
- Monitor Memory on a Linux Server
- How to Monitor Linux Server Users in Real Time
- Using Netstat to Monitor Network Services
- The ps Command on a Linux Server
- How to Monitor Your Server’s Memory Usage

