diff options
author | Niko Tyni <ntyni@iki.fi> | 2009-02-13 08:46:16 +0100 |
---|---|---|
committer | Niko Tyni <ntyni@iki.fi> | 2009-02-13 08:46:16 +0100 |
commit | 3c2ad106f30d111731d460b5274471d7cafe5cf8 (patch) | |
tree | 402bf71b53edb3e69e25d87f21914ee965eae410 /lib | |
parent | d27bd1a9015c9c1e9fe2d862d136e96e8a80f706 (diff) | |
download | smokeping-3c2ad106f30d111731d460b5274471d7cafe5cf8.tar.gz smokeping-3c2ad106f30d111731d460b5274471d7cafe5cf8.tar.xz |
From: Jeremy Laidman <jlaidman *rebel-it.com.au>
> Please consider including the patch below. It allows specifying a parameter
> of "allowreject" in the Radius probe configuration. When allowreject=true,
> rejected RADIUS authentications are treated as OK. This means I can test
> the RTT of a RADIUS request without using a valid account. As long as the
> RADIUS secret is correct, the timings should be reasonable. The default is
> "false".
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Smokeping/probes/Radius.pm | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/Smokeping/probes/Radius.pm b/lib/Smokeping/probes/Radius.pm index efe9429..dbbee6b 100644 --- a/lib/Smokeping/probes/Radius.pm +++ b/lib/Smokeping/probes/Radius.pm @@ -130,6 +130,11 @@ sub pingone { my $timeout = $vars->{timeout}; + my $allowreject = $vars->{allowreject}; + $self->do_debug("$host: radius allowreject is $allowreject"); + $allowreject=(defined($allowreject) + and $allowreject eq "true"); + $self->do_log("Missing RADIUS secret for $host"), return unless defined $secret; @@ -172,6 +177,7 @@ sub pingone { $result = $c; $result = "OK" if $c == &ACCESS_ACCEPT; $result = "fail" if $c == &ACCESS_REJECT; + $result = "fail-OK" if $c == &ACCESS_REJECT and $allowreject; } else { if (defined $r->get_error) { $result = "error: " . $r->strerror; @@ -181,7 +187,12 @@ sub pingone { } $elapsed = $end - $start; $self->do_debug("$host: radius query $_: $result, $elapsed"); - push @times, $elapsed if (defined $c and $c == &ACCESS_ACCEPT); + if (defined $c) { + if ( $c == &ACCESS_ACCEPT or + ($c == &ACCESS_REJECT and $allowreject) ) { + push @times, $elapsed; + } + } } return sort { $a <=> $b } @times; } @@ -242,6 +253,11 @@ sub targetvars { _re => '\d+', _example => 1645, }, + allowreject => { + _doc => 'Treat "reject" responses as OK', + _re => '(true|false)', + _example => 'true', + }, }); } |