Project

General

Profile

Download (5.46 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	status_lb_vs.php
5
	part of pfSense (https://www.pfsense.org/)
6

    
7
	Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>.
8
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
9
	All rights reserved.
10

    
11
	Redistribution and use in source and binary forms, with or without
12
	modification, are permitted provided that the following conditions are met:
13

    
14
	1. Redistributions of source code must retain the above copyright notice,
15
	   this list of conditions and the following disclaimer.
16

    
17
	2. Redistributions in binary form must reproduce the above copyright
18
	   notice, this list of conditions and the following disclaimer in the
19
	   documentation and/or other materials provided with the distribution.
20

    
21
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
22
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
23
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
25
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
	POSSIBILITY OF SUCH DAMAGE.
31
*/
32
/*
33
	pfSense_BUILDER_BINARIES:	/usr/local/sbin/relayctl
34
	pfSense_MODULE:	routing
35
*/
36

    
37
##|+PRIV
38
##|*IDENT=page-status-loadbalancer-virtualserver
39
##|*NAME=Status: Load Balancer: Virtual Server page
40
##|*DESCR=Allow access to the 'Status: Load Balancer: Virtual Server' page.
41
##|*MATCH=status_lb_vs.php*
42
##|-PRIV
43

    
44
require_once("guiconfig.inc");
45
require_once("vslb.inc");
46

    
47
if (!is_array($config['load_balancer']['lbpool'])) {
48
	$config['load_balancer']['lbpool'] = array();
49
}
50
if (!is_array($config['load_balancer']['virtual_server'])) {
51
	$config['load_balancer']['virtual_server'] = array();
52
}
53
$a_vs = &$config['load_balancer']['virtual_server'];
54
$a_pool = &$config['load_balancer']['lbpool'];
55
$rdr_a = get_lb_redirects();
56

    
57
$pgtitle = array(gettext("Status"),gettext("Load Balancer"),gettext("Virtual Server"));
58
include("head.inc");
59

    
60
?>
61
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
62
<?php include("fbegin.inc"); ?>
63
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="status load balancer virtual servers">
64
  <tr><td class="tabnavtbl">
65
  <?php
66
        /* active tabs */
67
        $tab_array = array();
68
        $tab_array[] = array(gettext("Pools"), false, "status_lb_pool.php");
69
        $tab_array[] = array(gettext("Virtual Servers"), true, "status_lb_vs.php");
70
        display_top_tabs($tab_array);
71
  ?>
72
  </td></tr>
73
  <tr>
74
    <td>
75
	<div id="mainarea">
76
              <table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
77
                <tr>
78
                  <td width="10%" class="listhdrr"><?=gettext("Name"); ?></td>
79
		  <td width="20%" class="listhdrr"><?=gettext("Address"); ?></td>
80
                  <td width="10%" class="listhdrr"><?=gettext("Servers"); ?></td>
81
                  <td width="25%" class="listhdrr"><?=gettext("Status"); ?></td>
82
                  <td width="25%" class="listhdr"><?=gettext("Description"); ?></td>
83
				</tr>
84
			  <?php $i = 0; foreach ($a_vs as $vsent): ?>
85
                <tr>
86
                  <td class="listlr">
87
				<?=$vsent['name'];?>
88
                  </td>
89
                  <td class="listr" align="center" >
90
                                <?=$vsent['ipaddr']." : ".$vsent['port'];?>
91
                                <br />
92
                  </td>
93
                  <td class="listr" align="center" >
94
			<table border="0" cellpadding="0" cellspacing="2" summary="servers">
95
                        <?php
96
			foreach ($a_pool as $vipent) {
97
				if ($vipent['name'] == $vsent['poolname']) {
98
					foreach ((array) $vipent['servers'] as $server) {
99
						print "<tr><td> {$server} </td></tr>";
100
					}
101
				}
102
			}
103
			?>
104
			</table>
105
                  </td>
106
                  <?php
107
                  switch (trim($rdr_a[$vsent['name']]['status'])) {
108
                    case 'active':
109
                      $bgcolor = "#90EE90";  // lightgreen
110
                      $rdr_a[$vsent['name']]['status'] = "Active";
111
                      break;
112
                    case 'down':
113
                      $bgcolor = "#F08080";  // lightcoral
114
                      $rdr_a[$vsent['name']]['status'] = "Down";
115
                      break;
116
                    default:
117
                      $bgcolor = "#D3D3D3";  // lightgray
118
                      $rdr_a[$vsent['name']]['status'] = 'Unknown - relayd not running?';
119
                  }
120
                  ?>
121
                  <td class="listr nowrap">
122
			<table border="0" cellpadding="3" cellspacing="2" summary="status">
123
				<tr><td bgcolor="<?=$bgcolor?>"><?=$rdr_a[$vsent['name']]['status']?> </td></tr>
124
			</table>
125
			<?php
126
			if (!empty($rdr_a[$vsent['name']]['total']))
127
				echo "Total Sessions: {$rdr_a[$vsent['name']]['total']}\n";
128
			if (!empty($rdr_a[$vsent['name']]['last']))
129
				echo "<br />Last: {$rdr_a[$vsent['name']]['last']}\n";
130
			if (!empty($rdr_a[$vsent['name']]['average']))
131
				echo "<br />Average: {$rdr_a[$vsent['name']]['average']}\n";
132
			?>
133
                  </td>
134
                  <td class="listbg" >
135
						<?=$vsent['descr'];?>
136
                  </td>
137
                </tr>
138
		<?php $i++; endforeach; ?>
139
             </table>
140
	   </div>
141
</td></tr>
142
</table>
143

    
144
<?php include("fend.inc"); ?>
145
</body>
146
</html>
(191-191/252)