Trying to develop a new perl plugin

Onotsky, Steve x55328 Steve.Onotsky at broadridge.com
Mon Jan 24 16:54:13 CET 2011


> From: Nibin VM [mailto:nibin.vm at piserve.com] 
> Sent: January-24-11 10:17
> To: Nagios Users List
> Subject: Re: [Nagios-users] Trying to develop a new perl plugin
>
> $host=$ARGV[0];
> 
> It isn't taken correctly when its executed from nagios. Please somebody tell me what code should 
> I put if I need to specify the host name like ./test.pl -H "hostname"?

My Perl is a bit rusty, but wouldn't '$host=$ARGV[0]' have a value of "-H" with these command line arguments (with "hostname" getting ignored because only the first element of the ARGV array is specified)?

Perhaps something like Getopt::Long might get you were you need (or just leave off the '-H' and pass only the hostname)?

Or did I miss the point somewhere?  :)

Cheers
Steve

This message and any attachments are intended only for the use of the addressee and
may contain information that is privileged and confidential. If the reader of the 
message is not the intended recipient or an authorized representative of the
intended recipient, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this communication in
error, please notify us immediately by e-mail and delete the message and any
attachments from your system.


------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list