1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
load_balancer_monitor.php
|
5
|
part of pfSense (https://www.pfsense.org/)
|
6
|
|
7
|
Copyright (C) 2008 Bill Marquette <bill.marquette@gmail.com>.
|
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-services-loadbalancer-monitor
|
37
|
##|*NAME=Services: Load Balancer: Monitors page
|
38
|
##|*DESCR=Allow access to the 'Services: Load Balancer: Monitors' page.
|
39
|
##|*MATCH=load_balancer_monitor.php*
|
40
|
##|-PRIV
|
41
|
|
42
|
require_once("guiconfig.inc");
|
43
|
require_once("functions.inc");
|
44
|
require_once("filter.inc");
|
45
|
require_once("shaper.inc");
|
46
|
require_once("util.inc");
|
47
|
|
48
|
if (!is_array($config['load_balancer']['monitor_type'])) {
|
49
|
$config['load_balancer']['monitor_type'] = array();
|
50
|
}
|
51
|
$a_monitor = &$config['load_balancer']['monitor_type'];
|
52
|
|
53
|
if ($_POST) {
|
54
|
$pconfig = $_POST;
|
55
|
|
56
|
if ($_POST['apply']) {
|
57
|
$retval = 0;
|
58
|
$retval |= filter_configure();
|
59
|
$retval |= relayd_configure();
|
60
|
|
61
|
$savemsg = get_std_save_message($retval);
|
62
|
clear_subsystem_dirty('loadbalancer');
|
63
|
}
|
64
|
}
|
65
|
|
66
|
if ($_GET['act'] == "del") {
|
67
|
if (array_key_exists($_GET['id'], $a_monitor)) {
|
68
|
/* make sure no pools reference this entry */
|
69
|
if (is_array($config['load_balancer']['lbpool'])) {
|
70
|
foreach ($config['load_balancer']['lbpool'] as $pool) {
|
71
|
if ($pool['monitor'] == $a_monitor[$_GET['id']]['name']) {
|
72
|
$input_errors[] = gettext("This entry cannot be deleted because it is still referenced by at least one pool.");
|
73
|
break;
|
74
|
}
|
75
|
}
|
76
|
}
|
77
|
|
78
|
if (!$input_errors) {
|
79
|
unset($a_monitor[$_GET['id']]);
|
80
|
write_config();
|
81
|
mark_subsystem_dirty('loadbalancer');
|
82
|
header("Location: load_balancer_monitor.php");
|
83
|
exit;
|
84
|
}
|
85
|
}
|
86
|
}
|
87
|
|
88
|
$pgtitle = array(gettext("Services"),gettext("Load Balancer"),gettext("Monitor"));
|
89
|
$shortcut_section = "relayd";
|
90
|
|
91
|
include("head.inc");
|
92
|
|
93
|
?>
|
94
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
95
|
<?php include("fbegin.inc"); ?>
|
96
|
<form action="load_balancer_monitor.php" method="post">
|
97
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
98
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
99
|
<?php if (is_subsystem_dirty('loadbalancer')): ?><br/>
|
100
|
<?php print_info_box_np(gettext("The load balancer configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?><br />
|
101
|
<?php endif; ?>
|
102
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="load balancer monitor">
|
103
|
<tr><td class="tabnavtbl">
|
104
|
<?php
|
105
|
/* active tabs */
|
106
|
$tab_array = array();
|
107
|
$tab_array[] = array(gettext("Pools"), false, "load_balancer_pool.php");
|
108
|
$tab_array[] = array(gettext("Virtual Servers"), false, "load_balancer_virtual_server.php");
|
109
|
$tab_array[] = array(gettext("Monitors"), true, "load_balancer_monitor.php");
|
110
|
$tab_array[] = array(gettext("Settings"), false, "load_balancer_setting.php");
|
111
|
display_top_tabs($tab_array);
|
112
|
?>
|
113
|
</td></tr>
|
114
|
<tr>
|
115
|
<td>
|
116
|
<div id="mainarea">
|
117
|
<?php
|
118
|
$t = new MainTable();
|
119
|
$t->edit_uri('load_balancer_monitor_edit.php');
|
120
|
$t->my_uri('load_balancer_monitor.php');
|
121
|
$t->add_column(gettext('Name'),'name',20);
|
122
|
$t->add_column(gettext('Type'),'type',10);
|
123
|
$t->add_column(gettext('Description'),'descr',30);
|
124
|
$t->add_button('edit');
|
125
|
$t->add_button('dup');
|
126
|
$t->add_button('del');
|
127
|
$t->add_content_array($a_monitor);
|
128
|
$t->display();
|
129
|
?>
|
130
|
</div>
|
131
|
</td>
|
132
|
</tr>
|
133
|
</table>
|
134
|
</form>
|
135
|
<?php include("fend.inc"); ?>
|
136
|
</body>
|
137
|
</html>
|