[Nagiosplug-devel] nagios plugin question

Duncan Ferguson duncan.ferguson at opsera.com
Wed Oct 14 10:18:28 CEST 2009


On 13 Oct 2009, at 19:01, shadih rahman wrote:

> 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,
> );

Remove the [ ]'s, i.e.

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

   Duncs

-- 
Duncan Ferguson
Senior Developer




Opsera Limited | Unit 69 Suttons Business Park
Reading | Berkshire | RG6 1AZ | UK

Phone:   +44 (0) 845 057 7887
Mobile:   +44 (0) 7968 148 748
Skype:   duncan_j_ferguson     Email:   duncan.ferguson at opsera.com
www.opsera.com

Opsera Limited is registered in the UK under Company Number 5396532.  
Our registered office is Gorse View, Horsell Rise, Woking, Surrey,  
GU21 4RB.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nagios-plugins.org/archive/devel/attachments/20091014/3c2e91a2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 749 bytes
Desc: not available
URL: <http://nagios-plugins.org/archive/devel/attachments/20091014/3c2e91a2/attachment.gif>


More information about the Devel mailing list