"; $in=""; $running=""; $stopped=""; $log=""; $start=""; $stop=""; $clients=array(); $clientstraffic=array(); $statistics = haproxy_get_statistics(); $frontends = $statistics['frontends']; $backends = $statistics['backends']; $servers = $statistics['servers']; if ($show_clients == "YES") { $clients = haproxy_get_clients($show_clients_traffic == "YES"); } if (!$getupdatestatus) { ?>
FrontEnd(s)"; print "Name"; print "Sessions
(cur/max)"; print "
Status
"; foreach ($frontends as $fe => $fedata){ print "".$fedata['pxname'].""; print "".$fedata['scur']." / ".$fedata['slim'].""; if ($fedata['status'] == "OPEN") { $fedata['status'] = $running." ".$fedata['status']; } else { $fedata['status'] = $stopped." ".$fedata['status']; } print "
".$fedata['status']."
"; } print ""; } #Backends/Servers w/o clients print "Backend(s)/Server(s)"; print "Backend(s)
 Server(s)"; if ($show_clients == "YES") { print "
  Client(s) addr:port"; } print ""; print "Sessions
(cur/max)
"; if ($show_clients == "YES" and $show_clients_traffic != "YES") { print "age/id"; } elseif ($show_clients == "YES" and $show_clients_traffic == "YES") { print "age/traffic i/o"; } print ""; print "
Status
/
Actions
"; foreach ($backends as $be => $bedata) { if ($bedata['status'] == "UP") { $statusicon = $in; $besess = $bedata['scur']." / ".$bedata['slim']; $bename = $bedata['pxname']; } else { $statusicon = $out; $besess = "".$bedata['status'].""; $bename = "".$bedata['pxname'].""; } $icondetails = " onmouseover=\"this.title='".$bedata['status']."'\""; print ""; print "".$bename.""; print "".$besess.""; print "
".$statusicon."
"; print " "; foreach ($servers as $srv => $srvdata) { if ($srvdata['pxname'] == $bedata['pxname']) { if ($srvdata['status'] == "UP") { $nextaction = "stop"; $statusicon = $in; $acticon = $stop; $srvname = $srvdata['svname']; } elseif ($srvdata['status'] == "no check") { $nextaction = "stop"; $statusicon = $in; $acticon = $stop; $srvname = $srvdata['svname']; $srvdata['scur'] = "no check"; } elseif ($srvdata['status'] == "MAINT") { $nextaction = "start"; $statusicon = $out; $acticon = $start; $srvname = "".$srvdata['svname'].""; $srvdata['scur'] = "".$srvdata['status'].""; } else { $nextaction = "stop"; $statusicon = $out; $acticon = $stop; $srvname = "".$srvdata['svname'].""; $srvdata['scur'] = "".$srvdata['status'].""; } $icondetails = " onmouseover=\"this.title='".$srvdata['status']."'\""; print " ".$srvname.""; print "".$srvdata['scur'].""; print "
".$statusicon."
"; print "
".$acticon."
"; if ($show_clients == "YES") { foreach ($clients as $cli => $clidata) { if ($clidata['be'] == $bedata['pxname'] && $clidata['srv'] == $srvdata['svname']) { print "  ".$clidata['src']." ".$log.""; if ($show_clients_traffic == "YES") { $clientstraffic[0] = format_bytes($clidata['session_datareq']); $clientstraffic[1] = format_bytes($clidata['session_datares']); print "".$clidata['age']." / ".$clientstraffic[0]." / ".$clientstraffic[1].""; } else { print "".$clidata['age']." / ".$clidata['sessid'].""; } } } } } } } echo ""; if (!$getupdatestatus) { echo "
"; ?>