move targets to a dedicated folder
This commit is contained in:
parent
a28064ca9b
commit
8b6986d955
3 changed files with 16 additions and 18 deletions
|
@ -39,20 +39,6 @@
|
|||
notify: Restart blackbox-exporter
|
||||
no_log: true
|
||||
|
||||
- name: Add targets files
|
||||
template:
|
||||
src: targets.json
|
||||
dest: "/etc/prometheus/blackbox-{{ item }}-targets.json"
|
||||
owner: prometheus
|
||||
group: prometheus
|
||||
mode: '0640'
|
||||
force: no
|
||||
notify: Restart blackbox-exporter
|
||||
loop:
|
||||
- https-internal
|
||||
- http-external-up
|
||||
- http-external-down
|
||||
|
||||
#- name: Copy the web-config folder
|
||||
# template:
|
||||
# src: web-config.yaml
|
||||
|
|
|
@ -18,6 +18,14 @@
|
|||
owner: prometheus
|
||||
mode: u=rwx,g=rx,o=rx
|
||||
|
||||
- name: Ensure the target folder exist
|
||||
file:
|
||||
path: /etc/prometheus/targets
|
||||
state: directory
|
||||
group: prometheus
|
||||
owner: prometheus
|
||||
mode: u=rwx,g=rx,o=rx
|
||||
|
||||
- name: Generate certificate
|
||||
include_role:
|
||||
name: generate-cert
|
||||
|
@ -51,13 +59,17 @@
|
|||
- name: Add node targets file
|
||||
template:
|
||||
src: node-targets.json
|
||||
dest: /etc/prometheus/node-targets.json
|
||||
dest: "/etc/prometheus/targets/{{ item }}-targets.json"
|
||||
owner: prometheus
|
||||
group: prometheus
|
||||
mode: '0640'
|
||||
force: no
|
||||
notify: Restart prometheus
|
||||
no_log: true
|
||||
loop:
|
||||
- blackbox-http-external-down
|
||||
- blackbox-http-external-up
|
||||
- blackbox-https-internal
|
||||
- node
|
||||
|
||||
- name: Copy the web-config folder
|
||||
template:
|
||||
|
|
|
@ -45,7 +45,7 @@ scrape_configs:
|
|||
- job_name: node
|
||||
file_sd_configs:
|
||||
- files:
|
||||
- '/etc/prometheus/node-targets.json'
|
||||
- '/etc/prometheus/targets/node-targets.json'
|
||||
relabel_configs:
|
||||
# Use hostnames instead of ip for the instance label
|
||||
- source_labels: [__address__]
|
||||
|
@ -71,7 +71,7 @@ scrape_configs:
|
|||
module: [http_2xx]
|
||||
file_sd_configs:
|
||||
- files:
|
||||
- '/etc/prometheus/blackbox-{{ target_type }}-targets.json'
|
||||
- '/etc/prometheus/targets/blackbox-{{ target_type }}-targets.json'
|
||||
relabel_configs:
|
||||
- source_labels: [__address__]
|
||||
target_label: __param_target
|
||||
|
|
Loading…
Reference in a new issue