prometheus.yml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. {%- set nodes = salt['pillar.get']('nodes').items()|sort -%}
  2. #
  3. # /etc/prometheus/prometheus.yaml (Salt managed)
  4. #
  5. global:
  6. scrape_interval: 30s
  7. evaluation_interval: 1m
  8. # scrape_timeout is set to the global default (10s).
  9. external_labels:
  10. monitor: '{{ grains['id'] }}'
  11. #alerting:
  12. # alertmanagers:
  13. # - static_configs:
  14. # - targets: ['localhost:9093']
  15. #
  16. ## Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
  17. #rule_files:
  18. # # - "first_rules.yml"
  19. # # - "second_rules.yml"
  20. scrape_configs:
  21. - job_name: 'prometheus'
  22. scrape_interval: 5s
  23. scrape_timeout: 5s
  24. static_configs:
  25. - targets: ['localhost:9090']
  26. - job_name: node
  27. static_configs:
  28. - targets:
  29. {%- for node, node_config in nodes if node_config.get('platform') == 'linux' and node_config.get('status') == 'active' %}
  30. - {{ node }}:9100
  31. {%- endfor %}
  32. - job_name: bind
  33. static_configs:
  34. - targets:
  35. {%- for node, node_config in nodes if node_config.get('status') == 'active' %}
  36. {%- if salt['ffho.any_item_in_list'](['dns-auth', 'dns-recursor'], node_config.get('roles', [])) %}
  37. - {{ node }}:9119
  38. {%- endif %}
  39. {%- endfor %}
  40. - job_name: bird
  41. static_configs:
  42. - targets:
  43. {%- for node, node_config in nodes if node_config.get('status') == 'active'%}
  44. {%- if 'router' in node_config.get('roles', []) %}
  45. - {{ node }}:9324
  46. {%- endif %}
  47. {%- endfor %}