Project

General

Profile

Download (4.44 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-2018 Rubicon Communications, LLC (Netgate)
7
 * Copyright (c) 2010 Seth Mos <seth.mos@dds.nl>
8
 * All rights reserved.
9
 *
10
 * 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
 *
14
 * http://www.apache.org/licenses/LICENSE-2.0
15
 *
16
 * 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
 */
22

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

    
30
require_once("guiconfig.inc");
31

    
32
$a_gateways = return_gateways_array();
33
$gateways_status = return_gateways_status(true);
34

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

    
40
/* 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
?>
46
<div class="panel panel-default">
47
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('Gateways')?></h2></div>
48
	<div class="panel-body">
49

    
50
<div class="table-responsive">
51
	<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
52
		<thead>
53
			<tr>
54
				<th><?=gettext("Name"); ?></th>
55
				<th><?=gettext("Gateway"); ?></th>
56
				<th><?=gettext("Monitor"); ?></th>
57
				<th><?=gettext("RTT"); ?></th>
58
				<th><?=gettext("RTTsd"); ?></th>
59
				<th><?=gettext("Loss"); ?></th>
60
				<th><?=gettext("Status"); ?></th>
61
				<th><?=gettext("Description"); ?></th>
62
			</tr>
63
		</thead>
64
		<tbody>
65
<?php		foreach ($a_gateways as $i => $gateway) {
66
?>
67
			<tr>
68
				<td>
69
					<?=htmlspecialchars($gateway['name']);?>
70
<?php		
71
					if (isset($gateway['isdefaultgw'])) {
72
						echo " <strong>(default)</strong>";
73
					}
74
?>			
75
				</td>
76
				<td>
77
					<?=lookup_gateway_ip_by_name($i);?>
78
				</td>
79
				<td>
80
<?php
81
					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
					}
88
?>
89
				</td>
90
				<td>
91
<?php
92
					if ($gateways_status[$i]) {
93
						if (!isset($gateway['monitor_disable'])) {
94
							echo $gateways_status[$i]['delay'];
95
						}
96
					} else {
97
						echo gettext("Pending");
98
					}
99
?>
100
				</td>
101
				<td>
102
<?php
103
					if ($gateways_status[$i]) {
104
						if (!isset($gateway['monitor_disable'])) {
105
							echo $gateways_status[$i]['stddev'];
106
						}
107
					} else {
108
						echo gettext("Pending");
109
					}
110
?>
111
				</td>
112
				<td>
113
<?php
114
					if ($gateways_status[$i]) {
115
						if (!isset($gateway['monitor_disable'])) {
116
							echo $gateways_status[$i]['loss'];
117
						}
118
					} else {
119
						echo gettext("Pending");
120
					}
121
?>
122
				</td>
123
<?php
124
					$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
							$online = gettext("Online");
152
							$bgcolor = "bg-success";
153
							break;
154
						default:
155
							$online = gettext("Pending");
156
							$bgcolor = "bg-info";
157
					}
158
?>
159
				<td class="<?=$bgcolor?>">
160
					<strong><?=$online?></strong>
161
				</td>
162
				<td>
163
					<?=htmlspecialchars($gateway['descr']); ?>
164
				</td>
165
			</tr>
166
<?php	} ?>	<!-- End-of-foreach -->
167
		</tbody>
168
	</table>
169
</div>
170

    
171
	</div>
172
</div>
173

    
174
<?php include("foot.inc"); ?>
(167-167/234)