1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
status_gateways.php
|
5
|
part of pfSense (http://www.pfsense.com/)
|
6
|
|
7
|
Copyright (C) 2010 Seth Mos <seth.mos@dds.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
|
pfSense_MODULE: routing
|
33
|
*/
|
34
|
|
35
|
##|+PRIV
|
36
|
##|*IDENT=page-status-gateways
|
37
|
##|*NAME=Status: Gateways page
|
38
|
##|*DESCR=Allow access to the 'Status: Gateways' page.
|
39
|
##|*MATCH=status_gateways.php*
|
40
|
##|-PRIV
|
41
|
|
42
|
require("guiconfig.inc");
|
43
|
|
44
|
$a_gateways = return_gateways_array();
|
45
|
$gateways_status = array();
|
46
|
$gateways_status = return_gateways_status();
|
47
|
|
48
|
$now = time();
|
49
|
$year = date("Y");
|
50
|
|
51
|
$pgtitle = array(gettext("Status"),gettext("Gateways"));
|
52
|
include("head.inc");
|
53
|
|
54
|
?>
|
55
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
56
|
<?php include("fbegin.inc"); ?>
|
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(gettext("Gateways"), true, "status_gateways.php");
|
63
|
$tab_array[] = array(gettext("Gateway Groups"), false, "status_gateway_groups.php");
|
64
|
display_top_tabs($tab_array);
|
65
|
?>
|
66
|
</td></tr>
|
67
|
<tr>
|
68
|
<td>
|
69
|
<div id="mainarea">
|
70
|
<table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0">
|
71
|
<tr>
|
72
|
<td width="10%" class="listhdrr"><?=gettext("Name"); ?></td>
|
73
|
<td width="10%" class="listhdrr"><?=gettext("Gateway"); ?></td>
|
74
|
<td width="10%" class="listhdrr"><?=gettext("Monitor"); ?></td>
|
75
|
<td width="30%" class="listhdrr"><?=gettext("Status"); ?></td>
|
76
|
<td width="30%" class="listhdr"><?=gettext("Description"); ?></td>
|
77
|
</tr>
|
78
|
<?php foreach ($gateways_status as $target => $gateway) {
|
79
|
?>
|
80
|
<tr>
|
81
|
<td class="listlr">
|
82
|
<?=$gateway['name'];?>
|
83
|
</td>
|
84
|
<td class="listr" align="center" >
|
85
|
<?php echo lookup_gateway_ip_by_name($gateway['name']);?>
|
86
|
</td>
|
87
|
<td class="listr" align="center" >
|
88
|
<?=$target;?>
|
89
|
</td>
|
90
|
<td class="listr" >
|
91
|
<table border="0" cellpadding="0" cellspacing="2">
|
92
|
<?php
|
93
|
if (stristr($gateway['status'], "down")) {
|
94
|
$online = gettext("Offline");
|
95
|
$bgcolor = "lightcoral";
|
96
|
} elseif (stristr($gateway['status'], "loss")) {
|
97
|
$online = gettext("Warning, Packetloss");
|
98
|
$bgcolor = "khaki";
|
99
|
} elseif (stristr($gateway['status'], "delay")) {
|
100
|
$online = gettext("Warning, Latency");
|
101
|
$bgcolor = "khaki";
|
102
|
} elseif ($gateway['status'] == "none") {
|
103
|
$online = gettext("Online");
|
104
|
$bgcolor = "lightgreen";
|
105
|
}
|
106
|
echo "<tr><td bgcolor=\"$bgcolor\" > $online </td><td>";
|
107
|
$lastchange = $gateway['lastcheck'];
|
108
|
if(!empty($lastchange)) {
|
109
|
$lastchange = explode(" ", $lastchange);
|
110
|
array_shift($lastchange);
|
111
|
array_shift($lastchange);
|
112
|
$lastchange = implode(" ", $lastchange);
|
113
|
printf(gettext("Last check %s"), $lastchange);
|
114
|
} else {
|
115
|
echo gettext("Gathering data");
|
116
|
}
|
117
|
echo "</td></tr>";
|
118
|
?>
|
119
|
</table>
|
120
|
</td>
|
121
|
<td class="listbg"> <?=$a_gateways[$gateway['name']]['descr']; ?></td>
|
122
|
</tr>
|
123
|
<?php } ?>
|
124
|
</table>
|
125
|
</div>
|
126
|
</table>
|
127
|
|
128
|
<?php include("fend.inc"); ?>
|
129
|
</body>
|
130
|
</html>
|