From 7804046877f31f93a387f331cf5bff4bbd72a415 Mon Sep 17 00:00:00 2001 From: Marcello Coutinho Date: Wed, 14 Dec 2011 02:37:31 -0200 Subject: varnish - change varnish-dev to varnish3 with streaming support --- config/varnish3/varnish.widget.php | 126 +++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100755 config/varnish3/varnish.widget.php (limited to 'config/varnish3/varnish.widget.php') diff --git a/config/varnish3/varnish.widget.php b/config/varnish3/varnish.widget.php new file mode 100755 index 00000000..f2b68aec --- /dev/null +++ b/config/varnish3/varnish.widget.php @@ -0,0 +1,126 @@ +"; + 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"
"; + +?> + -- cgit v1.2.3