Revision b8873098
Added by Ermal LUÇI about 14 years ago
etc/inc/gwlb.inc | ||
---|---|---|
137 | 137 |
EOD; |
138 | 138 |
|
139 | 139 |
foreach($gateways_arr as $name => $gateway) { |
140 |
/* Do not monitor if such was requested */ |
|
141 |
if (isset($gateway['monitor_disable'])) |
|
142 |
continue; |
|
140 | 143 |
if (empty($gateway['monitor']) || !is_ipaddr($gateway['monitor'])) { |
141 | 144 |
if (is_ipaddr($gateway['gateway'])) |
142 | 145 |
$gateway['monitor'] = $gateway['gateway']; |
... | ... | |
282 | 285 |
$gateway['gateway'] = "dynamic"; |
283 | 286 |
$gateway['dynamic'] = true; |
284 | 287 |
} |
285 |
if(empty($gateway['monitor'])) |
|
288 |
if (isset($gateway['monitor_disable'])) |
|
289 |
$gateway['monitor_disable'] = true; |
|
290 |
else if (empty($gateway['monitor'])) |
|
286 | 291 |
$gateway['monitor'] = $gateway['gateway']; |
287 | 292 |
|
288 | 293 |
$gateway['friendlyiface'] = $gateway['interface']; |
... | ... | |
378 | 383 |
if (isset($gwsttng['defaultgw'])) { |
379 | 384 |
$dfltgwfound = true; |
380 | 385 |
$dfltgwname = $gwname; |
381 |
if (stristr($gateways_status[$gwname]['status'], "down")) |
|
386 |
if (!isset($gwsttng['monitor_disable']) && stristr($gateways_status[$gwname]['status'], "down"))
|
|
382 | 387 |
$dfltgwdown = true; |
383 | 388 |
} |
384 | 389 |
/* Keep a record of the last up gateway */ |
385 |
if (empty($upgw) && !stristr($gateways_status[$gwname]['status'], "down"))
|
|
390 |
if (empty($upgw) && (isset($gwsttng['monitor_disable']) || !stristr($gateways_status[$gwname]['status'], "down")))
|
|
386 | 391 |
$upgw = $gwname; |
387 | 392 |
if ($dfltgwdown == true && !empty($upgw)) |
388 | 393 |
break; |
389 | 394 |
} |
390 | 395 |
if ($dfltgwfound == false) { |
391 | 396 |
$gwname = convert_friendly_interface_to_friendly_descr("wan"); |
392 |
if (stristr($gateways_status[$gwname]['status'], "down")) |
|
397 |
if (!empty($gateways_status[$gwname]) && stristr($gateways_status[$gwname]['status'], "down"))
|
|
393 | 398 |
$dfltgwdown = true; |
394 | 399 |
} |
395 | 400 |
if ($dfltgwdown == true && !empty($upgw)) { |
... | ... | |
444 | 449 |
} else |
445 | 450 |
/* Online add member */ |
446 | 451 |
$tiers[$tier][] = $gwname; |
447 |
} |
|
452 |
} else if (isset($gateways_arr[$gwname]['monitor_disable'])) |
|
453 |
$tiers[$tier][] = $gwname; |
|
448 | 454 |
} |
449 | 455 |
$tiers_count = count($tiers); |
450 | 456 |
if($tiers_count == 0) { |
usr/local/www/system_gateways_edit.php | ||
---|---|---|
78 | 78 |
$pconfig['losshigh'] = $a_gateway_item[$id]['losshigh']; |
79 | 79 |
$pconfig['down'] = $a_gateway_item[$id]['down']; |
80 | 80 |
$pconfig['monitor'] = $a_gateways[$id]['monitor']; |
81 |
$pconfig['monitor_disable'] = isset($a_gateways[$id]['monitor_disable']); |
|
81 | 82 |
$pconfig['descr'] = $a_gateways[$id]['descr']; |
82 | 83 |
$pconfig['attribute'] = $a_gateways[$id]['attribute']; |
83 | 84 |
} |
... | ... | |
221 | 222 |
$gateway['name'] = $_POST['name']; |
222 | 223 |
$gateway['weight'] = $_POST['weight']; |
223 | 224 |
$gateway['descr'] = $_POST['descr']; |
224 |
if (is_ipaddr($_POST['monitor'])) |
|
225 |
if ($_POST['monitor_disable'] == "yes") |
|
226 |
$gateway['monitor_disable'] = true; |
|
227 |
else if (is_ipaddr($_POST['monitor'])) |
|
225 | 228 |
$gateway['monitor'] = $_POST['monitor']; |
226 | 229 |
|
227 | 230 |
if ($_POST['defaultgw'] == "yes" || $_POST['defaultgw'] == "on") { |
... | ... | |
287 | 290 |
aodiv = document.getElementById('showgatewayadv'); |
288 | 291 |
aodiv.style.display = "block"; |
289 | 292 |
} |
293 |
function monitor_change() { |
|
294 |
document.iform.monitor.disabled = document.iform.monitor_disable.checked; |
|
295 |
} |
|
290 | 296 |
</script> |
291 | 297 |
<?php if ($input_errors) print_input_errors($input_errors); ?> |
292 | 298 |
<form action="system_gateways_edit.php" method="post" name="iform" id="iform"> |
... | ... | |
345 | 351 |
<?=gettext("This will select the above gateway as the default gateway"); ?> |
346 | 352 |
</td> |
347 | 353 |
</tr> |
354 |
<tr> |
|
355 |
<td width="22%" valign="top" class="vncell"><?=gettext("Disable Gateway Monitoring"); ?></td> |
|
356 |
<td width="78%" class="vtable"> |
|
357 |
<input name="monitor_disable" type="checkbox" id="monitor_disable" value="yes" <?php if ($pconfig['monitor_disable'] == true) echo "checked"; ?> onClick="monitor_change()" /> |
|
358 |
<strong><?=gettext("Disable Gateway Monitoring"); ?></strong><br /> |
|
359 |
<?=gettext("This will consider this gateway as always being up"); ?> |
|
360 |
</td> |
|
361 |
</tr> |
|
348 | 362 |
<tr> |
349 | 363 |
<td width="22%" valign="top" class="vncell"><?=gettext("Monitor IP"); ?></td> |
350 | 364 |
<td width="78%" class="vtable"> |
... | ... | |
441 | 455 |
</form> |
442 | 456 |
<?php include("fend.inc"); ?> |
443 | 457 |
<script language="JavaScript"> |
444 |
enable_change(document.iform.defaultgw);
|
|
458 |
monitor_change();
|
|
445 | 459 |
</script> |
446 | 460 |
</body> |
447 | 461 |
</html> |
Also available in: Unified diff
Add a new option to allow disabling of gateway monitoring. This gateways will always be reported as up.