Page 1 of 1

Workaround for Getopt errors

Posted: Sun Jun 10, 2012 8:47 pm
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

Re: Workaround for Getopt errors

Posted: Mon Jun 11, 2012 10:09 am
by agriffin
Thanks for sharing this!