Monitor website and SSL with blackbox exporter

by Daniel Pham
Published: Updated:
This entry is part 6 of 14 in the series Install Prometheus and Grafana on Ubuntu 18

In this article, I will guide you to monitor website and SSL with blackbox exporter. In the previous article, you learned how to use blackbox exporter to monitor host ping.

Now, we continue to use the blackbox exporter but to monitor website HTTP code and SSL expiration.

Configure prometheus monitor website and ssl

Open the prometheus configuration file.

nano /etc/prometheus/prometheus.yml

Add the following content to the end of the file and save.

  - job_name: 'blackbox'
    metrics_path: /probe
    params:
      module: [http_2xx]
    static_configs:
      - targets:
        - https://www.google.com
        - https://www.youtube.com
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 127.0.0.1:9115

You change the URLs in the targets section to the websites you want to monitor. Note that you type the URL correctly, including the http (https) part in front of the domain.

Reload prometheus configuration.

systemctl reload prometheus

Set up the grafana dashboard

In this part, you do the same as importing dashboard monitor ping.

In the Import dashboard section, enter ID 9965. This is the Chinese interface dashboard.

If you want to use my version with a little customization in English, you can download this JSON file.

Instead of importing ID, in the Import via panel json section, copy the json file content there and click Load.

And as a result, you will get an interface that looks like this.

Monitor website and SSL with blackbox exporter
Grafana monitor website and ssl dashboard interface.

If you encounter an error that some panels are not displayed on the dashboard, type the command below to install the necessary plugins.

grafana-cli plugins install grafana-image-renderer
grafana-cli plugins install camptocamp-prometheus-alertmanager-datasource
grafana-cli plugins install grafana-piechart-panel

And then, restart the grafana service.

service grafana-server restart

Conclusion

With just a few quick steps, you have a website monitor interface. In the next part, I will guide you to install prometheus bot to send alerts to telegram. A monitoring tool would be of no use if it couldn’t send us warnings, right?

0 0 votes
Article Rating
Series Navigation«« Previous part: Monitor ping host with blackbox exporterNext part: Install Alertmanager and set up Prometheus alerts »»

You may also like

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

DevOps Lite is a personal blog specializing in technology with main topics about DevOps, DevSecOps, SRE and System Administrator. Articles are shared for free and contributed to the community.

SUPPORT US

FOLLOW US

Subscribe my Newsletter for new blog posts. Stay updated from your inbox!

© 2021-2024 DevOpsLite.com – All rights reserved.

Please write sources “DevOpsLite.com” when using articles from this website.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

2
0
Would love your thoughts, please comment.x
()
x

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.