multiple corrections for blackbox exporter
This commit is contained in:
		| @@ -31,3 +31,5 @@ prometheus_server_job_name: "prometheus" | |||||||
| prometheus_server_scrape_interval: 5 | prometheus_server_scrape_interval: 5 | ||||||
| prometheus_server_scrape_timeout: 5 | prometheus_server_scrape_timeout: 5 | ||||||
| prometheus_server_version: "latest" | prometheus_server_version: "latest" | ||||||
|  |  | ||||||
|  | prometheus_blackbox_exporter_host: localhost | ||||||
|   | |||||||
| @@ -27,7 +27,7 @@ | |||||||
| - name: 'prometheus | assert | check if docker pyhon libraries are installed' | - name: 'prometheus | assert | check if docker pyhon libraries are installed' | ||||||
|   assert: |   assert: | ||||||
|     that: |     that: | ||||||
|       - "'python-docker' in ansible_facts.packages" |       #- "'python-docker' in ansible_facts.packages" | ||||||
|       - "'python3-docker' in ansible_facts.packages" |       - "'python3-docker' in ansible_facts.packages" | ||||||
|   when: |   when: | ||||||
|     - prometheus_server_enable is defined |     - prometheus_server_enable is defined | ||||||
|   | |||||||
| @@ -30,8 +30,8 @@ | |||||||
|  |  | ||||||
| - name: 'prometheus | blackbox exporter | configuration' | - name: 'prometheus | blackbox exporter | configuration' | ||||||
|   template: |   template: | ||||||
|     src: conf/prometheus-blackbox-exporter.yml.j2 |     src: conf/prometheus-blackbox-exporter.j2 | ||||||
|     dest: /etc/prometheus/prometheus-blackbox-exporter.yml |     dest: /etc/default/prometheus-blackbox-exporter | ||||||
|     owner: root |     owner: root | ||||||
|     group: root |     group: root | ||||||
|     mode: 0600 |     mode: 0600 | ||||||
| @@ -52,3 +52,4 @@ | |||||||
|     daemon_reload: yes |     daemon_reload: yes | ||||||
|     enabled: yes |     enabled: yes | ||||||
|     name: prometheus-blackbox-exporter.service |     name: prometheus-blackbox-exporter.service | ||||||
|  |  | ||||||
|   | |||||||
| @@ -160,46 +160,47 @@ scrape_configs: | |||||||
| {% endif %} | {% endif %} | ||||||
|  |  | ||||||
| {% if prometheus_blackbox_exporter is defined %} | {% if prometheus_blackbox_exporter is defined %} | ||||||
|   # blacbox # |   # blackbox # | ||||||
| {% if prometheus_blackbox_exporter_http is defined %} | {% if prometheus_blackbox_exporter_http is defined %} | ||||||
| {% for target in prometheus_blackbox_exporter_http.values() %} |  | ||||||
|   ## http check ## |   ## http check ## | ||||||
|   - job_name: blackbox - url {{ target.service_name }} |   - job_name: blackbox - url | ||||||
|     scrape_interval: 30s |     scrape_interval: 30s | ||||||
|     scrape_timeout: 10s |     scrape_timeout: 10s | ||||||
|     metrics_path: {{ target.metrics_path }} |     metrics_path: /probe | ||||||
|     params: |     params: | ||||||
|       module: [http_2xx] |       module: [http_2xx] | ||||||
|     static_configs: |     static_configs: | ||||||
|       - targets: |       - targets: | ||||||
|         - {{target.host }} | {% for target in prometheus_blackbox_exporter_http %} | ||||||
|  |         - {{target }} | ||||||
|  | {% endfor %} | ||||||
|     relabel_configs: |     relabel_configs: | ||||||
|       - source_labels: [__address__] |       - source_labels: [__address__] | ||||||
|         target_label: __param_target |         target_label: __param_target | ||||||
|       - source_labels: [__param_target] |       - source_labels: [__param_target] | ||||||
|         target_label: instance |         target_label: instance | ||||||
|       - target_label: __address__ |       - target_label: __address__ | ||||||
|         replacement: localhost:9115 |         replacement: {{ prometheus_blackbox_exporter_host }}:9115 | ||||||
| {% endfor %} |  | ||||||
| {% endif %} | {% endif %} | ||||||
| {% if prometheus_blackbox_exporter_ping is defined %} | {% if prometheus_blackbox_exporter_ping is defined %} | ||||||
| {% for target in prometheus_blackbox_exporter_ping.values() %} |  | ||||||
|   ## ping ## |   ## ping ## | ||||||
|   - job_name: blackbox - ping {{ target.service_name }} |   - job_name: blackbox - ping | ||||||
|     scrape_interval: 30s |     scrape_interval: 30s | ||||||
|     scrape_timeout: 10s |     scrape_timeout: 10s | ||||||
|     params: |     params: | ||||||
|       module: [icmp] |       module: [icmp] | ||||||
|     static_configs: |     static_configs: | ||||||
|       - targets: |       - targets: | ||||||
|          - {{ target.host }} | {% for target in prometheus_blackbox_exporter_ping %} | ||||||
|  |          - {{ target }} | ||||||
|  | {% endfor %} | ||||||
|     relabel_configs: |     relabel_configs: | ||||||
|       - source_labels: [__address__] |       - source_labels: [__address__] | ||||||
|         target_label: __param_target |         target_label: __param_target | ||||||
|       - source_labels: [__param_target] |       - source_labels: [__param_target] | ||||||
|         target_label: instance |         target_label: instance | ||||||
|       - target_label: __address__ |       - target_label: __address__ | ||||||
|         replacement: localhost:9115 |         replacement: {{ prometheus_blackbox_exporter_host }}:9115 | ||||||
| {% endfor %} |  | ||||||
| {% endif %} | {% endif %} | ||||||
| {% endif %} | {% endif %} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ After=network.target | |||||||
|  |  | ||||||
| [Service] | [Service] | ||||||
| Type=simple | Type=simple | ||||||
| ExecStart=/usr/local/bin/prometheus-blackbox-exporter --config.file /etc/prometheus/prometheus-blackbox-exporter.yml | ExecStart=/usr/local/bin/prometheus-blackbox-exporter --config.file /etc/default/prometheus-blackbox-exporter | ||||||
|  |  | ||||||
| [Install] | [Install] | ||||||
| WantedBy=multi-user.target | WantedBy=multi-user.target | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user