[Nagiosplug-devel] [RFC] Plugins config file
Ton Voon
ton.voon at altinity.com
Thu Oct 19 10:37:23 CEST 2006
On 19 Oct 2006, at 00:35, Gavin Carr wrote:
> On Wed, Oct 18, 2006 at 11:56:54AM -0800, Vonnahme, Nathan wrote:
>>
>> Wouldn't stanza@/path/to/file be more logical?
>>
>> Perhaps a CGIish questionmark would work?
>> --extra-opts=/path/to/file?stanzaname
>>
>> Actually it would probably be clearer and more memorable to have two
>> optional options, so you can omit one easily:
>> --cfg-file=/path/to/file --cfg-stanza=stanzaname
>
> One further wrinkle - a fairly typical use case, I imagine, will be
> that I want to use extra options from the default file and the default
> section (i.e. plugin name?). It would be nice to be able to support
> that too ...
>
> --extra-opts ?
> --extra-opts=1 ?
>
> I like Nathan's suggestion of separate args too though. Hmmm.
I'd echo Sean's "don't make this too complicated right now" message.
My conceptual idea of these extra opts is that when you hit --extra-
opts=???, this option is effectively replaced in line with the
options in the config file. You may have other options in front or
behind. Assume:
{default config file}
[check_mysql]
username=tonvoon
password=secret
[more_options]
username=altinity
warning=10
critical=15
Then:
./check_mysql -S --extra-opts= -H localhost
is effectively:
./check_mysql -S --username=tonvoon --password=secret -H localhost
However, if you use Nathan's separate args form, you'd have to parse
all the options before you can replace (as you may not want the
default stanza name). Also where do you replace?
./check_mysql -S --cfg-file= -H localhost --cfg-stanza=
Do you replace --cfg-file or --cfg-stanza? I think to avoid the
confusion (at the expense of a more obscure syntax), it should be a
single option. This then allows Gavin's request of having multiple
options. So:
./check_mysql -S --extra-opts= --extra-opts=more_options -H localhost
Is effectively:
./check_mysql -S --username=tonvoon --password=secret --
username=altinity --warning=10 --critical=15 -H localhost
I think this is fairly intuitive. Notice username is listed twice. I
don't think the "replacement opts" function should care what has
passed before or after - it just puts everything down since some
plugins expect arguments a multiple number of times (check_disk -p / -
p /var). How the plugin responds to double requests is the plugin's
responsibility.
Ooh, I'm getting excited! Where can I sign up?
Ton
http://www.altinity.com
T: +44 (0)870 787 9243
F: +44 (0)845 280 1725
Skype: tonvoon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nagios-plugins.org/archive/devel/attachments/20061019/f647b34c/attachment.html>
More information about the Devel
mailing list