mirror of
https://github.com/davestephens/ansible-nas
synced 2025-01-27 02:35:06 +00:00
Enable scraping of additional hosts from Prometheus
This commit is contained in:
parent
02d5ef138a
commit
2a1d7fc718
3 changed files with 18 additions and 1 deletions
|
@ -32,3 +32,7 @@ stats_grafana_memory: 1g
|
||||||
stats_prometheus_retention_time: 365d
|
stats_prometheus_retention_time: 365d
|
||||||
stats_prometheus_retention_size: 30GB
|
stats_prometheus_retention_size: 30GB
|
||||||
stats_collection_interval: 15s
|
stats_collection_interval: 15s
|
||||||
|
|
||||||
|
# uncomment to scrape more hosts
|
||||||
|
# stats_prometheus_additional_hosts:
|
||||||
|
# - 192.168.1.1:9100
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
- name: Template Prometheus config
|
- name: Template Prometheus config
|
||||||
template:
|
template:
|
||||||
src: prometheus.yml
|
src: prometheus.yml.j2
|
||||||
dest: "{{ stats_prometheus_config_directory }}/prometheus.yml"
|
dest: "{{ stats_prometheus_config_directory }}/prometheus.yml"
|
||||||
register: prometheus_config
|
register: prometheus_config
|
||||||
|
|
||||||
|
|
|
@ -43,3 +43,16 @@ scrape_configs:
|
||||||
"{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}:{{ stats_speedtest_exporter_port }}"
|
"{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}:{{ stats_speedtest_exporter_port }}"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{% if stats_prometheus_additional_hosts is defined %}
|
||||||
|
- job_name: "additional_hosts"
|
||||||
|
static_configs:
|
||||||
|
- targets: [
|
||||||
|
{% for host in stats_prometheus_additional_hosts %}
|
||||||
|
{{ host }}
|
||||||
|
{% if not loop.last %}
|
||||||
|
,
|
||||||
|
{% endif %}
|
||||||
|
]
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
Loading…
Reference in a new issue