[smokeping-users] Probe Target Variable Definition

Russell Dwarshuis rjd at merit.edu
Wed Dec 10 22:10:43 CET 2014


I don't see anything obviously wrong.

Just so we understand what is happening, everything works until you add the version statements?  The probe does everything correctly and there are no perl errors?  There is not a version variable in your config file?


Russell Dwarshuis 

----- Original Message -----
From: "Tony DeMatteis" <tonyd at commspeed.net>
To: "Russell Dwarshuis" <rjd at merit.edu>
Cc: smokeping-users at lists.oetiker.ch
Sent: Wednesday, December 10, 2014 12:06:59 PM
Subject: Re: [smokeping-users] Probe Target Variable Definition

Line 307 is the beginning of the "return 
$class->_makevars($class->SUPER::targetvars, {" statement

My addition to add the "version" option is found/added at the end of the 
$class->_makevars definition.  Notice, I am not add "version" to the 
_manditory argument as I don't want to require the option.

sub targetvars {
     my $class = shift;
     return $class->_makevars($class->SUPER::targetvars, {
         _mandatory => [ 'iosuser', 'iospass', 'source' ],
         source => {
             _doc => <<DOC,
The source option specifies the Router to which we connect.  This
is an IP address of a host that you/your server:
     1)  Have the ability to connect
     2)  Have a valid username and password for
DOC
             _example => "192.168.2.1",
         },
         psource => {
             _doc => <<DOC,
The (optional) psource option specifies an alternate IP address from
which you wish to source your pings from.  Routers can have many many
IP addresses, and interfaces.  When you ping from a router you have
the ability to choose which interface and/or which IP address the ping
is sourced from.  Specifying an IP/interface does not necessarily
specify the interface from which the ping will leave, but will specify
which address the packet(s) appear to come from.  If this option is
left out the router will source the packet automatically
based on routing and/or metrics.  If this doesn't make sense to you
then just leave it out.
DOC
             _example => "192.168.2.129",
         },
         iosuser => {
             _doc => <<DOC,
The iosuser option allows you to specify a username that has ping
capability on the host Router.
DOC
             _example => 'user',
         },
         iospass => {
             _doc => <<DOC,
The iospass option allows you to specify the password for the username
specified with the option iosuser.
DOC
             _example => 'password',
         },
     version => {
       _doc => <<DOC,
The version option specifies version.
DOC
       _example => "6.20",
     },
     });
}

On 12/10/2014 09:32 AM, Russell Dwarshuis wrote:
> Can you post the code to pastebin.com or some place else so we can look at it?
>
> What is on line 307??
>
>
> Russell Dwarshuis
>
> ----- Original Message -----
> From: "Tony DeMatteis" <tonyd at commspeed.net>
> To: smokeping-users at lists.oetiker.ch
> Sent: Wednesday, December 10, 2014 11:07:35 AM
> Subject: Re: [smokeping-users] Probe Target Variable Definition
>
> Hi all,
>
> Please, would anybody have a comment on my question? Do you require more
> information?
>
> Thank you
>
> td
>
> On 12/07/2014 01:29 PM, Tony DeMatteis wrote:
>> Greetings,
>>
>> I've written a probe and would like to define a target variable. The
>> probe is working as expected.  However, I am having some difficulty
>> determining why my target variable definition is resulting in an error.
>>
>> Dec  7 11:25:38 smokeping1 smokeping[12632]: Can't call method
>> "SUPER::targetvars" on an undefined value at
>> /usr/share/perl5/Smokeping/probes/MyCustomProbe.pm line 307
>>
>> Here I've added the following to the sub targetvars {} of my probe.
>>
>>       version => {
>>         _doc => <<DOC,
>>   The version option specifies the version.
>>   DOC
>>         _example => "6.20",
>>       },
>>
>> It is not defined in the _mandatory => [] struct as I don't want it to
>> be a mandatory variable, but optional.
>>
>> The probe loads without any errors on service start up.  I can add the
>> version variable to a Target definition and it is passed to my probe.
>> However, I can't isolate the cause of the error above other than I
>> know it's due to the added target variable definition.
>>
>> Any direction would be greatly appreciated.  I would like to finish
>> and polish off this probe so that I can publish it.
>>
>> Thank you
>>
>> td
> _______________________________________________
> smokeping-users mailing list
> smokeping-users at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/smokeping-users
>



More information about the smokeping-users mailing list