summaryrefslogtreecommitdiffstats
path: root/lib/Smokeping.pm
diff options
context:
space:
mode:
authorTobi Oetiker <tobi@oetiker.ch>2007-12-04 00:36:50 +0100
committerTobi Oetiker <tobi@oetiker.ch>2007-12-04 00:36:50 +0100
commit9edc0ff6eaa82d51970299a76106952e9bc4ac2a (patch)
tree3ad7d1bc3012e2f934b35df8cc0d0e50c0aa36d2 /lib/Smokeping.pm
parentc81ee6051263e7039bff5125b6732905ba6a5ba3 (diff)
downloadsmokeping-9edc0ff6eaa82d51970299a76106952e9bc4ac2a.tar.gz
smokeping-9edc0ff6eaa82d51970299a76106952e9bc4ac2a.tar.xz
trying to make slave reload realy work
Diffstat (limited to 'lib/Smokeping.pm')
-rw-r--r--lib/Smokeping.pm16
1 files changed, 12 insertions, 4 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;