summaryrefslogtreecommitdiffstats
path: root/health/health.d/web_log.conf
blob: 44de38a48e201dcbd6effa55fc64423abca10206 (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
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
# make sure we can collect web log data

template: last_collected_secs
      on: web_log.response_codes
families: *
    calc: $now - $last_collected_t
   units: seconds ago
   every: 10s
    warn: $this > (($status >= $WARNING)  ? ($update_every) : ( 5 * $update_every))
    crit: $this > (($status == $CRITICAL) ? ($update_every) : (60 * $update_every))
   delay: down 5m multiplier 1.5 max 1h
    info: number of seconds since the last successful data collection
      to: webmaster


# -----------------------------------------------------------------------------
# high level response code alarms

# the following alarms trigger only when there are enough data.
# we assume there are enough data when:
#
#  $1m_requests > 120
#
# i.e. when there are at least 120 requests during the last minute

template: 1m_requests
      on: web_log.response_statuses
families: *
  lookup: sum -1m unaligned
    calc: ($this == 0)?(1):($this)
   units: requests
   every: 10s
    info: the sum of all HTTP requests over the last minute

template: 1m_successful
      on: web_log.response_statuses
families: *
  lookup: sum -1m unaligned of successful_requests
    calc: $this * 100 / $1m_requests
   units: %
   every: 10s
    warn: ($1m_requests > 120) ? ($this < (($status >= $WARNING ) ? ( 95 ) : ( 85 )) ) : ( 0 )
    crit: ($1m_requests > 120) ? ($this < (($status == $CRITICAL) ? ( 85 ) : ( 75 )) ) : ( 0 )
   delay: up 2m down 15m multiplier 1.5 max 1h
    info: the ratio of successful HTTP responses (1xx, 2xx, 304, 401) over the last minute
      to: webmaster

template: 1m_redirects
      on: web_log.response_statuses
families: *
  lookup: sum -1m unaligned of redirects
    calc: $this * 100 / $1m_requests
   units: %
   every: 10s
    warn: ($1m_requests > 120) ? ($this > (($status >= $WARNING ) ? (  1 ) : ( 20 )) ) : ( 0 )
    crit: ($1m_requests > 120) ? ($this > (($status == $CRITICAL) ? ( 20 ) : ( 30 )) ) : ( 0 )
   delay: up 2m down 15m multiplier 1.5 max 1h
    info: the ratio of HTTP redirects (3xx except 304) over the last minute
      to: webmaster

template: 1m_bad_requests
      on: web_log.response_statuses
families: *
  lookup: sum -1m unaligned of bad_requests
    calc: $this * 100 / $1m_requests
   units: %
   every: 10s
    warn: ($1m_requests > 120) ? ($this > (($status >= $WARNING)  ? ( 10 ) : ( 30 )) ) : ( 0 )
    crit: ($1m_requests > 120) ? ($this > (($status == $CRITICAL) ? ( 30 ) : ( 50 )) ) : ( 0 )
   delay: up 2m down 15m multiplier 1.5 max 1h
    info: the ratio of HTTP bad requests (4xx except 401) over the last minute
      to: webmaster

template: 1m_internal_errors
      on: web_log.response_statuses
families: *
  lookup: sum -1m unaligned of server_errors
    calc: $this * 100 / $1m_requests
   units: %
   every: 10s
    warn: ($1m_requests > 120) ? ($this > (($status >= $WARNING)  ? ( 1 ) : ( 2 )) ) : ( 0 )
    crit: ($1m_requests > 120) ? ($this > (($status == $CRITICAL) ? ( 2 ) : ( 5 )) ) : ( 0 )
   delay: up 2m down 15m multiplier 1.5 max 1h
    info: the ratio of HTTP internal server errors (5xx), over the last minute
      to: webmaster

# unmatched lines

# the following alarms trigger only when there are enough data.
# we assume there are enough data when:
#
#  $1m_total_requests > 120
#
# i.e. when there are at least 120 requests during the last minute

template: 1m_total_requests
      on: web_log.response_codes
families: *
  lookup: sum -1m unaligned
    calc: ($this == 0)?(1):($this)
   units: requests
   every: 10s
    info: the sum of all HTTP requests over the last minute

template: 1m_unmatched
on: web_log.response_codes
families: *
  lookup: sum -1m unaligned of unmatched
    calc: $this * 100 / $1m_total_requests
   units: %
   every: 10s
    warn: ($1m_total_requests > 120) ? ($this > 1) : ( 0 )
   delay: up 1m down 5m multiplier 1.5 max 1h
    info: the ratio of unmatched lines, over the last minute
      to: webmaster

# -----------------------------------------------------------------------------
# web slow

# the following alarms trigger only when there are enough data.
# we assume there are enough data when:
#
#  $1m_requests > 120
#
# i.e. when there are at least 120 requests during the last minute

template: 10m_response_time
      on: web_log.response_time
families: *
  lookup: average -10m unaligned of avg
   units: ms
   every: 30s
    info: the average time to respond to HTTP requests, over the last 10 minutes

template: web_slow
      on: web_log.response_time
families: *
  lookup: average -1m unaligned of avg
   units: ms
   every: 10s
   green: 500
     red: 1000
    warn: ($1m_requests > 120) ? ($this > $green && $this > ($10m_response_time * 2) ) : ( 0 )
    crit: ($1m_requests > 120) ? ($this > $red   && $this > ($10m_response_time * 4) ) : ( 0 )
   delay: down 15m multiplier 1.5 max 1h
    info: the average time to respond to HTTP requests, over the last 1 minute
 options: no-clear-notification
      to: webmaster

# -----------------------------------------------------------------------------
# web too many or too few requests

# the following alarms trigger only when there are enough data.
# we assume there are enough data when:
#
#  $5m_successful_old > 120
#
# i.e. when there were at least 120 requests during the 5 minutes starting
#      at -10m and ending at -5m

template: 5m_successful_old
      on: web_log.response_statuses
families: *
  lookup: average -5m at -5m unaligned of successful_requests
   units: requests/s
   every: 30s
    info: average rate of successful HTTP requests over the last 5 minutes

template: 5m_successful
      on: web_log.response_statuses
families: *
  lookup: average -5m unaligned of successful_requests
   units: requests/s
   every: 30s
    info: average successful HTTP requests over the last 5 minutes

template: 5m_requests_ratio
      on: web_log.response_codes
families: *
    calc: ($5m_successful_old > 0)?($5m_successful * 100 / $5m_successful_old):(100)
   units: %
   every: 30s
    warn: ($5m_successful_old > 120) ? ($this > 200 OR $this < 50) : (0)
    crit: ($5m_successful_old > 120) ? ($this > 400 OR $this < 25) : (0)
   delay: down 15m multiplier 1.5 max 1h
options: no-clear-notification
    info: the percentage of successful web requests over the last 5 minutes, \
          compared with the previous 5 minutes \
          (clear notification for this alarm will not be sent)
      to: webmaster



# ---------------------------------------------------GO-VERSION---------------------------------------------------------

# make sure we can collect web log data

template: web_log_last_collected_secs
      on: web_log.requests
families: *
    calc: $now - $last_collected_t
   units: seconds ago
   every: 10s
    warn: $this > (($status >= $WARNING)  ? ($update_every) : ( 5 * $update_every))
    crit: $this > (($status == $CRITICAL) ? ($update_every) : (60 * $update_every))
   delay: down 5m multiplier 1.5 max 1h
    info: number of seconds since the last successful data collection
      to: webmaster

# unmatched lines

# the following alarms trigger only when there are enough data.
# we assume there are enough data when:
#
#  $1m_total_requests > 120
#
# i.e. when there are at least 120 requests during the last minute

template: web_log_1m_total_requests
      on: web_log.requests
families: *
  lookup: sum -1m unaligned
    calc: ($this == 0)?(1):($this)
   units: requests
   every: 10s
    info: the sum of all HTTP requests over the last minute

template: web_log_1m_unmatched
      on: web_log.excluded_requests
families: *
  lookup: sum -1m unaligned of unmatched
    calc: $this * 100 / $web_log_1m_total_requests
   units: %
   every: 10s
    warn: ($web_log_1m_total_requests > 120) ? ($this > 1) : ( 0 )
   delay: up 1m down 5m multiplier 1.5 max 1h
    info: the ratio of unmatched lines, over the last minute
      to: webmaster

# -----------------------------------------------------------------------------
# high level response code alarms

# the following alarms trigger only when there are enough data.
# we assume there are enough data when:
#
#  $1m_requests > 120
#
# i.e. when there are at least 120 requests during the last minute

template: web_log_1m_requests
      on: web_log.type_requests
families: *
  lookup: sum -1m unaligned
    calc: ($this == 0)?(1):($this)
   units: requests
   every: 10s
    info: the sum of all HTTP requests over the last minute

template: web_log_1m_successful
      on: web_log.type_requests
families: *
  lookup: sum -1m unaligned of success
    calc: $this * 100 / $web_log_1m_requests
   units: %
   every: 10s
    warn: ($web_log_1m_requests > 120) ? ($this < (($status >= $WARNING ) ? ( 95 ) : ( 85 )) ) : ( 0 )
    crit: ($web_log_1m_requests > 120) ? ($this < (($status == $CRITICAL) ? ( 85 ) : ( 75 )) ) : ( 0 )
   delay: up 2m down 15m multiplier 1.5 max 1h
    info: the ratio of successful HTTP responses (1xx, 2xx, 304, 401) over the last minute
      to: webmaster

template: web_log_1m_redirects
      on: web_log.type_requests
families: *
  lookup: sum -1m unaligned of redirect
    calc: $this * 100 / $web_log_1m_requests
   units: %
   every: 10s
    warn: ($web_log_1m_requests > 120) ? ($this > (($status >= $WARNING ) ? (  1 ) : ( 20 )) ) : ( 0 )
    crit: ($web_log_1m_requests > 120) ? ($this > (($status == $CRITICAL) ? ( 20 ) : ( 30 )) ) : ( 0 )
   delay: up 2m down 15m multiplier 1.5 max 1h
    info: the ratio of HTTP redirects (3xx except 304) over the last minute
      to: webmaster

template: web_log_1m_bad_requests
      on: web_log.type_requests
families: *
  lookup: sum -1m unaligned of bad
    calc: $this * 100 / $web_log_1m_requests
   units: %
   every: 10s
    warn: ($web_log_1m_requests > 120) ? ($this > (($status >= $WARNING)  ? ( 10 ) : ( 30 )) ) : ( 0 )
    crit: ($web_log_1m_requests > 120) ? ($this > (($status == $CRITICAL) ? ( 30 ) : ( 50 )) ) : ( 0 )
   delay: up 2m down 15m multiplier 1.5 max 1h
    info: the ratio of HTTP bad requests (4xx except 401) over the last minute
      to: webmaster

template: web_log_1m_internal_errors
      on: web_log.type_requests
families: *
  lookup: sum -1m unaligned of error
    calc: $this * 100 / $web_log_1m_requests
   units: %
   every: 10s
    warn: ($web_log_1m_requests > 120) ? ($this > (($status >= $WARNING)  ? ( 1 ) : ( 2 )) ) : ( 0 )
    crit: ($web_log_1m_requests > 120) ? ($this > (($status == $CRITICAL) ? ( 2 ) : ( 5 )) ) : ( 0 )
   delay: up 2m down 15m multiplier 1.5 max 1h
    info: the ratio of HTTP internal server errors (5xx), over the last minute
      to: webmaster

# -----------------------------------------------------------------------------
# web slow

# the following alarms trigger only when there are enough data.
# we assume there are enough data when:
#
#  $1m_requests > 120
#
# i.e. when there are at least 120 requests during the last minute

template: web_log_10m_response_time
      on: web_log.request_processing_time
families: *
  lookup: average -10m unaligned of avg
   units: ms
   every: 30s
    info: the average time to respond to HTTP requests, over the last 10 minutes

template: web_log_web_slow
      on: web_log.request_processing_time
families: *
  lookup: average -1m unaligned of avg
   units: ms
   every: 10s
   green: 500
     red: 1000
    warn: ($web_log_1m_requests > 120) ? ($this > $green && $this > ($web_log_10m_response_time * 2) ) : ( 0 )
    crit: ($web_log_1m_requests > 120) ? ($this > $red   && $this > ($web_log_10m_response_time * 4) ) : ( 0 )
   delay: down 15m multiplier 1.5 max 1h
    info: the average time to respond to HTTP requests, over the last 1 minute
 options: no-clear-notification
      to: webmaster

# -----------------------------------------------------------------------------
# web too many or too few requests

# the following alarms trigger only when there are enough data.
# we assume there are enough data when:
#
#  $5m_successful_old > 120
#
# i.e. when there were at least 120 requests during the 5 minutes starting
#      at -10m and ending at -5m

template: web_log_5m_successful_old
      on: web_log.type_requests
families: *
  lookup: average -5m at -5m unaligned of success
   units: requests/s
   every: 30s
    info: average rate of successful HTTP requests over the last 5 minutes

template: web_log_5m_successful
      on: web_log.type_requests
families: *
  lookup: average -5m unaligned of success
   units: requests/s
   every: 30s
    info: average successful HTTP requests over the last 5 minutes

template: web_log_5m_requests_ratio
      on: web_log.type_requests
families: *
    calc: ($web_log_5m_successful_old > 0)?($web_log_5m_successful * 100 / $web_log_5m_successful_old):(100)
   units: %
   every: 30s
    warn: ($web_log_5m_successful_old > 120) ? ($this > 200 OR $this < 50) : (0)
    crit: ($web_log_5m_successful_old > 120) ? ($this > 400 OR $this < 25) : (0)
   delay: down 15m multiplier 1.5 max 1h
options: no-clear-notification
    info: the percentage of successful web requests over the last 5 minutes, \
          compared with the previous 5 minutes \
          (clear notification for this alarm will not be sent)
      to: webmaster