From b9ddd9310ea896a5e644f784013a386d9e7212a9 Mon Sep 17 00:00:00 2001 From: Tobi Oetiker Date: Fri, 11 Feb 2005 20:48:36 +0000 Subject: niko has revamped smokeping to parse configuration much more strictly. It is all documented in software/doc/smokeping_upgrade.pod --- lib/probes/CiscoRTTMonEchoICMP.pm | 163 +++++++++++++++++++++++--------------- 1 file changed, 98 insertions(+), 65 deletions(-) (limited to 'lib/probes/CiscoRTTMonEchoICMP.pm') diff --git a/lib/probes/CiscoRTTMonEchoICMP.pm b/lib/probes/CiscoRTTMonEchoICMP.pm index 9871813..c497ed9 100644 --- a/lib/probes/CiscoRTTMonEchoICMP.pm +++ b/lib/probes/CiscoRTTMonEchoICMP.pm @@ -1,49 +1,39 @@ package probes::CiscoRTTMonEchoICMP; -# please use -# pod2man CiscoRTTMonEchoICMP.pm | nroff -man | more -# to view the manpage of this document -# +=head1 301 Moved Permanently +This is a Smokeping probe module. Please use the command -=head1 NAME +C -probes::CiscoRTTMonEchoICMP - Probe for SmokePing +to view the documentation or the command -=head1 SYNOPSIS +C - *** Probes *** - + CiscoRTTMonEchoICMP - + forks=50 +to generate the POD document. - *** Targets *** - + MyRouter-PingVictim - menu = MyRouter->PingVictim - title = RTTMon ping from MyRouter to PingVictim - host = PingVictim.foobar.com.au - ++ PROBE_CONF - ioshost = RTTcommunity@Myrouter.foobar.com.au - iosint = 10.33.22.11 - packetsize = 1024 - tos = 160 +=cut -=head1 DESCRIPTION +use strict; +use base qw(probes::basefork); +use Symbol; +use Carp; +use BER; +use SNMP_Session; +use SNMP_util "0.97"; +use ciscoRttMonMIB "0.2"; +sub pod_hash { + my $e = "="; + return { + name => < < < < < <{properties}{packetsize} || 56; + my $bytes = $self->{properties}{packetsize}; return "CiscoRTTMonEchoICMP ($bytes Bytes)"; } @@ -122,12 +100,9 @@ sub pingone ($$) { my $self = shift; my $target = shift; - croak ("please define 'ioshost' under the PROBE_CONF section of your target\n") - unless defined $target->{vars}{ioshost} ; - my $pings = $self->pings($target) || 20; - my $tos = $target->{vars}{tos} || 0; - my $bytes = $target->{vars}{packetsize} || 56; + my $tos = $target->{vars}{tos}; + my $bytes = $target->{properties}{packetsize}; # use the proces ID as as row number to make this poll distinct on the router; my $row=$$; @@ -285,5 +260,63 @@ 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, { + _mandatory => [ 'ioshost' ], + ioshost => { + _example => 'RTTcommunity@Myrouter.foobar.com.au', + _doc => < { + _example => '10.33.22.11', + _doc => < { + _example => 160, + _default => 0, + _doc => <