I have Telegraf http_response inputs (single example: )
[[inputs.http_response]]
address = “http://mynewsite”
response_string_match = “some text”
I have an InfluxDB instance where that is being stored
I have a Grafana instance where I’d like a dashboard containing a bunch of Singlestat panels for up/down red/green status for websites.
My problem:
The InfluxDB query generated returns no data when the site is down - I guess because http_response_code, response_string_match, response_time are only populated when result_type=‘success’
SELECT "response_string_match" FROM "http_response" WHERE ("server" = 'http://mynewsite') AND time >= now() - 5m GROUP BY time(2s) fill(0)
Fill doesn’t work in this case, seemingly by design. (This is exactly the case I’d expect it to be useful.)
I guess I need logic in my InfluxDB query to state that
- when result_type=‘success’ return 1
- otherwise return 0
which will work with Singlestat in Grafana. But there’s no CASE WHEN type syntax in InfluxDB as far as I can tell.
How are other people implementing up/down indicators for websites when using Telegraf’s http_response input?