Project

General

Profile

Download (5.1 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	status_slbd_pool.php
5
	part of pfSense (http://www.pfsense.com/)
6

    
7
	Copyright (C) 2006 Seth Mos <seth.mos@xs4all.nl>.
8
	All rights reserved.
9

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

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

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

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

    
32
require("guiconfig.inc");
33

    
34
if (!is_array($config['load_balancer']['lbpool'])) {
35
	$config['load_balancer']['lbpool'] = array();
36
}
37
$a_pool = &$config['load_balancer']['lbpool'];
38

    
39
$slbd_logfile = "{$g['varlog_path']}/slbd.log";
40

    
41
$apinger_status = return_apinger_status();
42

    
43
$nentries = $config['syslog']['nentries'];
44
if (!$nentries)
45
        $nentries = 50;
46

    
47
$now = time();
48
$year = date("Y");
49

    
50
$pgtitle = "Status: Load Balancer: Pool";
51
include("head.inc");
52

    
53
?>
54
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
55
<?php include("fbegin.inc"); ?>
56
<p class="pgtitle"><?=$pgtitle?></p>
57
<table width="100%" border="0" cellpadding="0" cellspacing="0">
58
  <tr><td class="tabnavtbl">
59
  <?php
60
        /* active tabs */
61
        $tab_array = array();
62
        $tab_array[] = array("Pools", true, "status_slbd_pool.php");
63
        $tab_array[] = array("Virtual Servers", false, "status_slbd_vs.php");
64
        display_top_tabs($tab_array);
65
  ?>
66
  </td></tr>
67
  <tr>
68
    <td>
69
	<div id="mainarea">
70
              <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
71
                <tr>
72
                  <td width="10%" class="listhdrr">Name</td>
73
		  <td width="10%" class="listhdrr">Type</td>
74
                  <td width="10%" class="listhdrr">Gateways</td>
75
                  <td width="30%" class="listhdrr">Status</td>
76
                  <td width="30%" class="listhdr">Description</td>
77
				</tr>
78
			  <?php $i = 0; foreach ($a_pool as $vipent):
79
				if ($vipent['type'] == "gateway") {
80
			  ?>
81
                <tr>
82
                  <td class="listlr">
83
				<?=$vipent['name'];?>
84
                  </td>
85
                  <td class="listr" align="center" >
86
                                <?=$vipent['type'];?>
87
                                <br />
88
                                (<?=$vipent['behaviour'];?>)
89
                  </td>
90
                  <td class="listr" align="center" >
91
			<table border="0" cellpadding="0" cellspacing="2">
92
                        <?php
93
                                foreach ((array) $vipent['servers'] as $server) {
94
                                        $svr = split("\|", $server);
95
					PRINT "<tr><td> {$svr[0]} </td></tr>";
96
                                }
97
                        ?>
98
			</table>
99
                  </td>
100
                  <td class="listr" >
101
			<table border="0" cellpadding="0" cellspacing="2">
102
                        <?php
103
				if ($vipent['type'] == "gateway") {
104
                                        foreach ((array) $vipent['servers'] as $server) {
105
                                                $svr = split("\|", $server);
106
						$monitorip = $svr[1];
107

    
108
						if(preg_match("/down/i", $apinger_status[$monitorip]['status'])) {
109
							$online = "Offline";
110
							$bgcolor = "lightcoral";
111
						} elseif(preg_match("/delay/i", $apinger_status[$monitorip]['status'])) {
112
							$online = "Warning";
113
							$bgcolor = "khaki";
114
						} elseif(preg_match("/loss/i", $apinger_status[$monitorip]['status'])) {
115
							$online = "Warning";
116
							$bgcolor = "khaki";
117
						} elseif(preg_match("/none/i", $apinger_status[$monitorip]['status'])) {
118
							$online = "Online";
119
							$bgcolor = "lightgreen";
120
						}
121
					PRINT "<tr><td bgcolor=\"$bgcolor\" > $online </td><td>";
122
					PRINT "Delay: {$apinger_status[$monitorip]['delay']}, ";
123
					PRINT "Loss: {$apinger_status[$monitorip]['loss']}";
124
					PRINT "</td></tr>";
125
					}
126
                                } else {
127
					PRINT "<tr><td> {$vipent['monitor']} </td></tr>";
128
                                }
129
                        ?>
130
			</table>
131
                  </td>
132
                  <td class="listbg" >
133
				<font color="#FFFFFF"><?=$vipent['desc'];?></font>
134
                  </td>
135
                </tr>
136
		<?php
137
			}
138
			$i++;
139
		 endforeach;
140
		 ?>
141
              </table>
142
	   </div>
143
	</table>
144

    
145
<?php include("fend.inc"); ?>
146
</body>
147
</html>
(134-134/175)