Wednesday, April 07, 2021

Blackbox exporter example in window for Prometheus to check Site Status.

 Blackbox exporter is used to check if the site is on or off. This can be done by integrating Blackbox with our Prometheus.

download the Blackbox exporter from below given location
https://prometheus.io/download/

now run the black-box on your machine

C:\blackbox_exporter-0.18.0.windows-amd64>blackbox_exporter.exe
level=info ts=2021-04-07T09:36:12.275Z caller=main.go:212 msg=”Starting blackbox_exporter” version=”(version=0.18.0, branch=HEAD, revision=60c86e6ce5a1111f7958b06ae7a08222bb6ec839)”
level=info ts=2021-04-07T09:36:12.280Z caller=main.go:213 msg=”Build context” (gogo1.15.2,userroot@53d72328d93f,date20201012-09:48:01)=(MISSING)
level=info ts=2021-04-07T09:36:12.289Z caller=main.go:225 msg=”Loaded config file”
level=info ts=2021-04-07T09:36:12.302Z caller=main.go:369 msg=”Listening on address” address=:9115

Check you are able to open the following url in browser

Now configure black box exporter into our prometheus using prometheus.yml file as shown below

 - job_name: 'blackbox'
    metrics_path: /probe
    params:
      module: [http_2xx] 
    static_configs:
      - targets:
        - https://127.0.0.1:8080    # Spring boot applications
        - https://www.youtube.com/
        - https://localhost:9090  #Prometheus 
    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  # The blackbox exporter's real hostname:port.  

Now start your Prometheus server and check the target you will be able to see the below result stating our both Prometheus, youtube and local tomcat is running

No comments: