summaryrefslogtreecommitdiff
path: root/modules/nixos/monitoring/rules/redis.yaml
blob: f6d1fe11711a79bf9594df2e18ba9488b682b290 (plain)
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
---
groups:
  - name: Redis

    rules:
      - alert: RedisDown
        expr: >-
          redis_up == 0
        for: 0m
        labels:
          severity: critical
        annotations:
          summary: Redis down (instance {{ $labels.instance }})
          description: |-
            Redis instance is down.

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

      - alert: RedisMissingMaster
        expr: >-
          (count(redis_instance_info{role="master"}) or vector(0))
          < 1
        for: 0m
        labels:
          severity: critical
        annotations:
          summary: Redis missing master (instance {{ $labels.instance }})
          description: |-
            Redis cluster has no node marked as master.

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

      - alert: RedisTooManyMasters
        expr: >-
          count(redis_instance_info{role="master"}) > 1
        for: 0m
        labels:
          severity: critical
        annotations:
          summary: Redis too many masters (instance {{ $labels.instance }})
          description: |-
            Redis cluster has too many nodes marked as master.

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

      - alert: RedisDisconnectedSlaves
        expr: >-
          count without (instance, job) (redis_connected_slaves)
          - sum without (instance, job) (redis_connected_slaves)
          - 1
          > 1
        for: 0m
        labels:
          severity: critical
        annotations:
          summary: Redis disconnected slaves (instance {{ $labels.instance }})
          description: |-
            Redis is not replicating for all slaves.

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

      - alert: RedisReplicationBroken
        expr: >-
          delta(redis_connected_slaves[1m]) < 0
        for: 0m
        labels:
          severity: critical
        annotations:
          summary: Redis replication broken (instance {{ $labels.instance }})
          description: |-
            Redis instance lost a slave.

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

      - alert: RedisClusterFlapping
        expr: >-
          changes(redis_connected_slaves[1m]) > 1
        for: 2m
        labels:
          severity: critical
        annotations:
          summary: Redis cluster flapping (instance {{ $labels.instance }})
          description: |-
            Changes have been detected in the Redis replica connection. This can
            occur when replica nodes lose connection to the master and reconnect
            (a.k.a flapping).

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

      - alert: RedisMissingBackup
        expr: >-
          time() - redis_rdb_last_save_timestamp_seconds
          > 60 * 60 * 24
        for: 0m
        labels:
          severity: critical
        annotations:
          summary: Redis missing backup (instance {{ $labels.instance }})
          description: |-
            Redis has not been backed up for 24 hours.

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

      - alert: RedisOutOfSystemMemory
        expr: >-
          redis_memory_used_bytes
          /
          redis_total_system_memory_bytes * 100
          > 90
        for: 2m
        labels:
          severity: warning
        annotations:
          summary: Redis out of system memory (instance {{ $labels.instance }})
          description: |-
            Redis is running out of system memory (> 90%).

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

      - alert: RedisOutOfConfiguredMaxmemory
        expr: >-
          redis_memory_max_bytes != 0
          and
          (
            redis_memory_used_bytes
            /
            redis_memory_max_bytes * 100
            > 90
          )
        for: 2m
        labels:
          severity: warning
        annotations:
          summary: Redis out of configured maxmemory (instance {{ $labels.instance }})
          description: |-
            Redis is running out of configured maxmemory (> 90%).

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

      - alert: RedisTooManyConnections
        expr: >-
          redis_connected_clients > 100
        for: 2m
        labels:
          severity: warning
        annotations:
          summary: Redis too many connections (instance {{ $labels.instance }})
          description: |-
            Redis instance has too many connections.

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

      - alert: RedisNotEnoughConnections
        expr: >-
          redis_connected_clients < 1
        for: 2m
        labels:
          severity: warning
        annotations:
          summary: Redis not enough connections (instance {{ $labels.instance }})
          description: |-
            Redis instance should have more connections (> 1).

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

      - alert: RedisRejectedConnections
        expr: >-
          increase(redis_rejected_connections_total[1m]) > 0
        for: 0m
        labels:
          severity: critical
        annotations:
          summary: Redis rejected connections (instance {{ $labels.instance }})
          description: |-
            Some connections to Redis have been rejected.

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