{%- set nodes = salt['pillar.get']('nodes').items()|sort -%} # # /etc/prometheus/prometheus.yaml (Salt managed) # global: scrape_interval: 30s evaluation_interval: 1m # scrape_timeout is set to the global default (10s). external_labels: monitor: '{{ grains['id'] }}' #alerting: # alertmanagers: # - static_configs: # - targets: ['localhost:9093'] # ## Load rules once and periodically evaluate them according to the global 'evaluation_interval'. #rule_files: # # - "first_rules.yml" # # - "second_rules.yml" scrape_configs: - job_name: 'prometheus' scrape_interval: 5s scrape_timeout: 5s static_configs: - targets: ['localhost:9090'] - job_name: node static_configs: - targets: {%- for node, node_config in nodes %} - {{ node }}:9100 {%- endfor %} - job_name: bind static_configs: - targets: {%- for node, node_config in nodes %} {%- if salt['ffho.any_item_in_list'](['dns-auth', 'dns-recursor'], node_config.get('roles', [])) %} - {{ node }}:9119 {%- endif %} {%- endfor %} - job_name: bird static_configs: - targets: {%- for node, node_config in nodes %} {%- if 'router' in node_config.get('roles', []) %} - {{ node }}:9324 {%- endif %} {%- endfor %}