Project

General

Profile

Download (4.56 KB) Statistics
| Branch: | Tag: | Revision:
1 ffd1a240 Seth Mos
<?php
2
/* $Id$ */
3
/*
4
	status_gateways.php
5
	part of pfSense (http://www.pfsense.com/)
6
7
	Copyright (C) 2006 Seth Mos <seth.mos@xs4all.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 1d333258 Scott Ullrich
/*	
32
	pfSense_MODULE:	routing
33
*/
34 ffd1a240 Seth Mos
35 6b07c15a Matthew Grooms
##|+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 ffd1a240 Seth Mos
require("guiconfig.inc");
43
44 73e8bbe4 Seth Mos
$a_gateways = return_gateways_array();
45 ffd1a240 Seth Mos
46
$gateways_status = array();
47
$gateways_status = return_gateways_status();
48
49
$now = time();
50
$year = date("Y");
51
52
$pgtitle = array("Status","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("Gateways", true, "status_gateways.php");
64
        $tab_array[] = array("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 3473bb6a Scott Ullrich
              <table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0">
72 ffd1a240 Seth Mos
                <tr>
73
                  <td width="10%" class="listhdrr">Name</td>
74
                  <td width="10%" class="listhdrr">Gateway</td>
75
                  <td width="10%" class="listhdrr">Monitor</td>
76
                  <td width="30%" class="listhdrr">Status</td>
77
                  <td width="30%" class="listhdr">Description</td>
78
				</tr>
79 9a21b547 Seth Mos
			  <?php foreach ($a_gateways as $gateway) {
80
				$i = 2;
81
			?>
82 ffd1a240 Seth Mos
                <tr>
83
                  <td class="listlr">
84 e8a4a8f3 Scott Ullrich
				<?=strtoupper($gateway['name']);?>
85 ffd1a240 Seth Mos
                  </td>
86
                  <td class="listr" align="center" >
87
                                <?=$gateway['gateway'];?>
88
                  </td>
89
                  <td class="listr" align="center" >
90
                                <?=$gateway['monitor'];?>
91
                  </td>
92
                  <td class="listr" >
93
			<table border="0" cellpadding="0" cellspacing="2">
94
                        <?php
95 9a21b547 Seth Mos
				if($gateway['gateway'] == "dynamic") {
96
					$gateway['monitor'] = "127.0.0.{$i}";
97
					$i++;
98
				}
99 ffd1a240 Seth Mos
				$monitor = $gateway['monitor'];
100 e7986ed7 Seth Mos
				if(empty($monitor)) {
101
					$monitor = $gateway['gateway'];
102
				}
103 ffd1a240 Seth Mos
				switch($gateways_status[$monitor]['status']) {
104
					case "None":
105
						$online = "Online";
106
						$bgcolor = "lightgreen";
107
						break;
108
					case "\"down\"":
109
						$online = "Offline";
110
						$bgcolor = "lightcoral";
111
						break;
112
					case "\"delay\"":
113
						$online = "Warning, Latency";
114
						$bgcolor = "khaki";
115
						break;
116
					case "\"loss\"":
117
						$online = "Warning, Packetloss";
118
						$bgcolor = "khaki";
119
						break;
120
				}
121
122
				PRINT "<tr><td bgcolor=\"$bgcolor\" > $online </td><td>";
123
				$lastchange = $gateways_status[$monitor]['lastcheck'];
124 73e8bbe4 Seth Mos
				if(!empty($lastchange)) {
125
					$lastchange = explode(" ", $lastchange);
126
					array_shift($lastchange);
127
					array_shift($lastchange);
128
					$lastchange = implode(" ", $lastchange);
129 ddb36cbb Bill Marquette
					PRINT "Last success $lastchange";
130 73e8bbe4 Seth Mos
				} else {
131 2ff9980b Scott Ullrich
					print "Gathering data";
132 73e8bbe4 Seth Mos
				}
133 ffd1a240 Seth Mos
				PRINT "</td></tr>";
134
                        ?>
135
			</table>
136
                  </td>
137
                  <td class="listbg" >
138 2792f9fe Scott Ullrich
						<?=$gateway['descr'];?></font>
139 ffd1a240 Seth Mos
                  </td>
140
                </tr>
141 9a21b547 Seth Mos
		<?php } ?>
142 ffd1a240 Seth Mos
              </table>
143
	   </div>
144
	</table>
145
146
<?php include("fend.inc"); ?>
147
</body>
148
</html>