summaryrefslogtreecommitdiffstats
path: root/etc/inc/gwlb.inc
diff options
context:
space:
mode:
Diffstat (limited to 'etc/inc/gwlb.inc')
-rw-r--r--etc/inc/gwlb.inc28
1 files changed, 15 insertions, 13 deletions
diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc
index 94ddd17..2ff52a1 100644
--- a/etc/inc/gwlb.inc
+++ b/etc/inc/gwlb.inc
@@ -160,11 +160,16 @@ EOD;
if (!is_ipaddr($gateway['monitor']))
continue;
- $apingercfg .= "target \"{$gateway['monitor']}\" {\n";
- $apingercfg .= " description \"{$gateway['name']}\"\n";
- $gwifip = find_interface_ip($gateway['interface']);
+ if($gateway['monitor'] == "127.0.0.{$i}") {
+ $gwifip = "127.0.0.1";
+ } else {
+ $gwifip = find_interface_ip($gateway['interface']);
+ }
if (!is_ipaddr($gwifip))
continue; //Skip this target
+
+ $apingercfg .= "target \"{$gateway['monitor']}\" {\n";
+ $apingercfg .= " description \"{$gateway['name']}\"\n";
$apingercfg .= " srcip \"{$gwifip}\"\n";
$alarms = "";
$override = false;
@@ -235,16 +240,13 @@ EOD;
fwrite($fd, $apingerconfig);
fclose($fd);
- if (is_process_running("apinger")) {
- sigkillbypid("{$g['varrun_path']}/apinger.pid", "HUP");
- } else {
- if (is_dir("{$g['tmp_path']}"))
- chmod("{$g['tmp_path']}", 01777);
- if (is_dir("{$g['vardb_path']}/rrd"))
- chown("{$g['vardb_path']}/rrd", "nobody");
- /* start a new apinger process */
- mwexec_bg("/usr/local/sbin/apinger -c {$g['varetc_path']}/apinger.conf");
- }
+ killbypid("{$g['varrun_path']}/apinger.pid");
+ if (is_dir("{$g['tmp_path']}"))
+ chmod("{$g['tmp_path']}", 01777);
+ if (is_dir("{$g['vardb_path']}/rrd"))
+ chown("{$g['vardb_path']}/rrd", "nobody");
+ /* start a new apinger process */
+ mwexec_bg("/usr/local/sbin/apinger -c {$g['varetc_path']}/apinger.conf");
return 0;
}
OpenPOWER on IntegriCloud