Project

General

Profile

Download (4.53 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
 * status_gateways.php
4
 *
5
 * part of pfSense (https://www.pfsense.org)
6
 * Copyright (c) 2004-2013 BSD Perimeter
7
 * Copyright (c) 2013-2016 Electric Sheep Fencing
8
 * Copyright (c) 2014-2020 Rubicon Communications, LLC (Netgate)
9
 * Copyright (c) 2010 Seth Mos <seth.mos@dds.nl>
10
 * All rights reserved.
11
 *
12
 * Licensed under the Apache License, Version 2.0 (the "License");
13
 * you may not use this file except in compliance with the License.
14
 * You may obtain a copy of the License at
15
 *
16
 * http://www.apache.org/licenses/LICENSE-2.0
17
 *
18
 * Unless required by applicable law or agreed to in writing, software
19
 * distributed under the License is distributed on an "AS IS" BASIS,
20
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
 * See the License for the specific language governing permissions and
22
 * limitations under the License.
23
 */
24

    
25
##|+PRIV
26
##|*IDENT=page-status-gateways
27
##|*NAME=Status: Gateways
28
##|*DESCR=Allow access to the 'Status: Gateways' page.
29
##|*MATCH=status_gateways.php*
30
##|-PRIV
31

    
32
require_once("guiconfig.inc");
33

    
34
$a_gateways = return_gateways_array();
35
$gateways_status = return_gateways_status(true);
36

    
37
$pgtitle = array(gettext("Status"), gettext("Gateways"));
38
$pglinks = array("", "@self");
39
$shortcut_section = "gateways";
40
include("head.inc");
41

    
42
/* active tabs */
43
$tab_array = array();
44
$tab_array[] = array(gettext("Gateways"), true, "status_gateways.php");
45
$tab_array[] = array(gettext("Gateway Groups"), false, "status_gateway_groups.php");
46
display_top_tabs($tab_array);
47
?>
48
<div class="panel panel-default">
49
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('Gateways')?></h2></div>
50
	<div class="panel-body">
51

    
52
<div class="table-responsive">
53
	<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
54
		<thead>
55
			<tr>
56
				<th><?=gettext("Name"); ?></th>
57
				<th><?=gettext("Gateway"); ?></th>
58
				<th><?=gettext("Monitor"); ?></th>
59
				<th><?=gettext("RTT"); ?></th>
60
				<th><?=gettext("RTTsd"); ?></th>
61
				<th><?=gettext("Loss"); ?></th>
62
				<th><?=gettext("Status"); ?></th>
63
				<th><?=gettext("Description"); ?></th>
64
			</tr>
65
		</thead>
66
		<tbody>
67
<?php		foreach ($a_gateways as $i => $gateway) {
68
?>
69
			<tr>
70
				<td>
71
					<?=htmlspecialchars($gateway['name']);?>
72
<?php		
73
					if (isset($gateway['isdefaultgw'])) {
74
						echo " <strong>(default)</strong>";
75
					}
76
?>			
77
				</td>
78
				<td>
79
					<?=lookup_gateway_ip_by_name($i);?>
80
				</td>
81
				<td>
82
<?php
83
					if ($gateways_status[$i]) {
84
						if ($gateway['monitor_disable'] || ($gateway['monitorip'] == "none")) {
85
							echo "(unmonitored)";
86
						} else {
87
							echo $gateways_status[$i]['monitorip'];
88
						}
89
					}
90
?>
91
				</td>
92
				<td>
93
<?php
94
					if ($gateways_status[$i]) {
95
						if (!isset($gateway['monitor_disable'])) {
96
							echo $gateways_status[$i]['delay'];
97
						}
98
					} else {
99
						echo gettext("Pending");
100
					}
101
?>
102
				</td>
103
				<td>
104
<?php
105
					if ($gateways_status[$i]) {
106
						if (!isset($gateway['monitor_disable'])) {
107
							echo $gateways_status[$i]['stddev'];
108
						}
109
					} else {
110
						echo gettext("Pending");
111
					}
112
?>
113
				</td>
114
				<td>
115
<?php
116
					if ($gateways_status[$i]) {
117
						if (!isset($gateway['monitor_disable'])) {
118
							echo $gateways_status[$i]['loss'];
119
						}
120
					} else {
121
						echo gettext("Pending");
122
					}
123
?>
124
				</td>
125
<?php
126
					$status = $gateways_status[$i];
127
					switch ($status['status']) {
128
						case "force_down":
129
							$online = gettext("Offline (forced)");
130
							$bgcolor = "bg-danger";
131
							break;
132
						case "down":
133
							$online = gettext("Offline");
134
							$bgcolor = "bg-danger";
135
							break;
136
						case "highloss":
137
							$online = gettext("Danger, Packetloss") . ': ' . $status['loss'];
138
							$bgcolor = "bg-danger";
139
							break;
140
						case "loss":
141
							$online = gettext("Warning, Packetloss") . ': ' . $status['loss'];
142
							$bgcolor = "bg-warning";
143
							break;
144
						case "highdelay":
145
							$online = gettext("Danger, Latency") . ': ' . $status['delay'];
146
							$bgcolor = "bg-danger";
147
							break;
148
						case "delay":
149
							$online = gettext("Warning, Latency") . ': ' . $status['delay'];
150
							$bgcolor = "bg-warning";
151
							break;
152
						case "none":
153
							$online = gettext("Online");
154
							$bgcolor = "bg-success";
155
							break;
156
						default:
157
							$online = gettext("Pending");
158
							$bgcolor = "bg-info";
159
					}
160
?>
161
				<td class="<?=$bgcolor?>">
162
					<strong><?=$online?></strong>
163
				</td>
164
				<td>
165
					<?=htmlspecialchars($gateway['descr']); ?>
166
				</td>
167
			</tr>
168
<?php	} ?>	<!-- End-of-foreach -->
169
		</tbody>
170
	</table>
171
</div>
172

    
173
	</div>
174
</div>
175

    
176
<?php include("foot.inc"); ?>
(161-161/227)