123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- {%- 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 if node_config.get('platform') == 'linux' and node_config.get('status') == 'active' %}
- - {{ node }}:9100
- {%- endfor %}
- - job_name: bind
- static_configs:
- - targets:
- {%- for node, node_config in nodes if node_config.get('status') == 'active' %}
- {%- 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 node_config.get('status') == 'active' %}
- {%- if 'router' in node_config.get('roles', []) %}
- - {{ node }}:9324
- {%- endif %}
- {%- endfor %}
- - job_name: postgres
- static_configs:
- - targets:
- {%- for node, node_config in nodes if node_config.get('status') == 'active' %}
- {%- if 'postgres' in node_config.get('roles', []) %}
- - {{ node }}:9187
- {%- endif %}
- {%- endfor %}
- - job_name: mariadb
- static_configs:
- - targets:
- {%- for node, node_config in nodes if node_config.get('status') == 'active' %}
- {%- if 'mariadb' in node_config.get('roles', []) %}
- - {{ node }}:9104
- {%- endif %}
- {%- endfor %}
|