From 9edc0ff6eaa82d51970299a76106952e9bc4ac2a Mon Sep 17 00:00:00 2001 From: Tobi Oetiker Date: Mon, 3 Dec 2007 23:36:50 +0000 Subject: trying to make slave reload realy work --- lib/Smokeping.pm | 16 ++++++++++++---- lib/Smokeping/Slave.pm | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'lib') 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 { -- cgit v1.2.3-24-g4f1b