Http_check doesn't work

I want to check if from our company network the internet is available but the checks doesn’t work.
image

It would be wonderfully if somebody could help us with the configuration in the icinga director :slight_smile:

Hi,

Could you show us what the director is rendering? Go to the preview tab for this. It should look like this, if you click to “show resolved”:

maybe you forgot some parameters.

You could try this with other websites. Because maybe the companys websites you want to check, they don’t allow such things :wink:

HI Stevie,
thanks for your replay.

image

image

Check the command line that is executed when running the check.
You can view that by clicking the “Inspect” link on the service details page in the “Actions” section:
image

Then I suggest simply trying out the check on the command line first until it works, and then implement it with the correct parameters.
the check_http plugin has a quite extensive help output, where you can find all the needed/optional commands: check_http -h
Try yourself out and if you have troubles finding the correct parameters, ask here again :slight_smile:

@tom2
I meant the result of “show resolved”. To see the complete command definition. Because with this we also see the parameters from your template “http_check”.
A similar result you get with the “inspect” button what @log1c suggests. Here you get the resolved service definition into how icinga calls the check_http-command with all the the paramters you defined in the director.

An idea could be you have to enable the options “http_sni” (check_http parameter “–sni”) and/or “http_follow” (check_http parameter “-f” incl. an value like follow) in your definition in the director

root@icinga-server:/usr/lib/nagios/plugins# ./check_http -H modellbaushop-bohun.de
HTTP OK: HTTP/1.1 200 OK - 19424 bytes in 1.125 second response time |time=1.125354s;;;0.000000;10.000000 size=19424B;;;0
root@icinga-server:/usr/lib/nagios/plugins# ./check_http -H dhl.de
CRITICAL - Socket timeout after 10 seconds
root@icinga-server:/usr/lib/nagios/plugins# ./check_http -H www.dhl.de
HTTP OK: HTTP/1.1 301 Moved Permanently - 1069 bytes in 0.047 second response time |time=0.047087s;;;0.000000;10.000000 size=1069B;;;0
root@icinga-server:/usr/lib/nagios/plugins# ./check_http -H www.tnt.de
HTTP OK: HTTP/1.0 302 Found - 119 bytes in 0.804 second response time |time=0.804345s;;;0.000000;10.000000 size=119B;;;0
root@icinga-server:/usr/lib/nagios/plugins#

Thanks for your help.
Form the command line I am able to perform successfully HTTP checks. How can I do this in the same way in the icinga director?

run this checks also with the icinga/nagios user to be sure, that the checks are running also fine there.
And if the http codes 301 and 302 you should also try the parameter “-f” as I wrote above

sudo -u nagios ./check_http -H www.tnt.de
HTTP OK: HTTP/1.0 302 Found - 119 bytes in 0.040 second response time |time=0.039732s;;;0.000000;10.000000 size=119B;;;0

You need to fill the correct variable that belongs to the -H parameter (instead of -I)

As @stevie-sy said, try the -f parameter with follow for 301/302 return codes.

How can I test the HTTPS?

sudo -u nagios ./check_http -H https://www.dhl.de
Temporary failure in name resolution
HTTP CRITICAL - Unable to open TCP socket

Did you have a look at /usr/lib64/nagios/plugins/check_http -h?
All parameters are listed there and some examples as well.

Also take a look at the command definition inside the director so you know which variable fields to use:
http://YOUR-MONITORING-HOST/icingaweb2/director/commands?type=external_object#!/icingaweb2/director/command/render?name=http

Could you please explain how to setup the icinga dirctor?
This is working:
./check_http -H www.tnt.de
I want perform the same check in the director. Please let me know where and what I have to enter in the director.

It would be really great if you could tell me what I have to write in this fields:

If you take a look into the command definition you need an other field than “http_address” if it is working with the -H parameter:

.
If you add the field “http_vhost” to your template and/or check command, it should work also with the director

1 Like

Thank you very much. It works. Issue is solved :slight_smile: