about summary refs log tree commit diff
path: root/modules/nixos/monitoring/rules/nginx.yaml
blob: f00d3721026b405c3cdb47ab7e5ecc0306e05167 (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
---
groups:
  - name: Nginx

    rules:
      - alert: NginxHighHttp4xxErrorRate
        expr: >-
          sum(rate(nginx_http_requests_total{status=~"^4.."}[1m]))
          /
          sum(rate(nginx_http_requests_total[1m])) * 100
          > 5
        for: 1m
        labels:
          severity: critical
        annotations:
          summary: NGINX high HTTP 4xx error rate at {{ $labels.instance }}.
          description: |-
            Too many HTTP requests with a 4xx status code.

            VALUE = {{ $value }}
            LABELS = {{ $labels }}

      - alert: NginxHighHttp5xxErrorRate
        expr: >-
          sum(rate(nginx_http_requests_total{status=~"^5.."}[1m]))
          /
          sum(rate(nginx_http_requests_total[1m])) * 100
          > 5
        for: 1m
        labels:
          severity: critical
        annotations:
          summary: NGINX high HTTP 5xx error rate at {{ $labels.instance }}.
          description: |-
            Too many HTTP requests with a 5xx status code.

            VALUE = {{ $value }}
            LABELS = {{ $labels }}

      - alert: NginxLatencyHigh
        expr: >-
          histogram_quantile(
            0.99,
            sum(
              rate(
                nginx_http_request_duration_seconds_bucket[2m]
              )
            ) by (host, node)
          )
          > 3
        for: 2m
        labels:
          severity: warning
        annotations:
          summary: NGINX high latency at {{ $labels.instance }}.
          description: |-
            NGINX 99% of latency spikes is higher than 3 seconds.

            VALUE = {{ $value }}
            LABELS = {{ $labels }}

Consider giving Nix/NixOS a try! <3