❌

Normal view

There are new articles available, click to refresh the page.
Before yesterdayMain stream

Prometheus-Grafana Using BlackBox exporter

By: Kannan
13 November 2023 at 07:12

Here we are going to use Blackbox export on grafana Dashboard

  • Download the blackbox exporter
wget https://github.com/prometheus/blackbox_exporter/releases/download/v0.24.0/blackbox_exporter-0.24.0.linux-amd64.tar.gz
  • extract the package
tar -xvf blackbox_exporter-0.24.0.linux-amd64.tar.gz
  • enter into blackbox directory
cd blackbox_exporter-0.24.0.linux-amd64
  • create the monitor_website.yml file
vim monitor_website.yml
modules:
  http_2xx_example:
    prober: http
    timeout: 5s
    http:
      valid_http_versions: ["HTTP/1.1", "HTTP/2.0"]
      valid_status_codes: [200]  # Defaults to 2xx
      method: GET
  • Create the service file for blackbox
vim /etc/systemd/system/blackbox.service
[Unit]
Description = Prometheus Server
Documentation=https://prometheus.io/docs/introduction/overview/
After=network-online.target

[Service]
User=root
Restart=on-failure

ExecStart=/root/blackbox_exporter-0.24.0.linux-amd64/blackbox_exporter --config.file=/root/blackbox_exporter-0.24.0.linux-amd64/monitor_website.yml

[Install]
WantedBy=multi-user.target
  • Reload,start,enable and find the status of the balckbox service
systemctl daemon-reload
systemctl start blackbox
systemctl enable blackbox
systemctl status blackbox
  • At prometheus server creating the scrape config file
vim /etc/prometheus/prometheus.yml
- job_name: 'blackbox'
    metrics_path: /probe
    params:
      module: [http_2xx_example]  # Look for a HTTP 200 response.
    static_configs:
      - targets:
        - http://prometheus.io    # Target to probe with http.
        - https://prometheus.io   # Target to probe with https.
        - http://kaniyam.com
        - http://freetamilebooks.com
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 192.168.122.138:9115
  • Restart the services
systemctl restart prometheus
systemctl restart grafana-server        

Image description

  • In Grafana Dashboard Create a query and add metrics
probe_http_status_code
probe_http_ssl

Image description

  • Add > Virtulization >select tables >set value mappings and set colour >rename the panel.

  • Below the metric "option" set the type as "Table", "instant"
    Select "Transform data" and modify the name as your choice.

Image description

❌
❌