Ok, maybe I’m confused on how this is supposed to work, but I am trying to check the status of several web sites. The
inputs.http_response seems to be what I want, so I added it to my
telegraf.conf file like so:
# HTTP/HTTPS request given an address a method and a timeout [[inputs.http_response]] name_suffix = "_motioneye" ## Server address (default http://localhost) address = "http://skynet:8765" ## Set response_timeout (default 5 seconds) response_timeout = "5s" ## HTTP Request Method method = "GET" ## Whether to follow redirects from the server (defaults to false) follow_redirects = true
However, when I take the page down (to test the alert), no data is sent to influx and the telegraf service shows this over and over again:
Apr 28 17:21:17 skynet telegraf: 2019-04-29T00:21:17Z E! Error in plugin [inputs.http_response]: Get http://skynet:8080: dial tcp 192.168.1.4:8765: getsockopt: connection refused
So I’m guessing it “fails” to get a response so it errors out. However, this is exactly the case I want to test for. I found this post from a while back of someone with the same question, but no love there.
Is there a better input plugin for checking the status of a web page, or is there a way I can map this result thingy to some place to make it useful?