Web Hosting Talk







View Full Version : is there any way i can monitor my server's load average from cpanel?


lobaloba9
12-11-2003, 05:03 AM
i'm not talking about the server status at a particular time but the load average.

can a customer check the load average on cpanel?

sprintserve
12-11-2003, 01:50 PM
Server status gives the load of the server at a particular time. Other than that, it doesn't do more. However, it's probably close enough to what you need.

lobaloba9
12-11-2003, 02:08 PM
but i need to monitor the daily load average, so at least i can check if my website is crashing my webhost's server

stephenM
12-11-2003, 02:47 PM
Originally posted by lobaloba9
but i need to monitor the daily load average, so at least i can check if my website is crashing my webhost's server

You'll need something like MRTG then.

John[H4Y]
12-11-2003, 03:25 PM
You will have no evidence that it is YOUR website that is overloading the server only by looking at the server's load average. It could easily be someone else's site causing load average spikes.

linux-tech
12-11-2003, 10:10 PM
If you're running CPanel, there is a way to monitor the top processes, it's rather simple to do really with the following code:

#!/bin/bash
DATE=`date +%m%d%y`
TIME=`date +%T`
if [ ! -d /usr/local/apache/htdocs/processes/$DATE ];then
mkdir /usr/local/apache/htdocs/processes/$DATE
fi

wget -O /usr/local/apache/htdocs/processes/$DATE/$TIME-cpu.html --http-user=root , --http-passwd=YOURROOTPASSWORDHERE https://localhost:2087/scripts2/showcpuusage

Make SURE you've got /usr/local/apache/htdocs/processes/ on the server, and that you can password protect that specific directory, otherwise anyone can get to it (if you want, add a user when you want them to look at the list).

Save the above code as something like cpu.sh, chmod a-rxw, then chmod u+rxw (as root), and call it from cron. My cron entries for it:

*/5 * * * * /root/.showcpu


What does this do?
This pulls the list of processes from https://localhost:2087/scripts/showcpuusage and throws it into a file that can be read from a web browser.

Downside? Not many, if you protect your directory, then you'll have no problems, and you can store months of those files in there. here's how it's protected , or how I've done so.
At the end of httpd.conf, put :

<Directory "/usr/local/apache/htdocs/processes">
AuthName "Private Access Only"
AuthType Basic
AuthUserFile /usr/local/bandmin/passwd
require valid-user
</Directory>


All in all, this has helped a number of individuals out, finding who's hogging their CPU, scripts and the like.

{edit: Sorry, forgot a couple things}

Veus
12-12-2003, 05:52 AM
and then what url do u use to access it?

RofyHost
12-12-2003, 05:59 AM
many thanks wolfstream, it was very helpful to know!

linux-tech
12-12-2003, 06:05 AM
Originally posted by VeusHosting
and then what url do u use to access it?
http://base.ip.of.machine/processes/
That'll pull up the directory list, you merely have to browse through the directory untill you find the date you want.
I've got clients that have been running this software for 6 months straight, maybe used 2m of space (if that), it's only text, not really that disk space intense.

Veus
12-12-2003, 06:20 AM
Ok thanks a lot, this WILL be useful :)

Wunk
12-12-2003, 11:30 AM
nagios will let you do that

It'll let you monitor services of servers, and if you install a small daemon on the monitored system, you can also read out the load, diskspace, etc, etc, and let it send out pager or E-mails when it goes over the configurable treshold..