summaryrefslogtreecommitdiffstats
path: root/lib/Smokeping
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Smokeping')
-rw-r--r--lib/Smokeping/probes/base.pm4
-rw-r--r--lib/Smokeping/probes/basevars.pm5
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/Smokeping/probes/base.pm b/lib/Smokeping/probes/base.pm
index 15cd03e..cdcad66 100644
--- a/lib/Smokeping/probes/base.pm
+++ b/lib/Smokeping/probes/base.pm
@@ -74,6 +74,8 @@ sub add($$)
my $self = shift;
my $tree = shift;
+ $self->{target_count}++; # increment this anyway
+ return if defined $tree->{nomasterpoll} and $tree->{nomasterpoll} eq "yes";
$self->{targets}{$tree} = shift;
}
@@ -281,7 +283,7 @@ sub _pings {
sub target_count {
my $self = shift;
- return scalar keys %{$self->{targets}};
+ return $self->{target_count};
}
sub probevars {
diff --git a/lib/Smokeping/probes/basevars.pm b/lib/Smokeping/probes/basevars.pm
index 8a1b475..ec40f99 100644
--- a/lib/Smokeping/probes/basevars.pm
+++ b/lib/Smokeping/probes/basevars.pm
@@ -69,6 +69,7 @@ sub add($$)
my $self = shift;
my $tree = shift;
+ $self->{target_count}++;
$self->{targets}{$tree} = shift;
$self->{vars}{$tree} = { %{$self->{properties}}, %$tree };
}
@@ -84,7 +85,9 @@ sub targets {
for (@$addr) {
@{$copy{$_}} = @{$self->{addrlookup}{$_}} unless exists $copy{$_};
my $tree = pop @{$copy{$_}};
- push @targets, { addr => $_, vars => $self->{vars}{$tree}, tree => $tree };
+ my $vars = $self->{vars}{$tree};
+ next if defined $vars->{nomasterpoll} and $vars->{nomasterpoll} eq "yes";
+ push @targets, { addr => $_, vars => $vars, tree => $tree };
}
return \@targets;
}