Project

General

Profile

Download (4.44 KB) Statistics
| Branch: | Tag: | Revision:
1 ffd1a240 Seth Mos
<?php
2
/*
3 c5d81585 Renato Botelho
 * status_gateways.php
4 191cb31d Stephen Beaver
 *
5 c5d81585 Renato Botelho
 * part of pfSense (https://www.pfsense.org)
6 b8f91b7c Luiz Souza
 * Copyright (c) 2004-2018 Rubicon Communications, LLC (Netgate)
7 c5d81585 Renato Botelho
 * Copyright (c) 2010 Seth Mos <seth.mos@dds.nl>
8
 * All rights reserved.
9 191cb31d Stephen Beaver
 *
10 b12ea3fb Renato Botelho
 * Licensed under the Apache License, Version 2.0 (the "License");
11
 * you may not use this file except in compliance with the License.
12
 * You may obtain a copy of the License at
13 191cb31d Stephen Beaver
 *
14 b12ea3fb Renato Botelho
 * http://www.apache.org/licenses/LICENSE-2.0
15 191cb31d Stephen Beaver
 *
16 b12ea3fb Renato Botelho
 * Unless required by applicable law or agreed to in writing, software
17
 * distributed under the License is distributed on an "AS IS" BASIS,
18
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
 * See the License for the specific language governing permissions and
20
 * limitations under the License.
21 191cb31d Stephen Beaver
 */
22 ffd1a240 Seth Mos
23 6b07c15a Matthew Grooms
##|+PRIV
24
##|*IDENT=page-status-gateways
25 5230f468 jim-p
##|*NAME=Status: Gateways
26 6b07c15a Matthew Grooms
##|*DESCR=Allow access to the 'Status: Gateways' page.
27
##|*MATCH=status_gateways.php*
28
##|-PRIV
29
30 c81ef6e2 Phil Davis
require_once("guiconfig.inc");
31 ffd1a240 Seth Mos
32 73e8bbe4 Seth Mos
$a_gateways = return_gateways_array();
33 68f291ff Ermal
$gateways_status = return_gateways_status(true);
34 ffd1a240 Seth Mos
35 c2f7d555 luckman212
$pgtitle = array(gettext("Status"), gettext("Gateways"));
36
$pglinks = array("", "@self");
37 b32dd0a6 jim-p
$shortcut_section = "gateways";
38 ffd1a240 Seth Mos
include("head.inc");
39
40 fff68385 sbeaver
/* active tabs */
41
$tab_array = array();
42
$tab_array[] = array(gettext("Gateways"), true, "status_gateways.php");
43
$tab_array[] = array(gettext("Gateway Groups"), false, "status_gateway_groups.php");
44
display_top_tabs($tab_array);
45 ffd1a240 Seth Mos
?>
46 ac950976 Colin Fleming
<div class="panel panel-default">
47
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('Gateways')?></h2></div>
48
	<div class="panel-body">
49 fff68385 sbeaver
50 961ffe14 sbeaver
<div class="table-responsive">
51 10fe1eb5 Stephen Beaver
	<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
52 961ffe14 sbeaver
		<thead>
53
			<tr>
54 0843bc20 sbeaver
				<th><?=gettext("Name"); ?></th>
55
				<th><?=gettext("Gateway"); ?></th>
56
				<th><?=gettext("Monitor"); ?></th>
57
				<th><?=gettext("RTT"); ?></th>
58 b90e4de2 Denny Page
				<th><?=gettext("RTTsd"); ?></th>
59 0843bc20 sbeaver
				<th><?=gettext("Loss"); ?></th>
60
				<th><?=gettext("Status"); ?></th>
61
				<th><?=gettext("Description"); ?></th>
62 961ffe14 sbeaver
			</tr>
63
		</thead>
64
		<tbody>
65 c2f7d555 luckman212
<?php		foreach ($a_gateways as $i => $gateway) {
66 fff68385 sbeaver
?>
67 961ffe14 sbeaver
			<tr>
68
				<td>
69 8ebf884f jim-p
					<?=htmlspecialchars($gateway['name']);?>
70 c2f7d555 luckman212
<?php		
71
					if (isset($gateway['isdefaultgw'])) {
72
						echo " <strong>(default)</strong>";
73
					}
74
?>			
75 961ffe14 sbeaver
				</td>
76
				<td>
77 c2f7d555 luckman212
					<?=lookup_gateway_ip_by_name($i);?>
78 961ffe14 sbeaver
				</td>
79
				<td>
80 3e0a4bbb Phil Davis
<?php
81 c2f7d555 luckman212
					if ($gateways_status[$i]) {
82
						if ($gateway['monitor_disable'] || ($gateway['monitorip'] == "none")) {
83
							echo "(unmonitored)";
84
						} else {
85
							echo $gateways_status[$i]['monitorip'];
86
						}
87 3e0a4bbb Phil Davis
					}
88 fff68385 sbeaver
?>
89 961ffe14 sbeaver
				</td>
90
				<td>
91 3e0a4bbb Phil Davis
<?php
92 c2f7d555 luckman212
					if ($gateways_status[$i]) {
93 7ebc7c51 Chris Buechler
						if (!isset($gateway['monitor_disable'])) {
94 c2f7d555 luckman212
							echo $gateways_status[$i]['delay'];
95 179377b0 robjarsen
						}
96 3e0a4bbb Phil Davis
					} else {
97
						echo gettext("Pending");
98
					}
99 fff68385 sbeaver
?>
100 961ffe14 sbeaver
				</td>
101
				<td>
102 b90e4de2 Denny Page
<?php
103 c2f7d555 luckman212
					if ($gateways_status[$i]) {
104 7ebc7c51 Chris Buechler
						if (!isset($gateway['monitor_disable'])) {
105 c2f7d555 luckman212
							echo $gateways_status[$i]['stddev'];
106 7ebc7c51 Chris Buechler
						}
107 b90e4de2 Denny Page
					} else {
108
						echo gettext("Pending");
109
					}
110
?>
111
				</td>
112
				<td>
113 3e0a4bbb Phil Davis
<?php
114 c2f7d555 luckman212
					if ($gateways_status[$i]) {
115 7ebc7c51 Chris Buechler
						if (!isset($gateway['monitor_disable'])) {
116 c2f7d555 luckman212
							echo $gateways_status[$i]['loss'];
117 7ebc7c51 Chris Buechler
						}
118 3e0a4bbb Phil Davis
					} else {
119 961ffe14 sbeaver
						echo gettext("Pending");
120 3e0a4bbb Phil Davis
					}
121 961ffe14 sbeaver
?>
122
				</td>
123 fff68385 sbeaver
<?php
124 c2f7d555 luckman212
					$status = $gateways_status[$i];
125
					switch ($status['status']) {
126
						case "force_down":
127
							$online = gettext("Offline (forced)");
128
							$bgcolor = "bg-danger";
129
							break;
130
						case "down":
131
							$online = gettext("Offline");
132
							$bgcolor = "bg-danger";
133
							break;
134
						case "highloss":
135
							$online = gettext("Danger, Packetloss") . ': ' . $status['loss'];
136
							$bgcolor = "bg-danger";
137
							break;
138
						case "loss":
139
							$online = gettext("Warning, Packetloss") . ': ' . $status['loss'];
140
							$bgcolor = "bg-warning";
141
							break;
142
						case "highdelay":
143
							$online = gettext("Danger, Latency") . ': ' . $status['delay'];
144
							$bgcolor = "bg-danger";
145
							break;
146
						case "delay":
147
							$online = gettext("Warning, Latency") . ': ' . $status['delay'];
148
							$bgcolor = "bg-warning";
149
							break;
150
						case "none":
151 0c5d4e8d Phil Davis
							$online = gettext("Online");
152 c2f7d555 luckman212
							$bgcolor = "bg-success";
153
							break;
154
						default:
155
							$online = gettext("Pending");
156
							$bgcolor = "bg-info";
157 961ffe14 sbeaver
					}
158 fff68385 sbeaver
?>
159 5a331169 Jared Dillard
				<td class="<?=$bgcolor?>">
160 c2f7d555 luckman212
					<strong><?=$online?></strong>
161 961ffe14 sbeaver
				</td>
162
				<td>
163 8ebf884f jim-p
					<?=htmlspecialchars($gateway['descr']); ?>
164 961ffe14 sbeaver
				</td>
165
			</tr>
166
<?php	} ?>	<!-- End-of-foreach -->
167
		</tbody>
168 fff68385 sbeaver
	</table>
169
</div>
170
171 ac950976 Colin Fleming
	</div>
172
</div>
173
174 fff68385 sbeaver
<?php include("foot.inc"); ?>