prometheus.yml.j2 5.36 KB
Newer Older
1
#jinja2: lstrip_blocks: True
2
{% if not prometheus_receive_only %}
3
4
5
6
7
8
9
10
11
12
global:
  scrape_interval: 60s

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  - node.rules.yml

# Alertmanager configuration
alerting:
  alertmanagers:
13
14
15
    - static_configs:
      - targets:
        - localhost:9093
16

17
remote_write:
18
19
20
21
22
23
24
25
26
  {% for relabel_config in prometheus_remote_write_relabel_configs %}
  - url: http://{{ prometheus_domain }}:9090/api/v1/write
    write_relabel_configs:
      - source_labels: [{{ relabel_config.label }}]
        regex: "{{ relabel_config.regex }}"
        action: keep
    basic_auth:
      username: {{ vault_prometheus_user }}
      password: {{ vault_prometheus_passwd }}
27

28
  {% endfor %}
29
scrape_configs:
30
31
  - job_name: prometheus
    static_configs:
32
33
34
      - targets: ['127.0.0.1:9090']
        labels:
          instance: "{{ ansible_fqdn }}"
35
36

  - job_name: prometheus-domain
37
    scheme: http
38
39
40
41
    basic_auth:
      username: {{ vault_prometheus_user }}
      password: {{ vault_prometheus_passwd }}
    static_configs:
42
43
44
45
      - targets: ['{{ prometheus_domain }}:9090']
        labels:
          job: prometheus
          instance: "dashboards.archlinux.org"
46

47
48
  - job_name: loki
    static_configs:
49
50
51
      - targets: ['127.0.0.1:3100']
        labels:
          instance: "{{ ansible_fqdn }}"
52

53
54
  - job_name: 'node_exporter'
    static_configs:
55
      {% for host in groups['all'] %}
56
57
58
59
      - targets: ['{{ host }}:{{ prometheus_exporter_port }}']
        labels:
          instance: "{{ host }}"
      {% endfor %}
60

61
62
  - job_name: 'promtail'
    static_configs:
63
      {% for host in groups['all'] %}
64
65
66
67
      - targets: ['{{ hostvars[host]['wireguard_address'] }}:9080']
        labels:
          instance: "{{ host }}"
      {% endfor %}
68

69
70
  - job_name: 'debuginfod'
    static_configs:
71
72
      {% for host in groups['geo_mirrors'] %}
      - targets: ['{{ hostvars[host]['wireguard_address'] }}:8002']
73
        labels:
74
75
          instance: "{{ host }}"
      {% endfor %}
76

77
78
  - job_name: 'powerdns'
    static_configs:
79
      {% for host in groups['geo_mirrors'] + [geo_acme_dns_challenge_ns] %}
80
81
82
83
      - targets: ['{{ hostvars[host]['wireguard_address'] }}:8081']
        labels:
          instance: "{{ host }}"
      {% endfor %}
84

85
86
  - job_name: 'gitlab_runner_exporter'
    static_configs:
87
88
89
90
91
      {% for host in groups['gitlab_runners'] %}
      - targets: ['{{ host }}:{{ gitlab_runner_exporter_port }}']
        labels:
          instance: "{{ host }}"
      {% endfor %}
92
93
94
95
96
97
98
99

  - job_name: 'keycloak'
    scheme: https
    metrics_path: "/auth/realms/master/metrics"
    basic_auth:
       username: "{{ vault_keycloak_nginx_user }}"
       password: "{{ vault_keycloak_nginx_passwd }}"
    static_configs:
100
101
102
      - targets: ['accounts.archlinux.org:443']
        labels:
          instance: "accounts.archlinux.org"
103
104
105
106
107
108
109

  - job_name: 'gitlab_exporter'
    scheme: https
    metrics_path: "-/metrics"
    params:
      token: ["{{ vault_gitlab_prometheus_token }}"]
    static_configs:
110
111
112
      - targets: ['gitlab.archlinux.org:443']
        labels:
          instance: "gitlab.archlinux.org"
113
114
115

  - job_name: 'mysqld_exporter'
    static_configs:
116
117
118
119
120
      {% for host in groups['mysql_servers'] %}
      - targets: ['{{ host }}:{{ prometheus_mysqld_exporter_port }}']
        labels:
          instance: "{{ host }}"
      {% endfor %}
121

122
123
  - job_name: 'memcached_exporter'
    static_configs:
124
125
126
127
128
      {% for host in groups['memcached'] %}
      - targets: ['{{ host }}:{{ prometheus_memcached_exporter_port }}']
        labels:
          instance: "{{ host }}"
      {% endfor %}
129

130
131
132
133
134
  - job_name: hedgedoc
    scheme: https
    authorization:
      credentials: {{ vault_hedgedoc_metrics_token }}
    static_configs:
135
      - targets: ['md.archlinux.org:443']
136

Jelle van der Waa's avatar
Jelle van der Waa committed
137
138
139
  - job_name: aurweb
    scheme: https
    static_configs:
140
      - targets: ['aur.archlinux.org:443']
Jelle van der Waa's avatar
Jelle van der Waa committed
141

142
143
144
145
146
  - job_name: grafana
    scheme: https
    authorization:
      credentials: {{ vault_grafana_metrics_token }}
    static_configs:
147
148
      - targets: ['monitoring.archlinux.org:443', 'dashboards.archlinux.org:443']
  {% for module in blackbox_targets.keys() %}
149

150
  - job_name: 'blackbox_{{ module }}'
151
152
153
    metrics_path: /probe
    scrape_interval: 15s
    params:
154
      module: [{{ module }}]
155
    static_configs:
156
157
158
159
      - targets:
        {% for target in blackbox_targets[module] | select('string') %}
        - {{ target }}
        {% endfor %}
160
      {% for vhost in blackbox_targets[module] | select('mapping') if module == 'http_prometheus' %}
161
162
      - targets:
          {% for target in vhost.targets %}
163
          - http{{ 's' if vhost.secure }}://{{ target }}
164
165
166
          {% endfor %}
        labels:
          vhost: {{ vhost.hostname }}
167
      {% endfor %}
168
169
170
171
172
173
174
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 127.0.0.1:9115
175
      {% if module == 'http_prometheus' %}
176
177
      - source_labels: [vhost]
        target_label: __param_hostname
178
      {% endif %}
179
180
  {% endfor %}
  {% for endpoint in matrix_metrics_endpoints %}
181
182
183
184
185

  - job_name: 'synapse_{{ endpoint }}'
    scrape_interval: 15s
    metrics_path: "/metrics/synapse.{{ endpoint }}"
    scheme: https
186
    authorization:
187
      credentials: {{ vault_matrix_metrics_token }}
188
189
    static_configs:
      - targets: ["matrix.archlinux.org:443"]
190
  {% endfor %}
191
{% endif %}