From b21069b07582b7828edd781dfbcab72fbddc9c55 Mon Sep 17 00:00:00 2001 From: PiBa-NL Date: Sat, 21 Feb 2015 19:25:53 +0100 Subject: haproxy-devel, move files to subfolders --- .../www/widgets/widgets/haproxy.widget.php | 282 +++++++++++++++++++++ 1 file changed, 282 insertions(+) create mode 100644 config/haproxy-devel/www/widgets/widgets/haproxy.widget.php (limited to 'config/haproxy-devel/www/widgets') diff --git a/config/haproxy-devel/www/widgets/widgets/haproxy.widget.php b/config/haproxy-devel/www/widgets/widgets/haproxy.widget.php new file mode 100644 index 00000000..5d664e81 --- /dev/null +++ b/config/haproxy-devel/www/widgets/widgets/haproxy.widget.php @@ -0,0 +1,282 @@ +"; +$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 "
"; +?> + + + + \ No newline at end of file -- cgit v1.2.3