[Nagiosplug-devel] Perl Modul Nagios::Plugin and extra-opts - request for comments
Stephan
Stephan at quantentunnel.de
Sat Jun 2 23:18:52 CEST 2012
Am 01.06.12 02:01, schrieb William Leibzon:
> Yes, get rid of quotes. But please introduce either one multi-line syntax
> or the other (and I prefer just \ at the end of line) and document that
> use. I'll soon have to write my own implementation compatible with
> --extra-opts and I don't want to have to support 3 different ways either.
Hmm... The HERE-document and the multiline with backslashes are not
interchangeble.
With the HERE-document you introduce newlines and indentations into the
strings.
With multiline you simply break up a longish string for readability.
So I'd still like to have both.
Let me give you an example.
For my current plugin I need to provide to the script an LQL command
sequence (see http://mathias-kettner.de/checkmk_livestatus.html for an
explanation).
So I need to provide something like this:
GET services
Filter: description = my service
Filter: host_custom_variables = _COUNTRY DE
Filter: scheduled_downtime_depth = 0
Filter: host_scheduled_downtime_depth = 0
Stats: state = 0
Stats: state = 1
Stats: state = 2
Stats: state > 2
I "solved" this by introducing an option command and putting into extra-opt:
command=GET services
command=Filter: description = my service
command=Filter: host_custom_variables = _COUNTRY DE
command=Filter: scheduled_downtime_depth = 0
command=Filter: host_scheduled_downtime_depth = 0
command=Stats: state = 0
command=Stats: state = 1
command=Stats: state = 2
command=Stats: state > 2
While this is feasible, I'd still prefer the way it can be done in
Config::General (a module I know for some time now)
commands=<<END
GET services
Filter: description = my service
Filter: host_custom_variables = _COUNTRY DE
Filter: scheduled_downtime_depth = 0
Filter: host_scheduled_downtime_depth = 0
Stats: state = 0
Stats: state = 1
Stats: state = 2
Stats: state > 2
END
More information about the Devel
mailing list