Check_http with proxy

Hello,

I want to check a website, to access this I have to use our http proxy. Tecnicalls, the connection to proxy is done via http on port 80 and then after the CONNECT request, the ssl connection will be made. When I call the nagios plugin directly, it is working.

OMD[XXX]:~/lib/nagios/plugins$ ./check_http -I proxy.mycorp.local -p 80 -u https://website.mycorp.com --ssl -j CONNECT -H website.mycorp.com
HTTP OK: HTTP/1.1 200 OK - 840 bytes in 0.102 second response time |time=0.102258s;;;0.000000;10.000000 size=840B;;;0

But when I configure WATO, it does not work. I configured paramst to be even to the Nagius plugin. ANd after searching in the cmk check_http I think it should be like this. The params are the same, die -j CONNECT will be appended with the proxy setting.

check_mk_active-http!‘-I’ ‘proxy.mycorp.local’ ‘-H’ ‘website.mycorp.com’ ‘-p’ 80 ‘-u’ ‘https://website.mycorp.com’ ‘–ssl’
140533783902128:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:794:

I tested some different settings (port, with/without ssl, vhost and uri), but I cant get it working inside cmk. Does anyone have a idea?

Edit: how to do/test an active check from command line? cmk -nvv website.mycorp.com (hostname in WATO) returns always OK.

You test it by calling the Nagios plugin like you did in your first example.

Hi Robert,

yes, but calling the Nagios plugin works. So I wanted to call the cmk active check, but I dont know how. The cmk command doesnt do it and because of the imports and variable I cannot call the active check directly. I want to check that it calls the plugin with the right parameters.

I had a lot of issues configuring proxies in http_checks but I found out one (stupid) trick. Even though the get method is a default you need to tickle the box and let it with get, don’t ask me why but it worked.
Can you paste a print screen of your rule ? and omit confidential data ? I’m asking you this because right now I don’t have access to my instance.

Edit:
In order to test it via cli you can do the following.
Search for the check, you can use this to look for other checks you want to try
#cmk -L | grep check_http

With the name of check, run this with your parameters:
#cmk --checks=check_http <options>

Removed edit2 because the solution was to make Get method explicit.

1 Like

Great, explicit setting http method to CONNECT did the trick, now it is working. I also realized why, the -j parameter is only appended by the check when doing certificate checks, not for hormal website checks. I will check this in current release (still on 1.5) and maybe raise an ticket.

Thank you so much!

1 Like

Oh it is the version that cracked my head with this! Glad I helped you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.