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 |
81299b5c
|
Renato Botelho
|
* Copyright (c) 2004-2016 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 |
a023d257
|
sbeaver
|
define('COLOR', true);
|
33 |
|
|
|
34 |
73e8bbe4
|
Seth Mos
|
$a_gateways = return_gateways_array();
|
35 |
ffd1a240
|
Seth Mos
|
$gateways_status = array();
|
36 |
68f291ff
|
Ermal
|
$gateways_status = return_gateways_status(true);
|
37 |
ffd1a240
|
Seth Mos
|
|
38 |
|
|
$now = time();
|
39 |
|
|
$year = date("Y");
|
40 |
|
|
|
41 |
f4741421
|
k-paulius
|
$pgtitle = array(gettext("Status"), gettext("Gateways"), gettext("Gateways"));
|
42 |
edcd7535
|
Phil Davis
|
$pglinks = array("", "@self", "@self");
|
43 |
b32dd0a6
|
jim-p
|
$shortcut_section = "gateways";
|
44 |
ffd1a240
|
Seth Mos
|
include("head.inc");
|
45 |
|
|
|
46 |
fff68385
|
sbeaver
|
/* active tabs */
|
47 |
|
|
$tab_array = array();
|
48 |
|
|
$tab_array[] = array(gettext("Gateways"), true, "status_gateways.php");
|
49 |
|
|
$tab_array[] = array(gettext("Gateway Groups"), false, "status_gateway_groups.php");
|
50 |
|
|
display_top_tabs($tab_array);
|
51 |
ffd1a240
|
Seth Mos
|
?>
|
52 |
ac950976
|
Colin Fleming
|
<div class="panel panel-default">
|
53 |
|
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext('Gateways')?></h2></div>
|
54 |
|
|
<div class="panel-body">
|
55 |
fff68385
|
sbeaver
|
|
56 |
961ffe14
|
sbeaver
|
<div class="table-responsive">
|
57 |
10fe1eb5
|
Stephen Beaver
|
<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
|
58 |
961ffe14
|
sbeaver
|
<thead>
|
59 |
|
|
<tr>
|
60 |
0843bc20
|
sbeaver
|
<th><?=gettext("Name"); ?></th>
|
61 |
|
|
<th><?=gettext("Gateway"); ?></th>
|
62 |
|
|
<th><?=gettext("Monitor"); ?></th>
|
63 |
|
|
<th><?=gettext("RTT"); ?></th>
|
64 |
b90e4de2
|
Denny Page
|
<th><?=gettext("RTTsd"); ?></th>
|
65 |
0843bc20
|
sbeaver
|
<th><?=gettext("Loss"); ?></th>
|
66 |
|
|
<th><?=gettext("Status"); ?></th>
|
67 |
|
|
<th><?=gettext("Description"); ?></th>
|
68 |
961ffe14
|
sbeaver
|
</tr>
|
69 |
|
|
</thead>
|
70 |
|
|
<tbody>
|
71 |
|
|
<?php foreach ($a_gateways as $gname => $gateway) {
|
72 |
fff68385
|
sbeaver
|
?>
|
73 |
961ffe14
|
sbeaver
|
<tr>
|
74 |
|
|
<td>
|
75 |
8ebf884f
|
jim-p
|
<?=htmlspecialchars($gateway['name']);?>
|
76 |
961ffe14
|
sbeaver
|
</td>
|
77 |
|
|
<td>
|
78 |
5c0ab3cd
|
NewEraCracker
|
<?=lookup_gateway_ip_by_name($gname);?>
|
79 |
961ffe14
|
sbeaver
|
</td>
|
80 |
|
|
<td>
|
81 |
3e0a4bbb
|
Phil Davis
|
<?php
|
82 |
|
|
if ($gateways_status[$gname]) {
|
83 |
961ffe14
|
sbeaver
|
echo $gateways_status[$gname]['monitorip'];
|
84 |
3e0a4bbb
|
Phil Davis
|
} else {
|
85 |
8ebf884f
|
jim-p
|
echo htmlspecialchars($gateway['monitorip']);
|
86 |
3e0a4bbb
|
Phil Davis
|
}
|
87 |
fff68385
|
sbeaver
|
?>
|
88 |
961ffe14
|
sbeaver
|
</td>
|
89 |
|
|
<td>
|
90 |
3e0a4bbb
|
Phil Davis
|
<?php
|
91 |
|
|
if ($gateways_status[$gname]) {
|
92 |
7ebc7c51
|
Chris Buechler
|
if (!isset($gateway['monitor_disable'])) {
|
93 |
|
|
echo $gateways_status[$gname]['delay'];
|
94 |
|
|
}
|
95 |
3e0a4bbb
|
Phil Davis
|
} else {
|
96 |
|
|
echo gettext("Pending");
|
97 |
|
|
}
|
98 |
fff68385
|
sbeaver
|
?>
|
99 |
961ffe14
|
sbeaver
|
</td>
|
100 |
|
|
<td>
|
101 |
b90e4de2
|
Denny Page
|
<?php
|
102 |
|
|
if ($gateways_status[$gname]) {
|
103 |
7ebc7c51
|
Chris Buechler
|
if (!isset($gateway['monitor_disable'])) {
|
104 |
|
|
echo $gateways_status[$gname]['stddev'];
|
105 |
|
|
}
|
106 |
b90e4de2
|
Denny Page
|
} else {
|
107 |
|
|
echo gettext("Pending");
|
108 |
|
|
}
|
109 |
|
|
?>
|
110 |
|
|
</td>
|
111 |
|
|
<td>
|
112 |
3e0a4bbb
|
Phil Davis
|
<?php
|
113 |
|
|
if ($gateways_status[$gname]) {
|
114 |
7ebc7c51
|
Chris Buechler
|
if (!isset($gateway['monitor_disable'])) {
|
115 |
|
|
echo $gateways_status[$gname]['loss'];
|
116 |
|
|
}
|
117 |
3e0a4bbb
|
Phil Davis
|
} else {
|
118 |
961ffe14
|
sbeaver
|
echo gettext("Pending");
|
119 |
3e0a4bbb
|
Phil Davis
|
}
|
120 |
961ffe14
|
sbeaver
|
?>
|
121 |
|
|
</td>
|
122 |
fff68385
|
sbeaver
|
<?php
|
123 |
961ffe14
|
sbeaver
|
if ($gateways_status[$gname]) {
|
124 |
|
|
$status = $gateways_status[$gname];
|
125 |
|
|
if (stristr($status['status'], "force_down")) {
|
126 |
|
|
$online = gettext("Offline (forced)");
|
127 |
5a331169
|
Jared Dillard
|
$bgcolor = "bg-danger";
|
128 |
961ffe14
|
sbeaver
|
} elseif (stristr($status['status'], "down")) {
|
129 |
|
|
$online = gettext("Offline");
|
130 |
5a331169
|
Jared Dillard
|
$bgcolor = "bg-danger";
|
131 |
f396d2b7
|
Phil Davis
|
} elseif (stristr($status['status'], "highloss")) {
|
132 |
|
|
$online = gettext("Danger, Packetloss") . ': ' . $status['loss'];
|
133 |
|
|
$bgcolor = "bg-danger";
|
134 |
961ffe14
|
sbeaver
|
} elseif (stristr($status['status'], "loss")) {
|
135 |
98128ad6
|
Phil Davis
|
$online = gettext("Warning, Packetloss") . ': ' . $status['loss'];
|
136 |
5a331169
|
Jared Dillard
|
$bgcolor = "bg-warning";
|
137 |
f396d2b7
|
Phil Davis
|
} elseif (stristr($status['status'], "highdelay")) {
|
138 |
|
|
$online = gettext("Danger, Latency") . ': ' . $status['delay'];
|
139 |
|
|
$bgcolor = "bg-danger";
|
140 |
961ffe14
|
sbeaver
|
} elseif (stristr($status['status'], "delay")) {
|
141 |
98128ad6
|
Phil Davis
|
$online = gettext("Warning, Latency") . ': ' . $status['delay'];
|
142 |
5a331169
|
Jared Dillard
|
$bgcolor = "bg-warning";
|
143 |
961ffe14
|
sbeaver
|
} elseif ($status['status'] == "none") {
|
144 |
0c5d4e8d
|
Phil Davis
|
if ($status['monitor_disable'] || ($status['monitorip'] == "none")) {
|
145 |
|
|
$online = gettext("Online (unmonitored)");
|
146 |
|
|
} else {
|
147 |
|
|
$online = gettext("Online");
|
148 |
|
|
}
|
149 |
5a331169
|
Jared Dillard
|
$bgcolor = "bg-success";
|
150 |
961ffe14
|
sbeaver
|
}
|
151 |
|
|
} else if (isset($gateway['monitor_disable'])) {
|
152 |
0c5d4e8d
|
Phil Davis
|
// Note: return_gateways_status() always returns an array entry for all gateways,
|
153 |
|
|
// so this "else if" never happens.
|
154 |
|
|
$online = gettext("Online (unmonitored)");
|
155 |
5a331169
|
Jared Dillard
|
$bgcolor = "bg-success";
|
156 |
961ffe14
|
sbeaver
|
} else {
|
157 |
|
|
$online = gettext("Pending");
|
158 |
5a331169
|
Jared Dillard
|
$bgcolor = "bg-info";
|
159 |
a023d257
|
sbeaver
|
}
|
160 |
961ffe14
|
sbeaver
|
|
161 |
|
|
$lastchange = $gateways_status[$gname]['lastcheck'];
|
162 |
|
|
|
163 |
3e0a4bbb
|
Phil Davis
|
if (!COLOR) {
|
164 |
5a331169
|
Jared Dillard
|
$bgcolor = "";
|
165 |
3e0a4bbb
|
Phil Davis
|
}
|
166 |
fff68385
|
sbeaver
|
?>
|
167 |
a023d257
|
sbeaver
|
|
168 |
5a331169
|
Jared Dillard
|
<td class="<?=$bgcolor?>">
|
169 |
961ffe14
|
sbeaver
|
<strong><?=$online?></strong> <?php
|
170 |
3e0a4bbb
|
Phil Davis
|
if (!empty($lastchange)) { ?>
|
171 |
98128ad6
|
Phil Davis
|
<br /><i><?=gettext("Last checked")?> <?=$lastchange?></i>
|
172 |
961ffe14
|
sbeaver
|
<?php } ?>
|
173 |
|
|
</td>
|
174 |
|
|
|
175 |
|
|
<td>
|
176 |
8ebf884f
|
jim-p
|
<?=htmlspecialchars($gateway['descr']); ?>
|
177 |
961ffe14
|
sbeaver
|
</td>
|
178 |
|
|
</tr>
|
179 |
|
|
<?php } ?> <!-- End-of-foreach -->
|
180 |
|
|
</tbody>
|
181 |
fff68385
|
sbeaver
|
</table>
|
182 |
|
|
</div>
|
183 |
|
|
|
184 |
ac950976
|
Colin Fleming
|
</div>
|
185 |
|
|
</div>
|
186 |
|
|
|
187 |
fff68385
|
sbeaver
|
<?php include("foot.inc"); ?>
|