Grafana_Blackbox_Exporter

Grafana_Blackbox_Exporter

blackbox_exporter

 

The blackbox exporter allows blackbox probing of endpoints over HTTP, HTTPS, DNS, TCP, and ICMP. Data use by “Prometheus” and using these data we can create graph into Grafana.

 

Download blackbox_exporter and extract it.

[root@feenixdv ~]# wget https://github.com/prometheus/blackbox_exporter/releases/download/v0.13.0/blackbox_exporter-0.13.0.linux-amd64.tar.gz
[root@feenixdv ~]# tar zxvf blackbox_exporter-0.13.0.linux-amd64.tar.gz
blackbox_exporter-0.13.0.linux-amd64/
blackbox_exporter-0.13.0.linux-amd64/LICENSE
blackbox_exporter-0.13.0.linux-amd64/blackbox.yml
blackbox_exporter-0.13.0.linux-amd64/NOTICE
blackbox_exporter-0.13.0.linux-amd64/blackbox_exporter
[root@feenixdv ~]# cd blackbox_exporter-0.13.0.linux-amd64/

 

Now update ” blackbox.yml”.

Here I am going to put URL monitoring through blackbox.

[root@feenixdv blackbox_exporter-0.13.0.linux-amd64]# cat blackbox.yml

.
.
url_check:
    prober: http
    # timeout: 5s
    http:
      valid_http_versions: ["HTTP/1.1", "HTTP/2"]
      valid_status_codes: []
      method: GET
      no_follow_redirects: false
      tls_config:
        insecure_skip_verify: false
      preferred_ip_protocol: "ipv4"
      fail_if_matches_regexp:
        - "Could not connect to database"

Where “url_check” is module name which is used in Prometheus (Prometheus.yml).

Now launch blackbox_exporter with customizing YML file.

[root@feenixdv blackbox_exporter-0.13.0.linux-amd64]# ./blackbox_exporter --config.file="blackbox.yml" &
level=info ts=2019-01-24T04:44:50.914686848Z caller=main.go:215 msg="Starting blackbox_exporter" version="(version=0.13.0, branch=HEAD, revision=1cfb7512daa7e100abb32037996c8f805990d813)"
level=info ts=2019-01-24T04:44:50.915308706Z caller=main.go:228 msg="Loaded config file"
level=info ts=2019-01-24T04:44:50.915427103Z caller=main.go:332 msg="Listening on address" address=:9115

By default its start on “9115” port.

Blackbox is running or not, we can check using below URL.

http://192.168.40.177:9115/probe?module=url_check&target=http://www.localhost

Now update “prometheus.yml” to check URL.

.
.
- job_name: "Blackbox URL check"
    metrics_path: /probe
    params:
      module: [url_check]
    static_configs:
      - targets:
          - http://google.com
          - https://feenixdv.com
          - http://bibhuti_narayan.com
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 192.168.40.177:9115

Now check Prometheus GUI.

Here we can see URL monitoring working fine.

Leave a Reply

Your email address will not be published. Required fields are marked *