/コンピュータ/MRTG/Apacheのプロセス数をグラフ化してみる
mrtg.cfg(抜粋)
Target[apache]: `php /home/aki/mrtg/busyserver.php` MaxBytes1[apache]: 512 MaxBytes2[apache]: 512 Unscaled[apache]: dwmy Title[apache]: Apache Analysis PageTop[apache]: <H1>Apache Analysis</H1> Options[apache]: growright, gauge,withzeroes ShortLegend[apache]: proc YLegend[apache]: proc Legend1[apache]: Busy Legend2[apache]: Idle LegendI[apache]: Busy LegendO[apache]: Idle
busyserver.php
<?php
$x=file_get_contents("http://localhost/server-status?auto");
$dt=split ("\n",$x);
$as=split(":",$dt[0]);
$bs=split(":",$dt[1]);
$as[1]=str_replace(" ","",$as[1]);
$bs[1]=str_replace(" ","",$bs[1]);
print("$as[1]\n$bs[1]\n\n");
?>