diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Smokeping.pm | 15 | ||||
-rw-r--r-- | lib/Smokeping/probes/base.pm | 6 | ||||
-rw-r--r-- | lib/Smokeping/probes/basefork.pm | 6 |
3 files changed, 23 insertions, 4 deletions
diff --git a/lib/Smokeping.pm b/lib/Smokeping.pm index 5daed06..65ac92b 100644 --- a/lib/Smokeping.pm +++ b/lib/Smokeping.pm @@ -686,7 +686,7 @@ sub get_detail ($$$$){ close HG; } - my $smoke = $pings - 3 > 0 + my $smoke = $pings >= 3 ? smokecol $pings : [ 'COMMENT:(Not enough pings to draw any smoke.)\s', 'COMMENT:\s' ]; # one \s doesn't seem to be enough @@ -1622,7 +1622,8 @@ by changing the entries in the cfg file. DOC step => - { %$INTEGER_SUB, + { + %$INTEGER_SUB, _doc => <<DOC, Duration of the base operation interval of SmokePing in seconds. SmokePing will venture out every B<step> seconds to ping your target hosts. @@ -1634,9 +1635,15 @@ DOC }, pings => { - %$INTEGER_SUB, + _re => '\d+', + _sub => sub { + my $val = shift; + return "ERROR: The pings value must be at least 3." + if $val < 3; + return undef; + }, _doc => <<DOC, -How many pings should be sent to each target. Suggested: 20 pings. +How many pings should be sent to each target. Suggested: 20 pings. Minimum value: 3 pings. This can be overridden by each probe. Some probes (those derived from basefork.pm, ie. most except the FPing variants) will even let this be overridden target-specifically. Note that the number of pings in diff --git a/lib/Smokeping/probes/base.pm b/lib/Smokeping/probes/base.pm index dab2979..8cc4def 100644 --- a/lib/Smokeping/probes/base.pm +++ b/lib/Smokeping/probes/base.pm @@ -279,6 +279,12 @@ DOC }, pings => { _re => '\d+', + _sub => sub { + my $val = shift; + return "ERROR: The pings value must be at least 3." + if $val < 3; + return undef; + }, _example => 20, _doc => <<DOC, How many pings should be sent to each target, if different from the global diff --git a/lib/Smokeping/probes/basefork.pm b/lib/Smokeping/probes/basefork.pm index b7b5554..4f50467 100644 --- a/lib/Smokeping/probes/basefork.pm +++ b/lib/Smokeping/probes/basefork.pm @@ -125,6 +125,12 @@ sub targetvars { return $class->_makevars($class->SUPER::targetvars, { pings => { _re => '\d+', + _sub => sub { + my $val = shift; + return "ERROR: The pings value must be at least 3." + if $val < 3; + return undef; + }, _example => 5, _doc => <<DOC, How many pings should be sent to each target, if different from the global |