Project

General

Profile

Download (5.02 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-2021 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
					if (stristr($status['status'], "online")) {
128
						switch ($status['substatus']) {
129
							case "highloss":
130
								$online = gettext("Danger, Packetloss") . ': ' . $status['loss'];
131
								$bgcolor = "bg-danger";
132
								break;
133
							case "highdelay":
134
								$online = gettext("Danger, Latency") . ': ' . $status['delay'];
135
								$bgcolor = "bg-danger";
136
								break;
137
							case "loss":
138
								$online = gettext("Warning, Packetloss") . ': ' . $status['loss'];
139
								$bgcolor = "bg-warning";
140
								break;
141
							case "delay":
142
								$online = gettext("Warning, Latency") . ': ' . $status['delay'];
143
								$bgcolor = "bg-warning";
144
								break;
145
							default:
146
								if ($status['monitor_disable'] || ($status['monitorip'] == "none")) {
147
									$online = gettext("Online <br/>(unmonitored)");
148
								} else {
149
									$online = gettext("Online");
150
								}
151
								$bgcolor = "bg-success";
152
						}
153
					} elseif (stristr($status['status'], "down")) {
154
						$bgcolor = "bg-danger";
155
						switch ($status['substatus']) {
156
							case "force_down":
157
								$online = gettext("Offline (forced)");
158
								break;
159
							case "highloss":
160
								$online = gettext("Offline, Packetloss") . ': ' . $status['loss'];
161
								break;
162
							case "highdelay":
163
								$online = gettext("Offline, Latency") . ': ' . $status['delay'];
164
								break;
165
							default:
166
								$online = gettext("Offline");
167
						}
168
					} else {
169
						$online = gettext("Pending");
170
						$bgcolor = "bg-info";
171
					}
172
?>
173
				<td class="<?=$bgcolor?>">
174
					<strong><?=$online?></strong>
175
				</td>
176
				<td>
177
					<?=htmlspecialchars($gateway['descr']); ?>
178
				</td>
179
			</tr>
180
<?php	} ?>	<!-- End-of-foreach -->
181
		</tbody>
182
	</table>
183
</div>
184

    
185
	</div>
186
</div>
187

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