Project

General

Profile

Download (4.56 KB) Statistics
| Branch: | Tag: | Revision:
1
<?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
/*	
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

    
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
              <table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0">
72
                <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
			  <?php foreach ($a_gateways as $gateway) {
80
				$i = 2;
81
			?>
82
                <tr>
83
                  <td class="listlr">
84
				<?=strtoupper($gateway['name']);?>
85
                  </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
				if($gateway['gateway'] == "dynamic") {
96
					$gateway['monitor'] = "127.0.0.{$i}";
97
					$i++;
98
				}
99
				$monitor = $gateway['monitor'];
100
				if(empty($monitor)) {
101
					$monitor = $gateway['gateway'];
102
				}
103
				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
				if(!empty($lastchange)) {
125
					$lastchange = explode(" ", $lastchange);
126
					array_shift($lastchange);
127
					array_shift($lastchange);
128
					$lastchange = implode(" ", $lastchange);
129
					PRINT "Last success $lastchange";
130
				} else {
131
					print "Gathering data";
132
				}
133
				PRINT "</td></tr>";
134
                        ?>
135
			</table>
136
                  </td>
137
                  <td class="listbg" >
138
						<?=$gateway['descr'];?></font>
139
                  </td>
140
                </tr>
141
		<?php } ?>
142
              </table>
143
	   </div>
144
	</table>
145

    
146
<?php include("fend.inc"); ?>
147
</body>
148
</html>
(155-155/218)