about summary refs log tree commit diff
path: root/bundles/prometheus/files/rules.yml
blob: 45b130a4c8cde340cbf6c1a2983250e0319f9a33 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
groups:
  - name: Prometheus
    rules:
      - alert: PrometheusTargetMissing
        expr: up == 0
        for: 10m
        labels:
          severity: critical
        annotations:
          summary: |-
            Prometheus target missing (instance {{ $labels.instance }})
          description: |-
            A Prometheus target has disappeared. An exporter might be crashed.
              VALUE  = {{ $value }}
              LABELS = {{ $labels }}

  - name: Host
    rules:
      - alert: HostOutOfMemory
        expr: (node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes < .10)
        for: 2m
        labels:
          severity: warning
        annotations:
          summary: |-
            Host out of memory (instance {{ $labels.instance }})
          description: |-
            Node memory is filling up (< 10% left)
              VALUE = {{ $value }}
              LABELS = {{ $labels }}

      - alert: HostMemoryUnderMemoryPressure
        expr: (rate(node_vmstat_pgmajfault[5m]) > 1000)
        for: 0m
        labels:
          severity: warning
        annotations:
          summary: |-
            Host memory under memory pressure (instance {{ $labels.instance }})
          description: |-
            The node is under heavy memory pressure. High rate of loading memory pages from disk.
              VALUE  = {{ $value }}
              LABELS = {{ $labels }}

      - alert: HostUnusualDiskReadRate
        expr: (rate(node_disk_io_time_seconds_total[5m]) > .80)
        for: 0m
        labels:
          severity: warning
        annotations:
          summary: |-
            Host unusual disk read rate (instance {{ $labels.instance }})
          description: |-
            Disk is too busy (IO wait > 80%)
              VALUE  = {{ $value }}
              LABELS = {{ $labels }}

      - alert: HostOutOfDiskSpace
        expr: (node_filesystem_avail_bytes{fstype!~"^(fuse.*|-tmpfs|cifs|nfs)",mountpoint!="/media/usb"} / node_filesystem_size_bytes < .10 and on (instance, device, mountpoint) node_filesystem_readonly == 0)
        for: 2m
        labels:
          severity: critical
        annotations:
          summary: |-
            Host out of disk space (instance {{ $labels.instance }})
          description: |-
            Disk is almost full (< 10% left)
              VALUE  = {{ $value }}
              LABELS = {{ $labels }}

      - alert: HostHighCpuLoad
        expr: 1 - (avg by (instance) (rate(node_cpu_seconds_total{mode="idle"}[5m]))) > .80
        for: 10m
        labels:
          severity: warning
        annotations:
          summary: |-
            Host high CPU load (instance {{ $labels.instance }})
          description: |-
            CPU load is > 80%
              VALUE  = {{ $value }}
              LABELS = {{ $labels }}

      - alert: HostUnusualNetworkThroughputOut
        expr: ((rate(node_network_transmit_bytes_total[5m]) / on(instance, device) node_network_speed_bytes) > .80)
        for: 0m
        labels:
          severity: warning
        annotations:
          summary: |-
            Host unusual outbound network traffic (instance {{ $labels.instance }})
          description: |-
            Host transmit bandwidth is high (>80%)
              VALUE  = {{ $value }}
              LABELS = {{ $labels }}

      - alert: HostUnusualNetworkThroughputIn
        expr: ((rate(node_network_receive_bytes_total[5m]) / on(instance, device) node_network_speed_bytes) > .80)
        for: 0m
        labels:
          severity: warning
        annotations:
          summary: |-
            Host unusual inbound network traffic (instance {{ $labels.instance }})
          description: |-
            Host receive bandwidth is high (>80%)
              VALUE  = {{ $value }}
              LABELS = {{ $labels }}

      - alert: HostServiceDown
        expr: count(s6_rc_service_up{bundle="default", service=~".*-srv"}) by (instance, service) == 0
        for: 0m
        labels:
          severity: critical
        annotations:
          summary: |-
            s6-rc service down (instance {{ $labels.instance }})
          description: |-
            s6-rc service {{ $labels.service }} on {{ $labels.instance }} is down!
              VALUE  = {{ $value }}
              LABELS = {{ $labels }}

  - name: Traefik
    rules:
      - alert: TraefikHighHttp4xxErrorRateService
        expr: sum(rate(traefik_service_requests_total{service!~".*go-away@.*",code=~"4.*"}[3m])) by (service) / sum(rate(traefik_service_requests_total[3m])) by (service) * 100 > 5
        for: 5m
        labels:
          severity: critical
        annotations:
          summary: |-
            Traefik high HTTP 4xx error rate service (instance {{ $labels.instance }})
          description: |-
            Traefik service 4xx error rate is above 5%
              VALUE  = {{ $value }}
              LABELS = {{ $labels }}

      - alert: TraefikHighHttp5xxErrorRateService
        expr: sum(rate(traefik_service_requests_total{code=~"5.*"}[3m])) by (service) / sum(rate(traefik_service_requests_total[3m])) by (service) * 100 > 5
        for: 5m
        labels:
          severity: critical
        annotations:
          summary: |-
            Traefik high HTTP 5xx error rate service (instance {{ $labels.instance }})
          description: |-
            Traefik service 5xx error rate is above 5%
              VALUE  = {{ $value }}
              LABELS = {{ $labels }}

      - alert: TraefikLatencyHigh
        expr: histogram_quantile(0.99, sum(rate(traefik_entrypoint_request_duration_seconds_bucket{entrypoint=~"https?"}[3m])) by (le, instance)) > 10
        for: 5m
        labels:
          severity: warning
        annotations:
          summary: |-
            Traefik latency high (instance {{ $labels.instance }})
          description: |-
            Traefik p99 latency is higher than 10 seconds
              VALUE  = {{ $value }}
              LABELS = {{ $labels }}

  - name: Podman
    rules:
      - alert: ContainerHighMemoryUsage
        expr: (sum(podman_container_mem_usage_bytes{name!~".*-(infra|-service)$"}) BY (instance, pod_name, name) / sum(podman_container_mem_limit_bytes > 0) BY (instance, pod_name, name) * 100) > 80
        for: 2m
        labels:
          severity: warning
        annotations:
          summary: |-
            Container High Memory usage (instance {{ $labels.instance }})
          description: |-
            Container Memory usage is above 80%
              VALUE = {{ $value }}
              LABELS = {{ $labels }}

      - alert: ContainerLowMemoryUsage
        expr: (sum(podman_container_mem_usage_bytes{name!~".*-(infra|-service)$"}) BY (instance, pod_name, name) / sum(podman_container_mem_limit_bytes > 0) BY (instance, pod_name, name) * 100) < 20
        for: 7d
        labels:
          severity: info
        annotations:
          summary: |-
            Container Low Memory usage (instance {{ $labels.instance }})
          description: |-
            Container Memory usage is under 20% for 1 week. Consider reducing the allocated memory.
              VALUE = {{ $value }}
              LABELS = {{ $labels }}

  - name: BadBots
    rules:
      - alert: BadBotsFail2BanRate
        expr: rate(f2b_jail_banned_current[15m]) > 10
        for: 0m
        labels:
          severity: warning
        annotations:
          summary: |-
            Increased rate of bans
          description: |-
            Fail2Ban has banned more than 10 IPs in the last 15 minutes.
              VALUE = {{ $value }}
              LABELS = {{ $labels }}

      # - alert: BadBotsGoAway...
      #   expr: rate(f2b_jail_banned_current[15m]) > 10
      #   for: 0m
      #   labels:
      #     severity: warning
      #   annotations:
      #     summary: |-
      #       Increased rate of bans
      #     description: |-
      #       Fail2Ban has banned more than 10 IPs in the last 15 minutes.
      #         VALUE = {{ $value }}
      #         LABELS = {{ $labels }}