[Nagiosplug-devel] nagios plugin question

shadih rahman shadhin71 at gmail.com
Tue Oct 13 20:01:46 CEST 2009


All,
   I am trying to define an argument in plugin with default value.  However
whenever I give the argument a default value then it creates an array
instead of scalar variable.  can someone please tell me how to define a
default value for an argument which can be accessed as a scalar?  Thanks in
advance.


argument section

$plugin->add_arg(
    spec       => 'protocol|P=s',
    help       => [
    "snmp protocol",
    ],
    label      => [ 'protocol'],
    default    => [ '2c' ],
    required   => 0,
);


$plugin->getopts;
my ( $opts ) =$plugin->opts;
my $protocol=$opts->get('protocol');

Now $protocol contains a pointer to array.  I want to $protocol to be just a
sclar variable contain the string '2c'


-- 
Cordially,
Shadhin Rahman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20091013/f023c716/attachment.html>


More information about the Devel mailing list