Ideally, there exists two methods to remotely monitor your web server. One of which is a more preventative monitoring which is done straight using the command prompt or the web hosting control panel while the other is to monitor the up-time using third party services or tools. Both the methods are crucial from the disaster recovery and prevention point of view. Both these types of monitoring can help you avoid your server from going down.

Monitoring the server logs or system logs is one aspect, but you can monitor processes on your system as well. If you have a particular application running on the server which you suppose to consume a lot of resources such as RAM and CPU, a simple command can help you with monitoring the process that is eating up most of your server resources. Simply log-in to your SSH and run the command :

top

 

This command would display your server’s memory usage, the total number of users that are online, average server load, CPU consumption, total up-time, memory (virtual) and the time since every process has been running. In-addition to that this command would also help you view the user who is operating the process, this can help you with investigating the suspected users. Once finished with it, you simply need to type “q” to exit.

This indeed proves useful when you wish to check the most CPU intensive processes running at a given point of time. But what in-case where you need to check all the processes that are operational at a given time? There is one more tool that can help you with monitoring each process termed as the “ps”. To view the processes you need to enter the following in your SSH :

ps aux

 

Incase you wish to view it on a per-page basis, you must type :

ps aux | less

 

After doing this if you encounter a process which you feel, must be terminated, you need to make a note the process ID (PID) as listed on the screen. Once you’ve made a list of such processes simply run the following command :

kill 1234

 

You must change the PID for each process you wish to terminate. If you wish to terminate/kill every process that runs under a particular command, you can use the following command:

killall command-name

 

These simple steps can help you avoid your server from going down due to some resource intensive processes that are purposely or mistakenly been run.

en_USEnglish