remote server uptime and load average?

I would like for my site to show load averages and server uptimes from other servers i will be ordering in the future....how can this be done without linking to the server directly?

Here is the code i have, can someone re-write it to add an ip address to check for the info? Right now this code is pulling localally.

hope that made sense :-?


//GET SERVER LOADS
$loadresult = @exec('uptime');
preg_match("/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/",$loadresult,$avgs);

$uptime = shell_exec("cut -d. -f1 /proc/uptime");
$days = floor($uptime/60/60/24);
$hours = $uptime/60/60%24;
$mins = $uptime/60%60;
$secs = $uptime%60;


Thanks

 

 

 

 

Top