Return the gateway status only for gateways apinger knows about instead of assuming that all gateways are down, which might give consecuences. Also prepend 'filter_' to the function used to kill states for down gateways in filter.inc to be consistent.

This commit is contained in:
Ermal 2010-06-03 18:22:13 +00:00
parent b72eb6c8cc
commit ae9618afa8
2 changed files with 4 additions and 20 deletions

View File

@ -140,8 +140,9 @@ function filter_configure() {
touch($g['tmp_path'] . "/filter_dirty");
}
function delete_states_for_down_gateways() {
function filter_delete_states_for_down_gateways() {
global $config;
$a_gateways = return_gateways_status();
foreach ($a_gateways as $gateway) {
if ($gateway['status'] == "down") {
@ -369,7 +370,7 @@ function filter_configure_sync() {
echo ".";
update_filter_reload_status("Processing down interface states");
delete_states_for_down_gateways();
filter_delete_states_for_down_gateways();
update_filter_reload_status("Running plugins");

View File

@ -243,9 +243,7 @@ EOD;
/* return the status of the apinger targets as a array */
function return_gateways_status() {
global $config;
global $g;
$gateways_arr = return_gateways_array();
global $config, $g;
$apingerstatus = array();
if (file_exists("{$g['tmp_path']}/apinger.status")) {
@ -253,21 +251,6 @@ function return_gateways_status() {
}
$status = array();
$i = 2;
/* assign a dummy IP address for dynamic interfaces in case we need it */
$monitor = array();
foreach($gateways_arr as $name => $gateway) {
if($gateway['monitor'] == "dynamic") {
$gateway['monitor'] = "127.0.0.{$i}";
$i++;
}
$status[$gateway['monitor']]['monitor'] = $gateway['monitor'];
$status[$gateway['monitor']]['interface'] = $gateway['interface'];
$status[$gateway['monitor']]['gateway'] = $gateway['gateway'];
$status[$gateway['monitor']]['name'] = $gateway['name'];
$status[$gateway['monitor']]['status'] = "down";
}
foreach($apingerstatus as $line) {
$info = explode("|", $line);
$target = $info[0];