Milos
03-03-2002, 08:43 PM
Hi all !
in earlier discussions were some tips for service status checking by using port (e.g. 80 for http, etc.).
Is there any chance get following features also with PHP?
- Ping (test if remote server answer, and if yes, how ms it takes (ms are not needed if it is not so easy :)
- Number of Opened Files
- Current % of maximal opened files
- Server average load
- CPU load
- Free MEM
THANK YOU VERY MUCH FOR YOUR TIPS!
Btw, I solve previous features by using following PHP code, but it works at local machine only, and I need to work it out on remote machines also.
<?
$filesa=fopen("/proc/loadavg","r");
//@fpassthru($filesa);
$fline = fgets($filesa,100);
fclose($filesa);
List($onem,$fivem,$tenm,$trash1,$trah2) = Explode(" ",$fline);
$filesa=fopen("/proc/sys/fs/file-nr","r");
//@fpassthru($filesa);
$fline = fgets($filesa,100);
$datime = Date("d.m.Y H:i:s");
List(,$cur,$max) = explode(Chr(9),$fline);
$procs=Round($cur/($max/100),2);
echo("$cur files opened ($procs %) with <B>$onem</B> load");
@fclose($filesa);
?>
in earlier discussions were some tips for service status checking by using port (e.g. 80 for http, etc.).
Is there any chance get following features also with PHP?
- Ping (test if remote server answer, and if yes, how ms it takes (ms are not needed if it is not so easy :)
- Number of Opened Files
- Current % of maximal opened files
- Server average load
- CPU load
- Free MEM
THANK YOU VERY MUCH FOR YOUR TIPS!
Btw, I solve previous features by using following PHP code, but it works at local machine only, and I need to work it out on remote machines also.
<?
$filesa=fopen("/proc/loadavg","r");
//@fpassthru($filesa);
$fline = fgets($filesa,100);
fclose($filesa);
List($onem,$fivem,$tenm,$trash1,$trah2) = Explode(" ",$fline);
$filesa=fopen("/proc/sys/fs/file-nr","r");
//@fpassthru($filesa);
$fline = fgets($filesa,100);
$datime = Date("d.m.Y H:i:s");
List(,$cur,$max) = explode(Chr(9),$fline);
$procs=Round($cur/($max/100),2);
echo("$cur files opened ($procs %) with <B>$onem</B> load");
@fclose($filesa);
?>
