Hello experts,
I would like to know if there is any way to submit a string of argument that contains space and double quotation to check_nrpe. So for example, my line would be something like:
check_nrpe -H 192.168.0.1 -c nagios_mychecker -a "--userName phan --mode check_error --errorCode "AA 001" --warnThreshold 70 --critThreshold 75"
The double quote and the space are literally part of the strings I am looking for. I could do without the double quote, but omitting the space would cause the script to return too many false findings.
Using Argument with Space and Double Quote in check_nrpe
Re: Using Argument with Space and Double Quote in check_nrpe
I'm not 100% sure but something along the lines of "\"AA 001\"" may work... escaping the quotes so they become literal, although if you just want the space; what you have already done should work.
Re: Using Argument with Space and Double Quote in check_nrpe
Hi,
I did try the escape backslash, but that did not work unfortunately.
What I had would work if I just execute the script by itself, but as soon as I put the parameters in the -a switch of check_nrpe, it doesn't work.
I did try the escape backslash, but that did not work unfortunately.
What I had would work if I just execute the script by itself, but as soon as I put the parameters in the -a switch of check_nrpe, it doesn't work.
Re: Using Argument with Space and Double Quote in check_nrpe
Oh I see I missed the first set of quotes... does single quoting the inner set work? I.e. 'AA 001' instead
Re: Using Argument with Space and Double Quote in check_nrpe
Tried the single quote around the parameter value, didn't work either.
Tried the single quote around the entire sentence to be passed to the -a switch, didn't work either.
Tried to put the double quote around the $ARGS1 in nrpe.cfg, but that did not work either.
So I ended up hardcoding the parameter value in my script to bypass that, but I am sure there should/need to be a way to get around this.
Tried the single quote around the entire sentence to be passed to the -a switch, didn't work either.
Tried to put the double quote around the $ARGS1 in nrpe.cfg, but that did not work either.
So I ended up hardcoding the parameter value in my script to bypass that, but I am sure there should/need to be a way to get around this.
Re: Using Argument with Space and Double Quote in check_nrpe
space and double quotes work fine. you have to take care of single quotes, either exclude them or replace them with two double quotes at a time.
Re: Using Argument with Space and Double Quote in check_nrpe
Escaping parameters with the back slash does and should work... I'm just not sure why it's not behaving as expected in this instance .
At any rate at least you've found a solution for the time being.
At any rate at least you've found a solution for the time being.