Workaround for Getopt errors

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
sburlappp
Posts: 1
Joined: Sun Jun 10, 2012 8:40 pm

Workaround for Getopt errors

Post by sburlappp »

Just in case you had as much trouble finding a solution to this as I have....

The embedded Perl in Nagios sometimes passes in "undef" parameters when $ARGx$ strings are left empty in command definitions, and Getopt tries to do a regex match on them before checking for "undef". The workaround is to either make sure to never have undefined-but-referenced $ARGx$ strings, or to add this near the beginning of the Perl script:

Code: Select all

# nagios: +epn
# Workaround for Getopt missing-parameter bug
@ARGV = grep defined, @ARGV;
Better yet, patch p1.pl to do this.

http://tracker.nagios.org/view.php?id=88
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Workaround for Getopt errors

Post by agriffin »

Thanks for sharing this!
Locked