Monitor website is up or down using grafana

Hi There,

I am planning to monitor about 20 websites to see if they are up and running.

Is there a way to monitor if a web page is up or not using grafana.Is there a plugin that is available ?
If there is no plugin available
I can run curl or python to get the status and update influxdb but for grafana how do i create a graph that goes red if the return code is not 200.

Any other ideas or suggestions would be greatly appreciated.

Thanks

Many people are using the Singlestat panel for health checks like this.

With the Singlestat panel, you could create a query that returned a 1 for a service returning 200 and otherwise a 0, and then set up thresholds to set the background color of the panel to either green or red.

1 Like

I run telegraf on all our nodes with URL checks setup against all our sites. This creates a many to many checking relationship that mitigates bad data.

In grafana, I setup two queries, the first one is graphed and records the average response time:

alias(averageSeries(telegraf.*.GET.success.https:--my_url_com*.*.*.response_time), 'Avg Reponse Time')

The second one is disabled on the graph but records the response code:

averageSeries(telegraf.a_server_com.GET.success.https:--my_url_com*.*.http_response.http_response_code)

Then I setup my alert like this:

Essentially, I get an alert if the average response time is greater than 1 second or if the average HTTP response code is greater than 300 (which could indicate any number of problems). This combination seems to catch the problem situations you’ll run into.

Wait…can you use those queries directly in a singlestat panel?
What is the database source? Grafana?

Does Grafana and Telegraf run on the same machine?

Michael

I should have clarified that I’m using the Graph panel, that makes a lot more sense for displaying response times.

I do run telegraf on the host node, I’m using the Grafana docker container.

I suggest you to try blackbox exporter as separate container, which will ping your sites and will give you Prometheus metrics(like http status code and response time) which can be displayed on Grafana.
Docker Images is also available.

Hello!

I am very interested in you method however im unable to make it work. I insert all the info provided but recieve not data and furthermore i get “Bad gateway 502” error on InfluxDB install. If you could provide any assistance , i would be most grateful. What connects to the website is what im curious about mostly, does the query do that ?

Hi @mairoldkunimagi, I didn’t provide any instructions on setting up telegraf which is the utility that actually does the monitoring on the websites. I just install telegraf and then setup an input monitor using the http_response plugin. Something like:

[[inputs.http_response]]
  address = "https://example.com"
  response_timeout = "45s"

My output plugin is configured to send data to graphite, which is the db we use, but you can send it to InfluxDB too.

Hello
Yeah i just installed TIG stack succefuly today and am now researching how it works. Mostly i need to find out how to add other VMs as hosts to be monitored and currently i also tried to make your method of website monitoring work but sadly i still recieve no data. I suspect it is cuz of the latest data you provided is missing atm and i havent figure out where it should be added. Havent even figure out how you add new hosts as of yet it is only monitoring my zabbix server alone while i wish it to monitor all my servers about 30+ servers. I had it previously set up on zabbix and it is still working but zabbix is not very user friendly to work with, adding website monitoring and authentication simple dont work for me or work wrong.
For example the zabbix webscenario monitoring is monitoring my authentication server instead of the website bcuz all servers get redirected to atuhentication server for authenthication.

How do you connect telegraf agent in another server to the monitoring DB server ?

As noted above, you have to configure an output plugin to send the data from Telegraf to your monitoring database. In your case, I think you need to configure the influxdb_v2 output plugin in your telegraf.conf file. From their docs, here are some examples: https://docs.influxdata.com/telegraf/v1.13/administration/configuration/#output-configuration-examples.

Yes i got them linked, thank you! Ive configured telegraf also but am now going to look grafana side and see how exactly you inserted you alias lines.
Hmm im ending up with error: “error parsing query: found , expected identifier at line 1, char 37" which is an error indicating the * in "telegraf..GET.success”.