[Nagiosplug-devel] Perl Modul Nagios::Plugin and extra-opts - request for comments
Stephan at quantentunnel.de
Wed May 30 22:59:03 CEST 2012
Holger Weiß asked me to introduce here what I intend to do.
I lately started to use Nagios::Plugin for a plugin I developed at work.
I came across the --extra-opts parameter and thought that this could be
Unfortunately I seem to found a bug - or at least - inconsistant behaviour.
When you pass on commandline something like --opt "test value" you get
in your variable:
But if you put into the extra-opts file
Okay, I could live with the plugin not removing the quotes, so I put
into the extra-opts file
But guess what I got:
So N::P is introducing quotes here.
So my first idea is to get rid of those quotes.
Unfortunately this will break some of the tests, as they rely on the sub
_cmdline which generates, from the internal options array, a commandline.
But this sub is, as far as I can see, only used for this test and
Additionally the quoting is done wrong or at least for an OS I don't
know as quotes inside the string are not escaped. So this
opt=a 2.5" hard disc
"a 2.5" hard disc"
So the questions I have are:
1) For what reason was the quoting introduced - except for the tests?
2) For which platform is it intended? For sure no *IX
3) Is it required?
I'd vote for getting rid of the quoting.
My second idea is to introduce multiline values in the extra-opts file.
This would simply be done in the usual way, by putting a backslash "\"
as last charater of the line. All the lines will be concatenated by a
single space after first triming them. So
multi line value
Last but not lest I'd like to introduce a HERE-document like syntax in
conformance to Config::General. Example:
line1\nline 2\nline 3\n
and, as the amount of whitespace before the end-marker is removed from
all the lines:
line1\n line2\nline 3\n
What do you think about my ideas?
More information about the Devel