";
echo"
";
}
function close_table(){
echo"
";
echo"";
echo "
";
}
$pfb_table=array();
$img['Sick']="";
$img['Healthy']="";
#var_dump($pfb_table);
#exit;
?>";
print "
Cache hits | ";
print "Cache hits pass | ";
print "Cache Missed | ";
$backends=exec("varnishadm -T " . escapeshellarg($mgm) . " stats",$debug);
foreach ($debug as $line){
if (preg_match("/(\d+)\s+Cache\s+(hits.for|hits|misses)/",$line,$matches))
$cache[preg_replace("/\s+/","",$matches[2])]=$matches[1];
if (preg_match("/(\d+)\s+Client\s+(\w+)/",$line,$matches))
$client[$matches[2]]=$matches[1];
}
print "".$cache['hits'] ." | ";
print "".$cache['hitsfor'] ." | ";
print "".$cache['misses']." | ";
close_table();
open_table();
print "Conn. Accepted | ";
print "Req. received | ";
print "Uptime | ";
print "".$client['connections'] ." | ";
print "".$client['requests'] ." | ";
print "".$client['uptime']." | ";
close_table();
open_table();
print "Backend | ";
print "LB applied | ";
print "Status | ";
if (is_array($config['installedpackages']['varnishlbdirectors']['config']))
foreach($config['installedpackages']['varnishlbdirectors']['config'] as $lb){
foreach ($lb['row'] as $lb_backend){
${$lb_backend['backendname']}++;
}
}
$backends=exec("varnishadm -T " . escapeshellarg($mgm) . " debug.health",$debug);
foreach ($debug as $line){
if (preg_match("/Backend (.*) is (\w+)/",$line,$matches)){
$backend=preg_replace("/BACKEND$/","",$matches[1]);
print "". $backend ." | ";
print "". ${$backend} ." | ";
print "".$img[$matches[2]]." | ";
}
}
}
else{
print "Varnish Managment interface not set in config. | ";
}
echo" ";
echo"";
?>