Project

General

Profile

Download (4.45 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
##|+PRIV
33
##|*IDENT=page-status-gateways
34
##|*NAME=Status: Gateways page
35
##|*DESCR=Allow access to the 'Status: Gateways' page.
36
##|*MATCH=status_gateways.php*
37
##|-PRIV
38

    
39

    
40
require("guiconfig.inc");
41

    
42
if (!is_array($config['gateways']['gateway_item'])) {
43
	$config['gateways']['gateway_item'] = array();
44
}
45
$a_gateways = &$config['gateways']['gateway_item'];
46

    
47
$gateways_status = array();
48
$gateways_status = return_gateways_status();
49

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

    
53
$pgtitle = array("Status","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("Gateways", true, "status_gateways.php");
65
        $tab_array[] = array("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" width="100%" border="0" cellpadding="0" cellspacing="0">
73
                <tr>
74
                  <td width="10%" class="listhdrr">Name</td>
75
                  <td width="10%" class="listhdrr">Gateway</td>
76
                  <td width="10%" class="listhdrr">Monitor</td>
77
                  <td width="30%" class="listhdrr">Status</td>
78
                  <td width="30%" class="listhdr">Description</td>
79
				</tr>
80
			  <?php $i = 0; foreach ($a_gateways as $gateway) { ?>
81
                <tr>
82
                  <td class="listlr">
83
				<?=$gateway['name'];?>
84
                  </td>
85
                  <td class="listr" align="center" >
86
                                <?=$gateway['gateway'];?>
87
                  </td>
88
                  <td class="listr" align="center" >
89
                                <?=$gateway['monitor'];?>
90
                  </td>
91
                  <td class="listr" >
92
			<table border="0" cellpadding="0" cellspacing="2">
93
                        <?php
94
				$monitor = $gateway['monitor'];
95
				if(empty($monitor)) {
96
					$monitor = $gateway['gateway'];
97
				}
98
				switch($gateways_status[$monitor]['status']) {
99
					case "None":
100
						$online = "Online";
101
						$bgcolor = "lightgreen";
102
						break;
103
					case "\"down\"":
104
						$online = "Offline";
105
						$bgcolor = "lightcoral";
106
						break;
107
					case "\"delay\"":
108
						$online = "Warning, Latency";
109
						$bgcolor = "khaki";
110
						break;
111
					case "\"loss\"":
112
						$online = "Warning, Packetloss";
113
						$bgcolor = "khaki";
114
						break;
115
				}
116

    
117
				PRINT "<tr><td bgcolor=\"$bgcolor\" > $online </td><td>";
118
				$lastchange = $gateways_status[$monitor]['lastcheck'];
119
				$lastchange = explode(" ", $lastchange);
120
				array_shift($lastchange);
121
				array_shift($lastchange);
122
				$lastchange = implode(" ", $lastchange);
123
				PRINT "Last succes $lastchange";
124
				PRINT "</td></tr>";
125
                        ?>
126
			</table>
127
                  </td>
128
                  <td class="listbg" >
129
						<?=$gateway['descr'];?></font>
130
                  </td>
131
                </tr>
132
		<?php
133
			$i++;
134
		}
135
		 ?>
136
              </table>
137
	   </div>
138
	</table>
139

    
140
<?php include("fend.inc"); ?>
141
</body>
142
</html>
(149-149/210)