Project

General

Profile

Download (5.63 KB) Statistics
| Branch: | Tag: | Revision:
1 ffd1a240 Seth Mos
<?php
2
/* $Id$ */
3
/*
4
	status_gateways.php
5 c7281770 Chris Buechler
	part of pfSense (https://www.pfsense.org/)
6 ffd1a240 Seth Mos
7 6216690b smos
	Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>.
8 ce77a9c4 Phil Davis
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
9 ffd1a240 Seth Mos
	All rights reserved.
10
11
	Redistribution and use in source and binary forms, with or without
12
	modification, are permitted provided that the following conditions are met:
13
14
	1. Redistributions of source code must retain the above copyright notice,
15
	   this list of conditions and the following disclaimer.
16
17
	2. Redistributions in binary form must reproduce the above copyright
18
	   notice, this list of conditions and the following disclaimer in the
19
	   documentation and/or other materials provided with the distribution.
20
21
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
22
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
23
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
25
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
	POSSIBILITY OF SUCH DAMAGE.
31
*/
32 1d333258 Scott Ullrich
/*	
33
	pfSense_MODULE:	routing
34
*/
35 ffd1a240 Seth Mos
36 6b07c15a Matthew Grooms
##|+PRIV
37
##|*IDENT=page-status-gateways
38
##|*NAME=Status: Gateways page
39
##|*DESCR=Allow access to the 'Status: Gateways' page.
40
##|*MATCH=status_gateways.php*
41
##|-PRIV
42
43 ffd1a240 Seth Mos
require("guiconfig.inc");
44
45 73e8bbe4 Seth Mos
$a_gateways = return_gateways_array();
46 ffd1a240 Seth Mos
$gateways_status = array();
47 68f291ff Ermal
$gateways_status = return_gateways_status(true);
48 ffd1a240 Seth Mos
49
$now = time();
50
$year = date("Y");
51
52 b8e27fbb Carlos Eduardo Ramos
$pgtitle = array(gettext("Status"),gettext("Gateways"));
53 b32dd0a6 jim-p
$shortcut_section = "gateways";
54 ffd1a240 Seth Mos
include("head.inc");
55
56
?>
57
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
58
<?php include("fbegin.inc"); ?>
59
<table width="100%" border="0" cellpadding="0" cellspacing="0">
60
  <tr><td class="tabnavtbl">
61
  <?php
62
        /* active tabs */
63
        $tab_array = array();
64 b8e27fbb Carlos Eduardo Ramos
        $tab_array[] = array(gettext("Gateways"), true, "status_gateways.php");
65
        $tab_array[] = array(gettext("Gateway Groups"), false, "status_gateway_groups.php");
66 ffd1a240 Seth Mos
        display_top_tabs($tab_array);
67
  ?>
68
  </td></tr>
69
  <tr>
70
    <td>
71
	<div id="mainarea">
72 3473bb6a Scott Ullrich
              <table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0">
73 ffd1a240 Seth Mos
                <tr>
74 b8e27fbb Carlos Eduardo Ramos
                  <td width="10%" class="listhdrr"><?=gettext("Name"); ?></td>
75
                  <td width="10%" class="listhdrr"><?=gettext("Gateway"); ?></td>
76
                  <td width="10%" class="listhdrr"><?=gettext("Monitor"); ?></td>
77 76db94c2 jim-p
                  <td width="8%" class="listhdrr"><?=gettext("RTT"); ?></td>
78
                  <td width="7%" class="listhdrr"><?=gettext("Loss"); ?></td>
79
                  <td width="35%" class="listhdrr"><?=gettext("Status"); ?></td>
80
                  <td width="20%" class="listhdr"><?=gettext("Description"); ?></td>
81 68f291ff Ermal
		</tr>
82
		  <?php foreach ($a_gateways as $gname => $gateway) {
83 9a21b547 Seth Mos
			?>
84 ffd1a240 Seth Mos
                <tr>
85
                  <td class="listlr">
86 6f77aca5 Ermal
				<?=$gateway['name'];?>
87 ffd1a240 Seth Mos
                  </td>
88
                  <td class="listr" align="center" >
89 68f291ff Ermal
                                <?php echo lookup_gateway_ip_by_name($gname);?>
90 ffd1a240 Seth Mos
                  </td>
91
                  <td class="listr" align="center" >
92 68f291ff Ermal
                                <?php 	if ($gateways_status[$gname]) 
93
						echo $gateways_status[$gname]['monitorip'];
94
					else
95
						echo $gateway['monitorip'];
96
				?>
97 ffd1a240 Seth Mos
                  </td>
98 fc4fa6de jim-p
		<td class="listr" align="center">
99
		<?php	if ($gateways_status[$gname])
100
				echo $gateways_status[$gname]['delay'];
101
			else
102 603f19f0 smos
				echo gettext("Pending");
103 fc4fa6de jim-p
		?>
104
				<?php $counter++; ?>
105
		</td>
106
		<td class="listr" align="center">
107
		<?php	if ($gateways_status[$gname])
108
				echo $gateways_status[$gname]['loss'];
109
			else
110 603f19f0 smos
				echo gettext("Pending");
111 fc4fa6de jim-p
		?>
112
				<?php $counter++; ?>
113
		</td>
114 ffd1a240 Seth Mos
                  <td class="listr" >
115
			<table border="0" cellpadding="0" cellspacing="2">
116
                        <?php
117 68f291ff Ermal
				if ($gateways_status[$gname]) {
118
					$status = $gateways_status[$gname];
119 81f19476 Renato Botelho
					if (stristr($status['status'], "force_down")) {
120
						$online = gettext("Offline (forced)");
121
						$bgcolor = "#F08080";  // lightcoral
122
					} elseif (stristr($status['status'], "down")) {
123 68f291ff Ermal
						$online = gettext("Offline");
124 a0c0e8ae Colin Fleming
						$bgcolor = "#F08080";  // lightcoral
125 68f291ff Ermal
					} elseif (stristr($status['status'], "loss")) {
126 76db94c2 jim-p
						$online = gettext("Warning, Packetloss").': '.$status['loss'];
127 a0c0e8ae Colin Fleming
						$bgcolor = "#F0E68C";  // khaki
128 68f291ff Ermal
					} elseif (stristr($status['status'], "delay")) {
129 76db94c2 jim-p
						$online = gettext("Warning, Latency").': '.$status['delay'];
130 a0c0e8ae Colin Fleming
						$bgcolor = "#F0E68C";  // khaki
131 68f291ff Ermal
					} elseif ($status['status'] == "none") {
132
						$online = gettext("Online");
133 a0c0e8ae Colin Fleming
						$bgcolor = "#90EE90";  // lightgreen
134 68f291ff Ermal
					}
135 db07cc25 Ermal
				} else if (isset($gateway['monitor_disable'])) {
136
						$online = gettext("Online");
137 a0c0e8ae Colin Fleming
						$bgcolor = "#90EE90";  // lightgreen
138 68f291ff Ermal
				} else {
139 603f19f0 smos
					$online = gettext("Pending");
140 a0c0e8ae Colin Fleming
					$bgcolor = "#D3D3D3";  // lightgray
141 ffd1a240 Seth Mos
				}
142 a0c0e8ae Colin Fleming
				echo "<tr><td><table width='100%'><tr><td bgcolor=\"$bgcolor\">&nbsp;$online&nbsp;</td></tr><tr><td>";
143 76db94c2 jim-p
				$lastchange = $gateways_status[$gname]['lastcheck'];
144 73e8bbe4 Seth Mos
				if(!empty($lastchange)) {
145 8cd558b6 ayvis
					echo gettext("Last check:") . '<br />' . $lastchange;
146 73e8bbe4 Seth Mos
				}
147 76db94c2 jim-p
				echo "</td></tr></table></td></tr>";
148 ffd1a240 Seth Mos
                        ?>
149
			</table>
150
                  </td>
151 68f291ff Ermal
		  <td class="listbg"> <?=$gateway['descr']; ?></td>
152 ffd1a240 Seth Mos
                </tr>
153 9a21b547 Seth Mos
		<?php } ?>
154 ffd1a240 Seth Mos
              </table>
155
	   </div>
156 2a74f9d7 Colin Fleming
</td></tr>
157
</table>
158 ffd1a240 Seth Mos
159
<?php include("fend.inc"); ?>
160
</body>
161
</html>