Hi,I having having issues using http_response plugin for some sites. Below is the configuration for the one having issue.
[[inputs.http_response]]
urls = ["https://flipkart.com"]
follow_redirects = true
interval = "5m"
response_timeout = "2m"
name_override = "http_url_check"
I have increased the timeout to 2m to see that it is not a network issue.below is what I get in the logs.
http_url_check,host=Rocky1,method=GET,result=success,server=https://flipkart.com,status_code=500 result_type="success",result_code=0i,response_time=15.091712928,http_response_code=500i,content_length=97i 1707990435000000000
The response code is 500 and it is showing a response time of approximatly 15 seconds. But the site is working fine with 200 response.not sure why plugin is giving this response.I tested with Nagios check_http plugin for the same site and it is giving the correct response.
[root@Rocky1 ~]# /opt/nagios/nagios-plugins-2.4.3/plugins/check_http -H flipkart.com -f follow -S
HTTP OK: HTTP/1.1 200 OK - 1101647 bytes in 0.858 second response time |time=0.858211s;;;0.000000 size=1101647B;;;0
Can someone hep me why this is happening ?
jpowers
February 15, 2024, 2:16pm
2
status_code=500
Is this consistently happening? 500 error is usually server side error not client side.
For what it is worth it seems to work fine right now:
http_url_check,host=ryzen,method=GET,result=success,server=https://flipkart.com,status_code=200 result_type="success",result_code=0i,response_time=2.741074171,http_response_code=200i,content_length=1096093i 1708006452000000000
Thanks for the quick response @jpowers ,
Good to see that its working for you. Unfortunately , not for me. Wanted to understand why.
Below is the output what I am getting. I am always getting the same result.
[root@Rocky1 ~]# cat flipkart.conf
[[inputs.http_response]]
urls = ["https://flipkart.com"]
follow_redirects = true
interval = "5m"
response_timeout = "2m"
name_override = "http_url_check"
[root@Rocky1 ~]# telegraf --debug --test --config flipkart.conf
2024-02-15T15:25:20Z I! Loading config: flipkart.conf
2024-02-15T15:25:20Z I! Starting Telegraf 1.28.5 brought to you by InfluxData the makers of InfluxDB
2024-02-15T15:25:20Z I! Available plugins: 240 inputs, 9 aggregators, 29 processors, 24 parsers, 59 outputs, 5 secret-stores
2024-02-15T15:25:20Z I! Loaded inputs: http_response
2024-02-15T15:25:20Z I! Loaded aggregators:
2024-02-15T15:25:20Z I! Loaded processors:
2024-02-15T15:25:20Z I! Loaded secretstores:
2024-02-15T15:25:20Z W! Outputs are not used in testing mode!
2024-02-15T15:25:20Z I! Tags enabled: host=Rocky1
2024-02-15T15:25:20Z D! [agent] Initializing plugins
2024-02-15T15:25:20Z D! [agent] Starting service inputs
2024-02-15T15:25:35Z D! [agent] Stopping service inputs
2024-02-15T15:25:35Z D! [agent] Input channel closed
2024-02-15T15:25:35Z D! [agent] Stopped Successfully
> http_url_check,host=Rocky1,method=GET,result=success,server=https://flipkart.com,status_code=500 content_length=97i,http_response_code=500i,response_time=15.325298251,result_code=0i,result_type="success" 1708010736000000000
[root@Rocky1 ~]# telegraf version
Telegraf 1.28.5 (git: HEAD@77e1a498)
[root@Rocky1 ~]#
Which telegraf version are you using?