From e1e543c7c72c0bb498562a034d9b8eb5fd9d0231 Mon Sep 17 00:00:00 2001 From: Bill Marquette Date: Mon, 16 Jun 2008 05:15:17 +0000 Subject: Commit work in progress status screen - at least you can get up/down on your virtual servers now. --- usr/local/www/status_slbd_vs.php | 113 ++++++++++++++++++++++----------------- 1 file changed, 64 insertions(+), 49 deletions(-) (limited to 'usr/local/www/status_slbd_vs.php') diff --git a/usr/local/www/status_slbd_vs.php b/usr/local/www/status_slbd_vs.php index 3d86ceb..d722fe0 100755 --- a/usr/local/www/status_slbd_vs.php +++ b/usr/local/www/status_slbd_vs.php @@ -40,14 +40,60 @@ if (!is_array($config['load_balancer']['virtual_server'])) { $a_vs = &$config['load_balancer']['virtual_server']; $a_pool = &$config['load_balancer']['lbpool']; -$slbd_logfile = "{$g['varlog_path']}/slbd.log"; -$nentries = $config['syslog']['nentries']; -if (!$nentries) - $nentries = 50; -$now = time(); -$year = date("Y"); +// # relayctl show summary +// Id Type Name Avlblty Status +// 1 redirect testvs2 active +// 5 table test2:80 active (3 hosts up) +// 11 host 192.168.1.2 91.55% up +// 10 host 192.168.1.3 100.00% up +// 9 host 192.168.1.4 88.73% up +// 3 table test:80 active (1 hosts up) +// 7 host 192.168.1.2 66.20% down +// 6 host 192.168.1.3 97.18% up +// 0 redirect testvs active +// 3 table test:80 active (1 hosts up) +// 7 host 192.168.1.2 66.20% down +// 6 host 192.168.1.3 97.18% up +// 4 table testvs-sitedown:80 active (1 hosts up) +// 8 host 192.168.1.4 84.51% up +// # relayctl show redirects +// Id Type Name Avlblty Status +// 1 redirect testvs2 active +// 0 redirect testvs active +// # relayctl show redirects +// Id Type Name Avlblty Status +// 1 redirect testvs2 active +// total: 2 sessions +// last: 2/60s 2/h 2/d sessions +// average: 1/60s 0/h 0/d sessions +// 0 redirect testvs active + +$redirects_a = exec_command_and_return_text_array('/usr/local/sbin/relayctl show redirects'); +$summary_a = exec_command_and_return_text_array('/usr/local/sbin/relayctl show summary'); +$rdr_a = parse_redirects($redirects_a); +//$server_a = parse_summary($summary_a, parse_redirects($redirects_a)); + +function parse_redirects($rdr_a) { + $vs = array(); + for ($i = 0; isset($rdr_a[$i]); $i++) { + $line = $rdr_a[$i]; + if (preg_match("/^[0-9]+/", $line)) { + $regs = array(); + if($x = preg_match("/^[0-9]+\s+redirect\s+([0-9a-zA-Z]+)\s+([a-z]+)/", $line, $regs)) { + $vs[$regs[1]] = array(); + $vs[$regs[1]]['status'] = $regs[2]; + } + } + } + return $vs; +} + +function parse_summary($summary, $rdrs_a) { + $server_a = array(); + return $server_a; +} $pgtitle = array("Status","Load Balancer","Virtual Server"); include("head.inc"); @@ -91,55 +137,24 @@ include("head.inc"); foreach ($a_pool as $vipent) { if ($vipent['name'] == $vsent['pool']) { foreach ((array) $vipent['servers'] as $server) { - PRINT " {$server} "; + print " {$server} "; } } } ?> - - - "; - } - } - } - ?> -
$online "; - if($lastchange <> "") { - PRINT "Last change $lastchange"; - } else { - PRINT "No changes found in logfile"; - } - PRINT "
+ + + -- cgit v1.1