add cloudflare exporter

This commit is contained in:
Ludovic Cartier
2023-01-27 16:51:27 +01:00
parent 17e1e50a48
commit a7940658b1
7 changed files with 108 additions and 2 deletions

View File

@ -0,0 +1,17 @@
version: '3.7'
networks:
{{ prometheus_docker_network }}:
external: true
services:
cloudflare-exporter:
container_name: cloudflare-exporter
image: ghcr.io/lablabs/cloudflare_exporter:latest
restart: unless-stopped
environment:
- CF_API_TOKEN={{ cloudflare_api_key }}
ports:
- 8082:8080
networks:
- {{ prometheus_docker_network }}

View File

@ -371,3 +371,19 @@ scrape_configs:
regex: '(.*):8080'
replacement: '${1}'
{% endif %}
{% if prometheus_cloudflare_exporter_targets is defined %}
# cloudflare #
- job_name: cloudflare
scrape_interval: 30s
static_configs:
- targets:
{% for target in prometheus_cloudflare_exporter_targets %}
- {{ target }}:8082
{% endfor %}
relabel_configs:
- source_labels: [ __address__ ]
target_label: instance
regex: '(.*):8082'
replacement: '${1}'
{% endif %}

View File

@ -0,0 +1,14 @@
[Unit]
Description=%i service with docker compose
PartOf=docker.service
After=docker.service
[Service]
Type=oneshot
RemainAfterExit=true
WorkingDirectory=/opt/docker-compose/{{ exporter }}
ExecStart=/usr/bin/docker-compose up -d
ExecStop=/usr/bin/docker-compose down
[Install]
WantedBy=multi-user.target