Httpv2 check issue with "body-string" and checking for a minus "-"

CMK version: 2.3.0p6
OS version: Debian 12

The following check is not possible: check_mk_active-httpv2!–url http://$HOSTADDRESS$/crl.pem --body-string ‘-----END X509 CRL-----’

Trying this check on the command line show that the “-” (Minus) cant be used in “body-string”, not with single quotes and also not with double quotes:

OMD[XXXsiteXXX]:~/lib/nagios/plugins$ /omd/sites/XXXsiteXXX/lib/nagios/plugins/check_httpv2 --url “http://XXXipaddressXXX/crl.pem” --body-string ‘-----END X509 CRL-----’
error: unexpected argument ‘-----END X509 CRL-----’ found

As soon as I remove the “-----” and only check for ‘END X509 CRL’ it works fine.

not sure I understand are you placing a certificate on a webserver so anyone can download it? what do you want to do with the cert in checkmk?

Hi,

I think you need to escape the minus sings since there are interpreted as additional arguments.
This should work:

./check_httpv2 --url http://XXXipaddressXXX/crl.pem](http://xxxipaddressxxx/crl.pem) --body-string “-----END X509 CRL-----”

Best Regards
Thomas

Hi @T.Schmitz, @Anders,

not really, I tried with single and double quotes and also with escaping on single “-” (Minus).

Please see the screenshot, I hope it explains what I mean:

As soon as you want to check for something that includes a “-” (Minus) it won’t work.
I tested today with 2.3.0p11 with the same behavior.

if you run curl and grep for your data is its found I guess? just to rule that out

Yes the data is fine. As you can see in the output, the minus causes a failure in the check as it is interpreted as an option/argument even it is in quotes.

Ok,
just a question, why do you need the whole ----- part? Would’t “END X509 CRL” work?

Hi @Anders,

sure. This works.
But nevertheless there is a misbehaviour in the check that you can’t check for “minus” characters.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.