prometheus.yml 3.45 KiB
global:
  scrape_interval: 1m
  scrape_timeout: 10s
  evaluation_interval: 1m
  {% if cluster_name and cluster_name | length  %}
  # Clustername is defined for multi swarm cluster
  # can name first cluster as DS1 and 2nd as DS2 ... DSn
  # all metrics will have label as cluster: < value >
  # This value won't be accessible from GUI but for external tools like
  # federation or alertmanager
  external_labels:
    cluster: {{cluster_name}}
  {% endif %}
rule_files:
  - '/etc/prometheus-rules/alertrules.nodes.yml'
  - '/etc/prometheus-rules/alertrules.process.yml'
  - '/etc/prometheus-rules/alertrules.task.yml'
  - '/etc/prometheus-rules/alertrules.kong.yml'
  - '/etc/prometheus-rules/alertrules.docker.yml'
alerting:
  alertmanagers:
  - static_configs:
    - targets: [ '{{groups['alertmanager']|join(':9093\', \'')}}:9093','{{groups['alertmanager_stateful']|join(':19093\', \'')}}:19093' ]
  {% if prometheus_alertmanager_route_prefix and prometheus_alertmanager_route_prefix | length  %}
  # this empty line will make sure the indentation is proper
    path_prefix: {{ prometheus_alertmanager_route_prefix }}
  {% endif %}
scrape_configs:
  - job_name: 'cadvisor'
    dns_sd_configs:
    - names:
      - 'tasks.monitor_cadvisor'
      type: 'A'
      port: 8080
    metric_relabel_configs:
      - source_labels: [name]
        regex: '^\s*$'
        action: drop
  - job_name: 'vm-node-exporter'
    static_configs:
      - targets: ["{{ groups['swarm-nodes'] | difference(["localhost"]) | map('regex_replace', '^(.*)$', '\\1:9100') | list | join("\", \"") }}"]
  - job_name: 'alertmanager'
    metrics_path: /alertmanager/metrics
    dns_sd_configs:
    - names:
      - 'tasks.monitor_alertmanager'
      type: 'A'
      port: 9093
  {% if enable_scraping_docker_metrics %}
  # This empty line ensures indentation is correct after ansible jinja2 template is materialized
  - job_name: 'docker'
    static_configs:
      - targets: ["{{ groups['swarm-manager'] | map('regex_replace', '^(.*)$', '\\1:' + docker_metrics_port ) | list | join("\", \"") }}"]
    metric_relabel_configs:
      - source_labels: [__name__]
        regex: 'grpc_.*'
        action: drop
  {% endif %}
  - job_name: 'nginx'
    metrics_path: /metrics
    scrape_interval: 10s
    scrape_timeout: 5s
    dns_sd_configs:
    - names:
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
- 'tasks.proxy_proxy' type: 'A' port: 9145 - job_name: 'statsd-exporter' static_configs: - targets: ['monitor_statsd_exporter:9102'] - job_name: 'kong-cluster-exporter' static_configs: - targets: ['monitor_kong_cluster_exporter:9158'] - job_name: 'docker-service-replicas-exporter' static_configs: - targets: ['{{ groups['swarm-bootstrap-manager'][0] }}:9258'] - job_name: 'prometheus' metrics_path: /prometheus/metrics static_configs: - targets: ['localhost:9090'] {% for item in service_blackbox_checks %} # This empty line ensures indentation is correct after ansible jinja2 template is materialized - job_name: 'availability_{{ item.service_name }}' metrics_path: /probe params: module: [{{ item.probe_module }}] static_configs: - targets: {{ item.targets | to_json }} labels: "service_name": "{{ item.service_name }}" relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: monitor_blackbox-exporter:9115 {% endfor %}