Project

General

Profile

Download (5.57 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	status_gateways.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_MODULE:	routing
34
*/
35

    
36
##|+PRIV
37
##|*IDENT=page-status-gateways
38
##|*NAME=Status: Gateways page
39
##|*DESCR=Allow access to the 'Status: Gateways' page.
40
##|*MATCH=status_gateways.php*
41
##|-PRIV
42

    
43
require("guiconfig.inc");
44

    
45
$a_gateways = return_gateways_array();
46
$gateways_status = array();
47
$gateways_status = return_gateways_status(true);
48

    
49
$now = time();
50
$year = date("Y");
51

    
52
$pgtitle = array(gettext("Status"), gettext("Gateways"));
53
$shortcut_section = "gateways";
54
include("head.inc");
55

    
56
?>
57
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
58
<?php include("fbegin.inc"); ?>
59
<table width="100%" border="0" cellpadding="0" cellspacing="0">
60
	<tr><td class="tabnavtbl">
61
  <?php
62
		/* active tabs */
63
		$tab_array = array();
64
		$tab_array[] = array(gettext("Gateways"), true, "status_gateways.php");
65
		$tab_array[] = array(gettext("Gateway Groups"), false, "status_gateway_groups.php");
66
		display_top_tabs($tab_array);
67
  ?>
68
	</td></tr>
69
	<tr>
70
		<td>
71
			<div id="mainarea">
72
				<table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0">
73
					<tr>
74
						<td width="10%" class="listhdrr"><?=gettext("Name"); ?></td>
75
						<td width="10%" class="listhdrr"><?=gettext("Gateway"); ?></td>
76
						<td width="10%" class="listhdrr"><?=gettext("Monitor"); ?></td>
77
						<td width="8%" class="listhdrr"><?=gettext("RTT"); ?></td>
78
						<td width="7%" class="listhdrr"><?=gettext("Loss"); ?></td>
79
						<td width="35%" class="listhdrr"><?=gettext("Status"); ?></td>
80
						<td width="20%" class="listhdr"><?=gettext("Description"); ?></td>
81
					</tr>
82
<?php
83
	foreach ($a_gateways as $gname => $gateway) {
84
?>
85
					<tr>
86
						<td class="listlr">
87
							<?=$gateway['name'];?>
88
						</td>
89
						<td class="listr" align="center" >
90
							<?php echo lookup_gateway_ip_by_name($gname);?>
91
						</td>
92
						<td class="listr" align="center" >
93
							<?php
94
								if ($gateways_status[$gname]) {
95
									echo $gateways_status[$gname]['monitorip'];
96
								} else {
97
									echo $gateway['monitorip'];
98
								}
99
							?>
100
						</td>
101
						<td class="listr" align="center">
102
							<?php
103
								if ($gateways_status[$gname]) {
104
									echo $gateways_status[$gname]['delay'];
105
								} else {
106
									echo gettext("Pending");
107
								}
108
							?>
109
						</td>
110
						<td class="listr" align="center">
111
							<?php
112
								if ($gateways_status[$gname]) {
113
									echo $gateways_status[$gname]['loss'];
114
								} else {
115
									echo gettext("Pending");
116
								}
117
							?>
118
						</td>
119
						<td class="listr" >
120
							<table border="0" cellpadding="0" cellspacing="2">
121
								<?php
122
									if ($gateways_status[$gname]) {
123
										$status = $gateways_status[$gname];
124
										if (stristr($status['status'], "force_down")) {
125
											$online = gettext("Offline (forced)");
126
											$bgcolor = "#F08080";  // lightcoral
127
										} elseif (stristr($status['status'], "down")) {
128
											$online = gettext("Offline");
129
											$bgcolor = "#F08080";  // lightcoral
130
										} elseif (stristr($status['status'], "loss")) {
131
											$online = gettext("Warning, Packetloss").': '.$status['loss'];
132
											$bgcolor = "#F0E68C";  // khaki
133
										} elseif (stristr($status['status'], "delay")) {
134
											$online = gettext("Warning, Latency").': '.$status['delay'];
135
											$bgcolor = "#F0E68C";  // khaki
136
										} elseif ($status['status'] == "none") {
137
											$online = gettext("Online");
138
											$bgcolor = "#90EE90";  // lightgreen
139
										}
140
									} else if (isset($gateway['monitor_disable'])) {
141
											$online = gettext("Online");
142
											$bgcolor = "#90EE90";  // lightgreen
143
									} else {
144
										$online = gettext("Pending");
145
										$bgcolor = "#D3D3D3";  // lightgray
146
									}
147
									echo "<tr><td><table width='100%'><tr><td bgcolor=\"$bgcolor\">&nbsp;$online&nbsp;</td></tr><tr><td>";
148
									$lastchange = $gateways_status[$gname]['lastcheck'];
149
									if (!empty($lastchange)) {
150
										echo gettext("Last check:") . '<br />' . $lastchange;
151
									}
152
									echo "</td></tr></table></td></tr>";
153
								?>
154
							</table>
155
						</td>
156
						<td class="listbg"> <?=$gateway['descr']; ?></td>
157
					</tr>
158
<?php
159
	} // foreach gateway
160
?>
161
				</table>
162
			</div>
163
		</td>
164
	</tr>
165
</table>
166

    
167
<?php include("fend.inc"); ?>
168
</body>
169
</html>
(185-185/252)