Project

General

Profile

Download (5.63 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	status_gateways.php
5
	part of pfSense (https://www.pfsense.org/)
6

    
7
	Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>.
8
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
9
	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
/*	
33
	pfSense_MODULE:	routing
34
*/
35

    
36
##|+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
require("guiconfig.inc");
44

    
45
$a_gateways = return_gateways_array();
46
$gateways_status = array();
47
$gateways_status = return_gateways_status(true);
48

    
49
$now = time();
50
$year = date("Y");
51

    
52
$pgtitle = array(gettext("Status"),gettext("Gateways"));
53
$shortcut_section = "gateways";
54
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
        $tab_array[] = array(gettext("Gateways"), true, "status_gateways.php");
65
        $tab_array[] = array(gettext("Gateway Groups"), false, "status_gateway_groups.php");
66
        display_top_tabs($tab_array);
67
  ?>
68
  </td></tr>
69
  <tr>
70
    <td>
71
	<div id="mainarea">
72
              <table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0">
73
                <tr>
74
                  <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
                  <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
		</tr>
82
		  <?php foreach ($a_gateways as $gname => $gateway) {
83
			?>
84
                <tr>
85
                  <td class="listlr">
86
				<?=$gateway['name'];?>
87
                  </td>
88
                  <td class="listr" align="center" >
89
                                <?php echo lookup_gateway_ip_by_name($gname);?>
90
                  </td>
91
                  <td class="listr" align="center" >
92
                                <?php 	if ($gateways_status[$gname]) 
93
						echo $gateways_status[$gname]['monitorip'];
94
					else
95
						echo $gateway['monitorip'];
96
				?>
97
                  </td>
98
		<td class="listr" align="center">
99
		<?php	if ($gateways_status[$gname])
100
				echo $gateways_status[$gname]['delay'];
101
			else
102
				echo gettext("Pending");
103
		?>
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
				echo gettext("Pending");
111
		?>
112
				<?php $counter++; ?>
113
		</td>
114
                  <td class="listr" >
115
			<table border="0" cellpadding="0" cellspacing="2">
116
                        <?php
117
				if ($gateways_status[$gname]) {
118
					$status = $gateways_status[$gname];
119
					if (stristr($status['status'], "force_down")) {
120
						$online = gettext("Offline (forced)");
121
						$bgcolor = "#F08080";  // lightcoral
122
					} elseif (stristr($status['status'], "down")) {
123
						$online = gettext("Offline");
124
						$bgcolor = "#F08080";  // lightcoral
125
					} elseif (stristr($status['status'], "loss")) {
126
						$online = gettext("Warning, Packetloss").': '.$status['loss'];
127
						$bgcolor = "#F0E68C";  // khaki
128
					} elseif (stristr($status['status'], "delay")) {
129
						$online = gettext("Warning, Latency").': '.$status['delay'];
130
						$bgcolor = "#F0E68C";  // khaki
131
					} elseif ($status['status'] == "none") {
132
						$online = gettext("Online");
133
						$bgcolor = "#90EE90";  // lightgreen
134
					}
135
				} else if (isset($gateway['monitor_disable'])) {
136
						$online = gettext("Online");
137
						$bgcolor = "#90EE90";  // lightgreen
138
				} else {
139
					$online = gettext("Pending");
140
					$bgcolor = "#D3D3D3";  // lightgray
141
				}
142
				echo "<tr><td><table width='100%'><tr><td bgcolor=\"$bgcolor\">&nbsp;$online&nbsp;</td></tr><tr><td>";
143
				$lastchange = $gateways_status[$gname]['lastcheck'];
144
				if(!empty($lastchange)) {
145
					echo gettext("Last check:") . '<br />' . $lastchange;
146
				}
147
				echo "</td></tr></table></td></tr>";
148
                        ?>
149
			</table>
150
                  </td>
151
		  <td class="listbg"> <?=$gateway['descr']; ?></td>
152
                </tr>
153
		<?php } ?>
154
              </table>
155
	   </div>
156
</td></tr>
157
</table>
158

    
159
<?php include("fend.inc"); ?>
160
</body>
161
</html>
(185-185/252)