NagiosEnterprises / nrpe

NRPE Agent
GNU General Public License v2.0
257 stars 133 forks source link

Variable Argument Length not possible for commands #239

Open andreasgottwald opened 4 years ago

andreasgottwald commented 4 years ago

Hey there guys,

we are using nrpe for unix-hosts and nsclient for windows-hosts. In the latter they allowed to pass a varible length of arguments with the simple implementation of $ARGS$ - so it knows that all Arguments after "-a" should be considered as one.

So our command config looks like this:

check_filer=check_filer.ps1 $ARGS$

Icinga sends this: '-c' 'check_filer' '-a' '-Path' '\server\share' '-Crit' '5' '-Warn' '10' '-Mode' 'FreePercent' '-Username' 'svc_fileruser' '-Unit' 'gb' '-PerfData' '-CredentialFile'

Icinga is configured through Icinga Director - and it is able to add or remove arguments if needed.

Output works fine.

So now to nrpe - it is sadly not possible to send variable length arguments to nrpe. This would shorten down a lot of the config files as you don't have to configure every little different argument, making a combination of - let's say 10 arguments about 90 different commands you can implement. Simplest way of course is just implement all arguments, but if your script just accept either or this, it's not possible to do it.

Or in the simplest way, let's say we want to change only the warning level, we have to write a new command with -warn $ARG2$ etc.

Could you implement an Argument All in One for NRPE?

so we can trim down from

[command]=command -c something -a $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$ $ARG7$ etc. to [command]=command -c something -a $ARGS$

ericloyd commented 4 years ago

Is there a reason you can't just use ARG1 as your "all arguments" and pass it in directly? Just quote it properly and it should work. We do this type of thing all the time.

andreasgottwald commented 4 years ago

Are you using icinga 2 with director? You can pass it as arguments, but it will only take the first one then and ignore the rest.

Gesendet von Outlook Mobile

On Mon, May 18, 2020 at 7:27 PM +0200, "Eric Loyd" notifications@github.com wrote:

Is there a reason you can't just use ARG1 as your "all arguments" and pass it in directly? Just quote it properly and it should work. We do this type of thing all the time.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

ericloyd commented 4 years ago

Nope. Which tells me that it's an Icinga or Director issue.

andreasgottwald commented 4 years ago

If that was the case, it wouldn’t work with NSClient =) and that does.

Could you provide me with on of your setup files, where you use them like that? Especially the part where you mentioned “setting the quotations right” 😊

Thanks

Andreas

Von: Eric Loyd notifications@github.com Gesendet: Montag, 18. Mai 2020 20:58 An: NagiosEnterprises/nrpe nrpe@noreply.github.com Cc: andreasgottwald andreas@gottwald.li; Author author@noreply.github.com Betreff: Re: [NagiosEnterprises/nrpe] Variable Argument Length not possible for commands (#239)

Nope. Which tells me that it's an Icinga or Director issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/NagiosEnterprises/nrpe/issues/239#issuecomment-630376002 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AHIIZFXHWZWSLQKXSXVOZFDRSGAMZANCNFSM4NEIOQEA . https://github.com/notifications/beacon/AHIIZFQOZG3UK6P74FNC3CLRSGAMZA5CNFSM4NEIOQEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEWJMMQQ.gif

ericloyd commented 4 years ago

We have hundreds of installations for me to go through to find a specific example. Give me a bit. :-)

andreasgottwald commented 4 years ago

Of course