Article original Publié le : 21 décembre 2021 Mise à jour le : Commencer par un curl pour vérifier le status
1 |
$ curl mon_url -H "auth-token:xxx-mon-token-xxx" |
1 |
{"status":"UP"} |
ou
1 |
$ curl mon_url -H "auth-token:xxx-mon-token-xxx" -I |
1 |
HTTP/2 200 |
Dans blackbox exporter ajouter le module
1 2 3 4 5 6 |
http_2xx_with_header: prober: http timeout: 5s http: headers: auth-token: xxx-mon-token-xxx |
Le job dans la conf globale de Prometheus
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
- job_name: blackbox-http_with_header metrics_path: /probe params: module: - http_2xx_with_header relabel_configs: - source_labels: - __address__ target_label: __param_target - source_labels: - __param_target target_label: instance - replacement: 127.0.0.1:9115 target_label: __address__ static_configs: - targets: - mon_url_1 - mon_url_2 |
Pour la rule de Prometheus
1 2 3 4 5 6 7 8 9 10 |
- alert: EndpointDown_with_token expr: probe_success{job="blackbox-http_with_header"} == 0 for: 1m labels: instanceName: {{ $labels.instance }} service: system severity: critical annotations: summary: "alert" description: "alert" |
[…]