diff options
author | Tobi Oetiker <tobi@oetiker.ch> | 2007-12-04 00:36:50 +0100 |
---|---|---|
committer | Tobi Oetiker <tobi@oetiker.ch> | 2007-12-04 00:36:50 +0100 |
commit | 9edc0ff6eaa82d51970299a76106952e9bc4ac2a (patch) | |
tree | 3ad7d1bc3012e2f934b35df8cc0d0e50c0aa36d2 /lib | |
parent | c81ee6051263e7039bff5125b6732905ba6a5ba3 (diff) | |
download | smokeping-9edc0ff6eaa82d51970299a76106952e9bc4ac2a.tar.gz smokeping-9edc0ff6eaa82d51970299a76106952e9bc4ac2a.tar.xz |
trying to make slave reload realy work
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Smokeping.pm | 16 | ||||
-rw-r--r-- | lib/Smokeping/Slave.pm | 2 |
2 files changed, 13 insertions, 5 deletions
diff --git a/lib/Smokeping.pm b/lib/Smokeping.pm index 588c67d..960874a 100644 --- a/lib/Smokeping.pm +++ b/lib/Smokeping.pm @@ -3956,16 +3956,23 @@ KID: do_debuglog("Sleeping $sleeptime seconds."); } sleep $sleeptime; - last if checkhup($multiprocessmode, $gothup) && reload_cfg($cfgfile); + last if checkhup($multiprocessmode, $gothup) && reload_cfg($cfgfile) ); } my $now = time; run_probes $probes, $myprobe; # $myprobe is undef if running without 'concurrentprobes' my %sortercache; if ($opt{'master-url'}){ my $new_conf = Smokeping::Slave::submit_results $slave_cfg,$cfg,$myprobe,$probes; - if ($new_conf){ - kill $$, SIGHUP; - } + if ($new_conf){ + do_log('server has new config for me ... HUPing myself'); + $gothup = 1; + $cfg=$new_conf; + $probes = undef; + $probes = load_probes $cfg; + $cfg->{__probes} = $probes; + add_targets($cfg, $probes, $cfg->{Targets}, $cfg->{General}{datadir}); + last; + } } else { update_rrds $cfg, $probes, $cfg->{Targets}, $cfg->{General}{datadir}, $myprobe, \%sortercache; save_sortercache($cfg,\%sortercache,$myprobe); @@ -4014,6 +4021,7 @@ sub checkhup ($$) { sub reload_cfg ($) { my $cfgfile = shift; + return 1 if exists $opt{'master-url'}; my ($oldcfg, $oldprobes) = ($cfg, $probes); do_log("Reloading configuration."); $cfg = undef; diff --git a/lib/Smokeping/Slave.pm b/lib/Smokeping/Slave.pm index 8f95c5f..32ce5a4 100644 --- a/lib/Smokeping/Slave.pm +++ b/lib/Smokeping/Slave.pm @@ -104,7 +104,7 @@ sub submit_results { warn "WARNING evaluating new config from server failed: $@ --\n$data"; } elsif (defined $config and ref $config eq 'HASH'){ $config->{General}{piddir} = $slave_cfg->{cache_dir}; - Smokeping::do_debuglog("Sent data to Server and got new config"); + Smokeping::do_log("Sent data to Server and got new config in response."); return $config; } } else { |