Page 1 of 2

Plugin check_http takes too long to response

Posted: Thu Sep 26, 2019 3:47 pm
by jguzzetti
Hello!
We are using Nagios XI for monitoring a huge sort of types of checks for lot of services and hosts of Nación Servicios S.A. . One of the groups of checks is all the backend of “Cuándo SUBO”, a mobile app which tells you when a bus is going to be in the bus stop, and we have thousands of users with those apps (Android and iOS platforms).

Recently, we tried to deploy a new http check with the check_http plugin, for a webservice, but we have a critical issue that it seems to be a performance problem of the plugin. We already use the same plugin for others checks of others webservicies and it seems to work fine, but not for this group.

We want to check three methods of the webservice registering the size and response time, but it takes a lot of time to get the response when we use the plugin; but it takes a short time when we call the webservice using wget from shell.

Attacheds, you can see the screenshots with the details of the test we made for one of the methods:
Nagios - UI - Result (timed out).PNG: Check “running” with timed out result, more than 60 seconds.
Nagios - Shell - Using plugin check_http.PNG: Shell execution with the plugin taking 202 seconds.
Nagios - Shell - Without using plugin.PNG: Shell wget execution without plugin taking 0.6 seconds.


By the way, we have another theme, probably an issue:
We found that the graphs always shows amounts with decimals, and that’s not ok, because the result of the sql query we use responds always with integers. We use the “check_mssql_health --mode sql” plugin to count and check the amount of buses transmitting.

We hope you can support us with this problems.
Thank you very much!
Best regards

Re: Plugin check_http takes too long to response

Posted: Thu Sep 26, 2019 4:13 pm
by cdienger
Try running check_http without the "-m" option and also running it with the "-v" option to see the verbose output. Also, does the site require authentication? If so, you can pass username and password using "-a username:password".

The performance data graphs will sometimes show numbers with decimals and there isn't a good way to avoid this. It's a result of how values are calculated and stored in the rrd databases.

Re: Plugin check_http takes too long to response

Posted: Fri Sep 27, 2019 8:39 am
by jguzzetti
I run the plugin just like you said, without the -m and aggregating -v to verbose output. The webservice doesn't require authentication. Here is the output:
HTTP CRITICAL: HTTP/1.1 200 OK - 40705158 bytes in 239.829 second response time |time=239.828581s;45.000000;60.000000;0.000000 size=40705158B;;;0 time_connect=0.001923s;;; time_headers=0.000014s;;; time_firstbyte=1.720260s;;; time_transfer=239.826502s;;;
Request:
GET http://xxxxxxxxxxxxxxxxxxx.xxxxxxxxx.xx ... xxx?json=1 HTTP/1.0
User-Agent: check_http/v2.2.1 (nagios-plugins 2.2.1)
Connection: close
Accept: */*

Re: Plugin check_http takes too long to response

Posted: Fri Sep 27, 2019 12:29 pm
by cdienger
It may be related to the HTTP/1.0 protocol that is being used. We can change this in the binary as a test. Please provide me a copy of the /usr/local/nagios/libexec/check_http and I can provide a modified plugin for you to test with.

Re: Plugin check_http takes too long to response

Posted: Fri Sep 27, 2019 12:47 pm
by jguzzetti
Great! Here you´ve got the binary.

Re: Plugin check_http takes too long to response

Posted: Fri Sep 27, 2019 1:25 pm
by cdienger
Attached modified plugin. Run it with the same options as the previous attempt.

Re: Plugin check_http takes too long to response

Posted: Fri Sep 27, 2019 1:54 pm
by jguzzetti
Anyway, it tooks a lot of time.
HTTP CRITICAL: HTTP/1.1 200 OK - 37731158 bytes in 206.706 second response time |time=206.705544s;45.000000;60.000000;0.000000 size=37731158B;;;0

Re: Plugin check_http takes too long to response

Posted: Fri Sep 27, 2019 2:03 pm
by cdienger
I'd like to get a capture of the traffic as you run the curl command and the plugin. From the command line run:

Code: Select all

tcpdump -s 0 -i any host w.x.y.z -w output.pcap
w.x.y.z is the IP address of the web server. Then run the curl command followed by the check_http command on another terminal session. You only need to let the check_http command run 5-10 seconds before using CTRL+C to stop the tcpdump. Please zip and PM me the output.pcap file this creates.

Re: Plugin check_http takes too long to response

Posted: Mon Sep 30, 2019 10:40 am
by jguzzetti
I send to you the output attached.

Re: Plugin check_http takes too long to response

Posted: Mon Sep 30, 2019 2:55 pm
by mbellerue
Could you try adding these flags to your wget command and tell us if the command takes a long time to process?

Code: Select all

--header="Connection: Keep-Alive" --useragent="Wget/1.14 (linux-gnu)"