Project

General

Profile

Download (5.58 KB) Statistics
| Branch: | Tag: | Revision:

univnautes / usr / local / www / status_gateways.php @ a1b66bec

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
	All rights reserved.
9

    
10
	Redistribution and use in source and binary forms, with or without
11
	modification, are permitted provided that the following conditions are met:
12

    
13
	1. Redistributions of source code must retain the above copyright notice,
14
	   this list of conditions and the following disclaimer.
15

    
16
	2. Redistributions in binary form must reproduce the above copyright
17
	   notice, this list of conditions and the following disclaimer in the
18
	   documentation and/or other materials provided with the distribution.
19

    
20
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
24
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
	POSSIBILITY OF SUCH DAMAGE.
30
*/
31
/*	
32
	pfSense_MODULE:	routing
33
*/
34

    
35
##|+PRIV
36
##|*IDENT=page-status-gateways
37
##|*NAME=Status: Gateways page
38
##|*DESCR=Allow access to the 'Status: Gateways' page.
39
##|*MATCH=status_gateways.php*
40
##|-PRIV
41

    
42
require("guiconfig.inc");
43

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

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

    
51
$pgtitle = array(gettext("Status"),gettext("Gateways"));
52
$shortcut_section = "gateways";
53
include("head.inc");
54

    
55
?>
56
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
57
<?php include("fbegin.inc"); ?>
58
<table width="100%" border="0" cellpadding="0" cellspacing="0">
59
  <tr><td class="tabnavtbl">
60
  <?php
61
        /* active tabs */
62
        $tab_array = array();
63
        $tab_array[] = array(gettext("Gateways"), true, "status_gateways.php");
64
        $tab_array[] = array(gettext("Gateway Groups"), false, "status_gateway_groups.php");
65
        display_top_tabs($tab_array);
66
  ?>
67
  </td></tr>
68
  <tr>
69
    <td>
70
	<div id="mainarea">
71
              <table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0">
72
                <tr>
73
                  <td width="10%" class="listhdrr"><?=gettext("Name"); ?></td>
74
                  <td width="10%" class="listhdrr"><?=gettext("Gateway"); ?></td>
75
                  <td width="10%" class="listhdrr"><?=gettext("Monitor"); ?></td>
76
                  <td width="8%" class="listhdrr"><?=gettext("RTT"); ?></td>
77
                  <td width="7%" class="listhdrr"><?=gettext("Loss"); ?></td>
78
                  <td width="35%" class="listhdrr"><?=gettext("Status"); ?></td>
79
                  <td width="20%" class="listhdr"><?=gettext("Description"); ?></td>
80
		</tr>
81
		  <?php foreach ($a_gateways as $gname => $gateway) {
82
			?>
83
                <tr>
84
                  <td class="listlr">
85
				<?=$gateway['name'];?>
86
                  </td>
87
                  <td class="listr" align="center" >
88
                                <?php echo lookup_gateway_ip_by_name($gname);?>
89
                  </td>
90
                  <td class="listr" align="center" >
91
                                <?php 	if ($gateways_status[$gname]) 
92
						echo $gateways_status[$gname]['monitorip'];
93
					else
94
						echo $gateway['monitorip'];
95
				?>
96
                  </td>
97
		<td class="listr" align="center">
98
		<?php	if ($gateways_status[$gname])
99
				echo $gateways_status[$gname]['delay'];
100
			else
101
				echo gettext("Pending");
102
		?>
103
				<?php $counter++; ?>
104
		</td>
105
		<td class="listr" align="center">
106
		<?php	if ($gateways_status[$gname])
107
				echo $gateways_status[$gname]['loss'];
108
			else
109
				echo gettext("Pending");
110
		?>
111
				<?php $counter++; ?>
112
		</td>
113
                  <td class="listr" >
114
			<table border="0" cellpadding="0" cellspacing="2">
115
                        <?php
116
				if ($gateways_status[$gname]) {
117
					$status = $gateways_status[$gname];
118
					if (stristr($status['status'], "force_down")) {
119
						$online = gettext("Offline (forced)");
120
						$bgcolor = "#F08080";  // lightcoral
121
					} elseif (stristr($status['status'], "down")) {
122
						$online = gettext("Offline");
123
						$bgcolor = "#F08080";  // lightcoral
124
					} elseif (stristr($status['status'], "loss")) {
125
						$online = gettext("Warning, Packetloss").': '.$status['loss'];
126
						$bgcolor = "#F0E68C";  // khaki
127
					} elseif (stristr($status['status'], "delay")) {
128
						$online = gettext("Warning, Latency").': '.$status['delay'];
129
						$bgcolor = "#F0E68C";  // khaki
130
					} elseif ($status['status'] == "none") {
131
						$online = gettext("Online");
132
						$bgcolor = "#90EE90";  // lightgreen
133
					}
134
				} else if (isset($gateway['monitor_disable'])) {
135
						$online = gettext("Online");
136
						$bgcolor = "#90EE90";  // lightgreen
137
				} else {
138
					$online = gettext("Pending");
139
					$bgcolor = "#D3D3D3";  // lightgray
140
				}
141
				echo "<tr><td><table width='100%'><tr><td bgcolor=\"$bgcolor\">&nbsp;$online&nbsp;</td></tr><tr><td>";
142
				$lastchange = $gateways_status[$gname]['lastcheck'];
143
				if(!empty($lastchange)) {
144
					echo gettext("Last check:") . '<br />' . $lastchange;
145
				}
146
				echo "</td></tr></table></td></tr>";
147
                        ?>
148
			</table>
149
                  </td>
150
		  <td class="listbg"> <?=$gateway['descr']; ?></td>
151
                </tr>
152
		<?php } ?>
153
              </table>
154
	   </div>
155
</td></tr>
156
</table>
157

    
158
<?php include("fend.inc"); ?>
159
</body>
160
</html>
(189-189/256)