Skip to content

Ansible role for Prometheus Blackbox exporter

License

Notifications You must be signed in to change notification settings

angristan/ansible-blackbox-exporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ansible role for Blackbox exporter

This role will setup Blackbox exporter on any Linux machine using systemd.

Requirements

  • systemd on the target host
  • gnu-tar on Mac deployer host (brew install gnu-tar)

Role Variables

  • blackbox_exporter_version: the version that will be downloaded and installed. (0.14.0).

The role will download the Blackbox exporter release on the deployer and upload the binary on the target host.

If the /usr/local/bin/blackbox_exporter binary already exists, the role will skip the install steps. You can force them (to update, for instance), by setting blackbox_exporter_force_install to true.

  • blackbox_exporter_system_group: system user that will run the exporter (blackbox-exporter)
  • blackbox_exporter_system_user: system group that will run the exporter ({{ blackbox_exporter_system_group }})
  • blackbox_exporter_listen_address: the address the exporter will listen on (0.0.0.0:9115)
  • blackbox_exporter_service_flags: extra flags passed to the binary via the systemd unit. ({})
  • blackbox_exporter_configuration_modules: you can define your modules here. See the documentation for more details, as well as defaults/main.yml, which contains some ready-to-use modules.

Example playbook

---

- hosts: myhost
  roles: blackbox-exporter
  vars:
    blackbox_exporter_web_listen_address: "127.0.0.1:9115"

Most of the config is done on Prometheus. See the docs.

If you are using my Prometheus role, here's a sample config:

- hosts: myhost
  roles: prometheus
  vars:
  prometheus_scrape_configs:
    - job_name: 'blackbox_exporter'
      metrics_path: /probe
      params:
        module: [http_2xx]
      static_configs:
        - targets:
          - https://angristan.xyz
          - https://angristan.fr
      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

License

MIT. See LICENSE for more details.

Credit

This role is largely inspired by cloudalchemy/ansible-blackbox-exporter.

Author Information

See my other Ansible roles at angristan/ansible-roles.

Releases

No releases published

Packages

No packages published