From 2206afb0d6aaf857ecf739ae0b639bf215106294 Mon Sep 17 00:00:00 2001 From: Niko Tyni Date: Fri, 18 Feb 2005 20:55:29 +0000 Subject: * complain if pings < 3 * show the smoke for pings == 3 too, not only if >3 --- lib/Smokeping.pm | 15 +++++++++++---- lib/Smokeping/probes/base.pm | 6 ++++++ lib/Smokeping/probes/basefork.pm | 6 ++++++ 3 files changed, 23 insertions(+), 4 deletions(-) (limited to 'lib') 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 => < 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 => < { _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 => <_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 => <