From 30f15c0632513caff0c322c4cf1a8a1e10d9865c Mon Sep 17 00:00:00 2001 From: Niko Tyni Date: Sat, 26 Feb 2005 18:00:27 +0000 Subject: SYNOPSYS is really spelled SYNOPSIS. Shame on me. --- lib/Smokeping/RRDtools.pm | 2 +- lib/Smokeping/probes/base.pm | 14 +++++++------- lib/Smokeping/probes/passwordchecker.pm | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'lib/Smokeping') diff --git a/lib/Smokeping/RRDtools.pm b/lib/Smokeping/RRDtools.pm index 7260cca..3363f55 100644 --- a/lib/Smokeping/RRDtools.pm +++ b/lib/Smokeping/RRDtools.pm @@ -4,7 +4,7 @@ package Smokeping::RRDtools; Smokeping::RRDtools - Tools for RRD file handling -=head1 SYNOPSYS +=head1 SYNOPSIS use Smokeping::RRDtools; use RRDs; diff --git a/lib/Smokeping/probes/base.pm b/lib/Smokeping/probes/base.pm index 8cc4def..4ae81b5 100644 --- a/lib/Smokeping/probes/base.pm +++ b/lib/Smokeping/probes/base.pm @@ -42,9 +42,9 @@ sub pod { my $class = shift; my $pod = ""; my $podhash = $class->pod_hash; - $podhash->{synopsys} = $class->pod_synopsys; + $podhash->{synopsis} = $class->pod_synopsis; $podhash->{variables} = $class->pod_variables; - for my $what (qw(name overview synopsys description variables authors notes bugs see_also)) { + for my $what (qw(name overview synopsis description variables authors notes bugs see_also)) { my $contents = $podhash->{$what}; next if not defined $contents or $contents eq ""; $pod .= "=head1 " . uc $what . "\n\n"; @@ -316,7 +316,7 @@ sub _makevars { return $to; } -sub pod_synopsys { +sub pod_synopsis { my $class = shift; my $classname = ref $class||$class; $classname =~ s/^Smokeping::probes:://; @@ -329,8 +329,8 @@ sub pod_synopsys { +$classname DOC - $pod .= $class->_pod_synopsys($probevars); - my $targetpod = $class->_pod_synopsys($targetvars); + $pod .= $class->_pod_synopsis($probevars); + my $targetpod = $class->_pod_synopsis($targetvars); $pod .= "\n # The following variables can be overridden in each target section\n$targetpod" if defined $targetpod and $targetpod ne ""; $pod .= < < Date: Sun, 6 Mar 2005 17:16:04 +0000 Subject: * lib/Smokeping/probes/base.pm: + probe documents had a 'SEE_ALSO' section; fixed to read "SEE ALSO". --- lib/Smokeping/probes/base.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/Smokeping') diff --git a/lib/Smokeping/probes/base.pm b/lib/Smokeping/probes/base.pm index 4ae81b5..a322a21 100644 --- a/lib/Smokeping/probes/base.pm +++ b/lib/Smokeping/probes/base.pm @@ -47,7 +47,9 @@ sub pod { for my $what (qw(name overview synopsis description variables authors notes bugs see_also)) { my $contents = $podhash->{$what}; next if not defined $contents or $contents eq ""; - $pod .= "=head1 " . uc $what . "\n\n"; + my $headline = uc $what; + $headline =~ s/_/ /; # see_also => SEE ALSO + $pod .= "=head1 $headline\n\n"; $pod .= $contents; chomp $pod; $pod .= "\n\n"; -- cgit v1.2.3-24-g4f1b From 6e6508791dd10e9e2b5869187973b551dabc6fc9 Mon Sep 17 00:00:00 2001 From: Niko Tyni Date: Tue, 8 Mar 2005 19:57:08 +0000 Subject: * branches/2.0/lib/Smokeping/RRDtools.pm: + add AUTHOR section to the POD documentation. --- lib/Smokeping/RRDtools.pm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/Smokeping') diff --git a/lib/Smokeping/RRDtools.pm b/lib/Smokeping/RRDtools.pm index 3363f55..2b8e3a4 100644 --- a/lib/Smokeping/RRDtools.pm +++ b/lib/Smokeping/RRDtools.pm @@ -57,6 +57,10 @@ Probably. Copyright (c) 2005 by Niko Tyni. +=head1 AUTHOR + +Niko Tyni + =head1 LICENSE This program is free software; you can redistribute it -- cgit v1.2.3-24-g4f1b From 021947ad8e963d89bdb00bd9de24dc962a3472bf Mon Sep 17 00:00:00 2001 From: Niko Tyni Date: Thu, 10 Mar 2005 11:00:44 +0000 Subject: * 2.0/lib/Smokeping/probes/Curl.pm, 2.0/doc/smokeping_upgrade.pod, 2.0/CHANGES: + new variables: extraargs and extrare --- lib/Smokeping/probes/Curl.pm | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'lib/Smokeping') diff --git a/lib/Smokeping/probes/Curl.pm b/lib/Smokeping/probes/Curl.pm index 56dd338..e00c749 100644 --- a/lib/Smokeping/probes/Curl.pm +++ b/lib/Smokeping/probes/Curl.pm @@ -102,6 +102,38 @@ host to be probed. DOC _example => "http://%host%/", }, + extrare=> { + _doc => < "/ /", + _example => "/ /", + _sub => sub { + my $val = shift; + return "extrare should be specified in the /regexp/ notation" + unless $val =~ m,^/.*/$,; + return undef; + }, + }, + extraargs => { + _doc => <. +DOC + _example => "-6 --head --user user:password", + }, }); } @@ -181,6 +213,16 @@ sub proto_args { return(@args); } +sub extra_args { + my $self = shift; + my $target = shift; + my $args = $target->{vars}{extraargs}; + return () unless defined $args; + my $re = $target->{vars}{extrare}; + ($re =~ m,^/(.*)/$,) and $re = qr{$1}; + return split($re, $args); +} + sub make_commandline { my $self = shift; my $target = shift; @@ -191,6 +233,7 @@ sub make_commandline { my $host = $target->{addr}; $url =~ s/%host%/$host/g; push @args, $self->proto_args($target); + push @args, $self->extra_args($target); return ($self->{properties}{binary}, @args, $url); } -- cgit v1.2.3-24-g4f1b From c1676927af530e87f849df945deaa65182db5835 Mon Sep 17 00:00:00 2001 From: Tobi Oetiker Date: Fri, 11 Mar 2005 20:08:19 +0000 Subject: removed extra space --- lib/Smokeping/matchers/Avgratio.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/Smokeping') diff --git a/lib/Smokeping/matchers/Avgratio.pm b/lib/Smokeping/matchers/Avgratio.pm index 8679fe9..e97fcf0 100644 --- a/lib/Smokeping/matchers/Avgratio.pm +++ b/lib/Smokeping/matchers/Avgratio.pm @@ -5,7 +5,7 @@ package Smokeping::matchers::Avgratio; Smokeping::matchers::Avgratio - detect changes in average median latency =head1 OVERVIEW - + The Avgratio matcher establishes a historic average median latency over several measurement rounds. It compares this average, against a second average latency value again build over several rounds of measurement. -- cgit v1.2.3-24-g4f1b From 4036ad2a9afa4417c670fc52eaf67da37b0f8e45 Mon Sep 17 00:00:00 2001 From: Tobi Oetiker Date: Mon, 9 May 2005 18:38:03 +0000 Subject: Double check the answer from the dns server and optionally enforce a NOERROR response code -- Christoph.Heine in HaDiKo.DE --- lib/Smokeping/probes/AnotherDNS.pm | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'lib/Smokeping') diff --git a/lib/Smokeping/probes/AnotherDNS.pm b/lib/Smokeping/probes/AnotherDNS.pm index 65a1bd4..d4f0397 100644 --- a/lib/Smokeping/probes/AnotherDNS.pm +++ b/lib/Smokeping/probes/AnotherDNS.pm @@ -69,6 +69,7 @@ sub pingone ($) { my $recordtype = $target->{vars}{recordtype}; my $timeout = $target->{vars}{timeout}; my $port = $target->{vars}{port}; + my $require_noerror = $target->{vars}{require_noerror}; $lookuphost = $target->{addr} unless defined $lookuphost; my $packet = Net::DNS::Packet->new( $lookuphost, $recordtype )->data; @@ -93,9 +94,20 @@ sub pingone ($) { my $t1 = [gettimeofday]; $elapsed = tv_interval( $t0, $t1 ); if ( defined $ready ) { - push @times, $elapsed; my $buf = ''; $ready->recv( $buf, &Net::DNS::PACKETSZ ); + my ($recvPacket, $err) = Net::DNS::Packet->new(\$buf); + if (defined $recvPacket) { + if (not $require_noerror) { + push @times, $elapsed; + } else { + # Check the Response Code for the NOERROR. + my $recvHeader = $recvPacket->header(); + if ($recvHeader->rcode() eq "NOERROR") { + push @times, $elapsed; + } + } + } } } @times = @@ -127,6 +139,10 @@ DOC _default => .5, _re => '(\d*\.)?\d+', }, + require_noerror => { + _doc => 'Only Count Answers with Response Status NOERROR.', + _default => 0, + }, recordtype => { _doc => 'Record type to look up.', _default => 'A', -- cgit v1.2.3-24-g4f1b From bd0e56f10d34b874a6d115391c4046199e5b330e Mon Sep 17 00:00:00 2001 From: Niko Tyni Date: Tue, 10 May 2005 17:48:16 +0000 Subject: * branches/2.0/lib/Smokeping/probes/Curl.pm: + added the 'insecure_ssl' (-k) option from Marc Spitzer --- lib/Smokeping/probes/Curl.pm | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/Smokeping') diff --git a/lib/Smokeping/probes/Curl.pm b/lib/Smokeping/probes/Curl.pm index e00c749..af5be29 100644 --- a/lib/Smokeping/probes/Curl.pm +++ b/lib/Smokeping/probes/Curl.pm @@ -102,6 +102,16 @@ host to be probed. DOC _example => "http://%host%/", }, + insecure_ssl => { + _doc => < 1, + }, extrare=> { _doc => <{vars}{ssl2}; push (@args, "-2") if defined($ssl2); + my $insecure_ssl = $target->{vars}{insecure_ssl}; + push (@args, '-k') if defined $insecure_ssl; + return(@args); } -- cgit v1.2.3-24-g4f1b From bf7247e98dfc9891a5adaaf60cbe392b25cb66ae Mon Sep 17 00:00:00 2001 From: Niko Tyni Date: Wed, 18 May 2005 11:19:09 +0000 Subject: * branches/2.0/lib/Smokeping/RRDtools.pm, branches/2.0/CHANGES: + RRDtool 1.2.x compatibility fix ("unknown RRD version: 0003" on restart) -- niko, reported by Sam Stickland --- lib/Smokeping/RRDtools.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/Smokeping') diff --git a/lib/Smokeping/RRDtools.pm b/lib/Smokeping/RRDtools.pm index 2b8e3a4..ac70837 100644 --- a/lib/Smokeping/RRDtools.pm +++ b/lib/Smokeping/RRDtools.pm @@ -97,7 +97,8 @@ sub info2create { my $error = RRDs::error; die("RRDs::info $file: ERROR: $error") if $error; die("$file: unknown RRD version: $info->{rrd_version}") - unless $info->{rrd_version} eq '0001'; + unless $info->{rrd_version} eq '0001' + or $info->{rrd_version} eq '0003'; my $cf = $info->{"rra[0].cf"}; die("$file: no RRAs found?") unless defined $cf; -- cgit v1.2.3-24-g4f1b From 205fff014be2afad6cb4430a2fceabea8111c885 Mon Sep 17 00:00:00 2001 From: Niko Tyni Date: Mon, 23 May 2005 18:02:01 +0000 Subject: * Perl 5.8.0 compatibility fix ("missing max for DS uptime") --- lib/Smokeping/RRDtools.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/Smokeping') diff --git a/lib/Smokeping/RRDtools.pm b/lib/Smokeping/RRDtools.pm index ac70837..4a695d1 100644 --- a/lib/Smokeping/RRDtools.pm +++ b/lib/Smokeping/RRDtools.pm @@ -93,6 +93,7 @@ use RRDs; sub info2create { my $file = shift; my @create; + my $buggy_perl_version = 1 if $^V and $^V eq v5.8.0; my $info = RRDs::info($file); my $error = RRDs::error; die("RRDs::info $file: ERROR: $error") if $error; @@ -112,7 +113,8 @@ sub info2create { my @s = ("DS", $ds); for (qw(type minimal_heartbeat min max)) { die("$file: missing $_ for DS $ds?") - unless exists $info->{"ds[$ds].$_"}; + unless exists $info->{"ds[$ds].$_"} + or $buggy_perl_version; my $val = $info->{"ds[$ds].$_"}; push @s, defined $val ? $val : "U"; } @@ -122,7 +124,8 @@ sub info2create { my @s = ("RRA", $info->{"rra[$i].cf"}); for (qw(xff pdp_per_row rows)) { die("$file: missing $_ for RRA $i") - unless exists $info->{"rra[$i].$_"}; + unless exists $info->{"rra[$i].$_"} + or $buggy_perl_version; push @s, $info->{"rra[$i].$_"}; } push @create, join(":", @s); -- cgit v1.2.3-24-g4f1b From 66c8d49cbe278316114a6eef8ccb509c9e67d0ba Mon Sep 17 00:00:00 2001 From: Tobi Oetiker Date: Sun, 3 Jul 2005 22:15:20 +0000 Subject: tune the rrd files for min/max/heartbeat --- lib/Smokeping/RRDtools.pm | 57 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 12 deletions(-) (limited to 'lib/Smokeping') diff --git a/lib/Smokeping/RRDtools.pm b/lib/Smokeping/RRDtools.pm index 4a695d1..2b7ad2b 100644 --- a/lib/Smokeping/RRDtools.pm +++ b/lib/Smokeping/RRDtools.pm @@ -22,12 +22,15 @@ Smokeping::RRDtools - Tools for RRD file handling my $comparison = Smokeping::RRDtools::compare($file, \@create); print "Create arguments didn't match: $comparison\n" if $comparison; + Smokeping::RRDtools::tuneds($file, \@create); + =head1 DESCRIPTION -This module offers two functions, C and C. -The first can be used to recreate the arguments that an RRD file -was created with. The second checks if an RRD file was created -with the given arguments. +This module offers three functions, C, C and +C. The first can be used to recreate the arguments that an RRD file +was created with. The second checks if an RRD file was created with the +given arguments. The thirds tunes the DS parameters according to the +supplied create string. The function C must be called with one argument: the path to the interesting RRD file. It will return an array @@ -35,14 +38,17 @@ reference of the argument list that can be fed to C. Note that this list will never contain the C parameter, but it B contain the C parameter. -The function C must be called with two arguments: the path -to the interesting RRD file, and a reference to an argument list that -could be fed to C. The function will then simply compare -the result of C with this argument list. It will return -C if the arguments matched, and a string indicating the difference -if a discrepancy was found. Note that if there is a C parameter in -the argument list, C disregards it. If C isn't specified, -C will use the C default of 300 seconds. +The function C must be called with two arguments: the path to the +interesting RRD file, and a reference to an argument list that could be fed +to C. The function will then simply compare the result of +C with this argument list. It will return C if the +arguments matched, and a string indicating the difference if a discrepancy +was found. Note that if there is a C parameter in the argument list, +C disregards it. If C isn't specified, C will use +the C default of 300 seconds. C ignores non-matching DS +parameters since C will fix them. + +C talks on stderr about the parameters it fixes. =head1 NOTES @@ -168,10 +174,37 @@ sub compare { while (my $arg = shift @create) { my $arg2 = shift @create2; + my @ds = split /:/, $arg; + my @ds2 = split /:/, $arg2; + next if $ds[0] eq 'DS' and $ds[0] eq $ds2[0] and $ds[1] eq $ds2[1] and $ds[2] eq $ds2[2]; return "Different arguments: $file has $arg2, create string has $arg" unless $arg eq $arg2; } return undef; } +sub tuneds { + my $file = shift; + my $create = shift; + my @create2 = sort grep /^DS/, @{info2create($file)}; + my @create = sort grep /^DS/, @$create; + while (@create){ + my @ds = split /:/, shift @create; + my @ds2 = split /:/, shift @create2; + next unless $ds[1] eq $ds2[1] and $ds[2] eq $ds[2]; + if ($ds[3] ne $ds2[3]){ + warn "## Updating $file DS:$ds[1] heartbeat $ds2[3] -> $ds[3]\n"; + RRDs::tune $file,"--hearbeat","$ds[1]:$ds[3]" unless $ds[3] eq $ds2[3]; + } + if ($ds[4] ne $ds2[4]){ + warn "## Updating $file DS:$ds[1] minimum $ds2[4] -> $ds[4]\n"; + RRDs::tune $file,"--minimum","$ds[1]:$ds[4]" unless $ds[4] eq $ds2[4]; + } + if ($ds[5] ne $ds2[5]){ + warn "## Updating $file DS:$ds[1] maximum $ds2[5] -> $ds[5]\n"; + RRDs::tune $file,"--maximum","$ds[1]:$ds[5]" unless $ds[5] eq $ds2[5]; + } + } +} + 1; -- cgit v1.2.3-24-g4f1b From 7c05e52c7486b782ea8fe83f61eda56f05fd2613 Mon Sep 17 00:00:00 2001 From: Niko Tyni Date: Wed, 27 Jul 2005 11:45:20 +0000 Subject: * 2.0/lib/Smokeping/probes/CiscoRTTMonEchoICMP.pm, 2.0/CHANGES: + bugfix for CiscoRTTMonEchoICMP packetsize variable -- niko, from Sam Stickland --- lib/Smokeping/probes/CiscoRTTMonEchoICMP.pm | 41 ++++++++++++----------------- 1 file changed, 17 insertions(+), 24 deletions(-) (limited to 'lib/Smokeping') diff --git a/lib/Smokeping/probes/CiscoRTTMonEchoICMP.pm b/lib/Smokeping/probes/CiscoRTTMonEchoICMP.pm index f763fde..c542ed1 100644 --- a/lib/Smokeping/probes/CiscoRTTMonEchoICMP.pm +++ b/lib/Smokeping/probes/CiscoRTTMonEchoICMP.pm @@ -92,8 +92,7 @@ sub new($$$) sub ProbeDesc($){ my $self = shift; - my $bytes = $self->{properties}{packetsize}; - return "CiscoRTTMonEchoICMP ($bytes Bytes)"; + return "CiscoRTTMonEchoICMP"; } sub pingone ($$) { @@ -102,7 +101,7 @@ sub pingone ($$) { my $pings = $self->pings($target) || 20; my $tos = $target->{vars}{tos}; - my $bytes = $target->{properties}{packetsize}; + my $bytes = $target->{vars}{packetsize}; # use the proces ID as as row number to make this poll distinct on the router; my $row=$$; @@ -260,27 +259,6 @@ sub DestroyData ($$) { &snmpset($host, "rttMonCtrlAdminStatus.$row", 'integer', 6); } -sub probevars { - my $class = shift; - return $class->_makevars($class->SUPER::probevars, { - packetsize => { - _doc => < 56, - _re => '\d+', - _sub => sub { - my $val = shift; - return "ERROR: packetsize must be between 8 and 16392" - unless $val >= 8 and $val <= 16392; - return undef; - }, - }, - }); -} - sub targetvars { my $class = shift; return $class->_makevars($class->SUPER::targetvars, { @@ -315,6 +293,21 @@ corresponds to a DSCP value 40 and a Precedence value of 5. The RTTMon MIB versions before IOS 12.0(3)T didn't support this parameter. DOC }, + packetsize => { + _doc => < 56, + _re => '\d+', + _sub => sub { + my $val = shift; + return "ERROR: packetsize must be between 8 and 16392" + unless $val >= 8 and $val <= 16392; + return undef; + }, + }, }); } -- cgit v1.2.3-24-g4f1b From 3946df708ae20686c8453eb55be934103daf2f7e Mon Sep 17 00:00:00 2001 From: Niko Tyni Date: Sun, 4 Sep 2005 11:34:08 +0000 Subject: * lib/Smokeping.pm, lib/Smokeping/probes/base.pm, doc/smokeping_upgrade.pod, TODO, CHANGES: + the DYNAMIC-related files (.adr and .snmp) can now be located outside "datadir" by specifying the new configuration variable "dyndir" --- lib/Smokeping/probes/base.pm | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'lib/Smokeping') diff --git a/lib/Smokeping/probes/base.pm b/lib/Smokeping/probes/base.pm index a322a21..c0525b6 100644 --- a/lib/Smokeping/probes/base.pm +++ b/lib/Smokeping/probes/base.pm @@ -90,6 +90,23 @@ sub ProbeDesc ($) { return "Probe which does not overrivd the ProbeDesc methode"; } +sub target2dynfile ($$) { + # the targets are stored in the $self->{targets} + # hash as filenames pointing to the RRD files + # + # now that we use a (optionally) different dir for the + # . adr files, we need to derive the .adr filename + # from the RRD filename with a simple substitution + + my $self = shift; + my $target = shift; # filename with embedded + my $dyndir = $self->{cfg}{General}{dyndir}; + return $target unless defined $dyndir; # nothing to do + my $datadir = $self->{cfg}{General}{datadir}; + $target =~ s/^\Q$datadir\E/$dyndir/; + return $target; +} + sub rrdupdate_string($$) { my $self = shift; my $tree = shift; @@ -107,17 +124,18 @@ sub rrdupdate_string($$) my $upperloss = $loss - $lowerloss; @times = ((map {'U'} 1..$lowerloss),@times, (map {'U'} 1..$upperloss)); my $age; - if ( -f $self->{targets}{$tree}.".adr" ) { - $age = time - (stat($self->{targets}{$tree}.".adr"))[9]; + my $dynbase = $self->target2dynfile($self->{targets}{$tree}); + if ( -f $dynbase.".adr" ) { + $age = time - (stat($dynbase.".adr"))[9]; } else { $age = 'U'; } if ( $entries == 0 ){ $age = 'U'; $loss = 'U'; - if ( -f $self->{targets}{$tree}.".adr" - and not -f $self->{targets}{$tree}.".snmp" ){ - unlink $self->{targets}{$tree}.".adr"; + if ( -f $dynbase.".adr" + and not -f $dynbase.".snmp" ){ + unlink $dynbase.".adr"; } } ; return "${age}:${loss}:${median}:".(join ":", @times); @@ -131,12 +149,13 @@ sub addresses($) foreach my $tree (keys %{$self->{targets}}){ my $target = $self->{targets}{$tree}; if ($target =~ m|/|) { - if ( open D, "<$target.adr" ) { + my $dynbase = $self->target2dynfile($target); + if ( open D, "<$dynbase.adr" ) { my $ip; chomp($ip = ); close D; - if ( open D, "<$target.snmp" ) { + if ( open D, "<$dynbase.snmp" ) { my $snmp = ; chomp($snmp); if ($snmp ne Smokeping::snmpget_ident $ip) { -- cgit v1.2.3-24-g4f1b