diff options
Diffstat (limited to 'lib/Smokeping')
-rw-r--r-- | lib/Smokeping/probes/FPing.pm | 4 | ||||
-rw-r--r-- | lib/Smokeping/probes/base.pm | 14 | ||||
-rw-r--r-- | lib/Smokeping/probes/basefork.pm | 3 |
3 files changed, 20 insertions, 1 deletions
diff --git a/lib/Smokeping/probes/FPing.pm b/lib/Smokeping/probes/FPing.pm index 32e0735..c6cb9bc 100644 --- a/lib/Smokeping/probes/FPing.pm +++ b/lib/Smokeping/probes/FPing.pm @@ -100,6 +100,10 @@ sub testhost { sub ping ($){ my $self = shift; # do NOT call superclass ... the ping method MUST be overwriten + + # increment the internal 'rounds' counter + $self->increment_rounds_count; + my %upd; my $inh = gensym; my $outh = gensym; diff --git a/lib/Smokeping/probes/base.pm b/lib/Smokeping/probes/base.pm index 7747b77..15cd03e 100644 --- a/lib/Smokeping/probes/base.pm +++ b/lib/Smokeping/probes/base.pm @@ -64,7 +64,7 @@ sub new($$) my $class = ref($this) || $this; my $self = { properties => shift, cfg => shift, name => shift, - targets => {}, rtts => {}, addrlookup => {}}; + targets => {}, rtts => {}, addrlookup => {}, rounds_count => 0}; bless $self, $class; return $self; } @@ -94,6 +94,18 @@ sub ProbeUnit ($) { return "Seconds"; } +# this is a read-only variable that should get incremented by +# the ping() method +sub rounds_count ($) { + my $self = shift; + return $self->{rounds_count}; +} + +sub increment_rounds_count ($) { + my $self = shift; + $self->{rounds_count}++; +} + sub target2dynfile ($$) { # the targets are stored in the $self->{targets} # hash as filenames pointing to the RRD files diff --git a/lib/Smokeping/probes/basefork.pm b/lib/Smokeping/probes/basefork.pm index 4f50467..0de7b6d 100644 --- a/lib/Smokeping/probes/basefork.pm +++ b/lib/Smokeping/probes/basefork.pm @@ -146,6 +146,9 @@ DOC sub ping { my $self = shift; + # increment the internal 'rounds' counter + $self->increment_rounds_count; + my @targets = @{$self->targets}; return unless @targets; |