Monitor ping host with blackbox exporter

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

In this article, I will guide you to monitor host ping with blackbox exporter. Monitoring host/website up or down through checking ping is quite useful.

You can use ICMP ping to check any type of host: website, server, firewall, switch, camera,…

Recommended ReadingInstall Prometheus Blackbox exporter on Ubuntu 18

Set up Prometheus using Blackbox exporter

First, open the prometheus configuration file.

nano /etc/prometheus/prometheus.yml

Then, add the following content to the end of the prometheus.yml file. Please note that the use of spaces must comply with the yml file format.

  - job_name: 'blackbox_ping'
    metrics_path: /probe
    params:
      module: [icmp]
    static_configs:
      - targets:
        - 8.8.8.8
        - host.example.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

Save the file and reload prometheus.

service prometheus reload

Now, you access the prometheus domain, go to the menu Status -> Targets. If you look at the job blackbox_ping section, the endpoints are all UP, which means it was successful.

Monitor ping host with blackbox exporter
Target blackbox_ping UP.

Recommended ReadingSet up nginx proxy for Prometheus and Grafana.

Set up data sources for Grafana

This part is quite simple, you log in to the Grafana domain.

In the left menu, select Configuration -> Data Sources. Next, choose the data source type as Prometheus.

Enter the prometheus database address (http://localhost:9090) in the URL box as shown below and click Save & Test.

Monitor ping host with blackbox exporter
Set up database source prometheus for grafana.

Set up the Grafana monitor ping dashboard

Now it’s time to use the grafana dashboard. In the left menu, click the create dashboard button (+) and select Import.

You enter the dashboard ID 12412 and click Load.

Monitor ping host with blackbox exporter
Import dashboard icmp exporter for grafana.

In the next window, in the localhost section at the bottom, select data source prometheus and click Import to finish.

Conclusion

With this article, I have guided you step by step to monitor host ping using Blackbox exporter. From setting up the prometheus configuration to setting up the grafana dashboard.

0 0 votes
Article Rating
Series Navigation«« Previous part: Install Prometheus Blackbox exporter on Ubuntu 18Next part: Monitor website and SSL with blackbox exporter »»

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.