2 # make sure we can collect web log data
4 template: last_collected_secs
5 on: web_log.response_codes
7 calc: $now - $last_collected_t
10 warn: $this > (($status >= $WARNING) ? ($update_every) : ( 5 * $update_every))
11 crit: $this > (($status == $CRITICAL) ? ($update_every) : (60 * $update_every))
12 delay: down 5m multiplier 1.5 max 1h
13 info: number of seconds since the last successful data collection
17 # -----------------------------------------------------------------------------
18 # high level response code alarms
20 # the following alarms trigger only when there are enough data.
21 # we assume there are enough data when:
25 # i.e. when there are at least 120 requests during the last minute
28 on: web_log.response_codes
30 lookup: sum -1m unaligned
31 calc: ($this == 0)?(1):($this)
34 info: the sum of all HTTP requests over the last minute
37 on: web_log.response_codes
39 lookup: sum -1m unaligned of 2xx
40 calc: ($this == 0)?(1):($this)
43 info: the sum of successful HTTP requests over the last minute
45 template: 1m_successful
46 on: web_log.response_codes
48 calc: $1m_2xx * 100 / $1m_requests
51 warn: ($1m_requests > 120) ? ($this < (($status >= $WARNING ) ? ( 98 ) : ( 95 )) ) : ( 0 )
52 crit: ($1m_requests > 120) ? ($this < (($status == $CRITICAL) ? ( 95 ) : ( 90 )) ) : ( 0 )
53 delay: down 15m multiplier 1.5 max 1h
54 info: the ratio of successful HTTP responses (2xx) over the last minute
57 template: 1m_redirects
58 on: web_log.detailed_response_codes
60 lookup: sum -1m unaligned of 301,303,307,308
61 calc: $this * 100 / $1m_requests
64 warn: ($1m_requests > 120) ? ($this > (($status >= $WARNING ) ? ( 1 ) : ( 2 )) ) : ( 0 )
65 crit: ($1m_requests > 120) ? ($this > (($status == $CRITICAL) ? ( 2 ) : ( 5 )) ) : ( 0 )
66 delay: down 15m multiplier 1.5 max 1h
67 info: the ratio of HTTP redirects (301, 303, 307, 308) over the last minute
70 template: 1m_bad_requests
71 on: web_log.response_codes
73 lookup: sum -1m unaligned of 4xx
74 calc: $this * 100 / $1m_requests
77 warn: ($1m_requests > 120) ? ($this > (($status >= $WARNING) ? ( 1 ) : ( 5 )) ) : ( 0 )
78 crit: ($1m_requests > 120) ? ($this > (($status == $CRITICAL) ? ( 5 ) : ( 10 )) ) : ( 0 )
79 delay: down 15m multiplier 1.5 max 1h
80 info: the ratio of HTTP bad requests (4xx) over the last minute
83 template: 1m_internal_errors
84 on: web_log.response_codes
86 lookup: sum -1m unaligned of 5xx
87 calc: $this * 100 / $1m_requests
90 warn: ($1m_requests > 120) ? ($this > (($status >= $WARNING) ? ( 1 ) : ( 2 )) ) : ( 0 )
91 crit: ($1m_requests > 120) ? ($this > (($status == $CRITICAL) ? ( 2 ) : ( 5 )) ) : ( 0 )
92 delay: down 15m multiplier 1.5 max 1h
93 info: the ratio of HTTP internal server errors (5xx), over the last minute
97 # -----------------------------------------------------------------------------
100 # the following alarms trigger only when there are enough data.
101 # we assume there are enough data when:
105 # i.e. when there are at least 120 requests during the last minute
107 template: 10m_response_time
108 on: web_log.response_time
110 lookup: average -10m unaligned of avg
113 info: the average time to respond to HTTP requests, over the last 10 minutes
116 on: web_log.response_time
118 lookup: average -1m unaligned of avg
123 warn: ($1m_requests > 120) ? ($this > $green && $this > ($10m_response_time * 2) ) : ( 0 )
124 crit: ($1m_requests > 120) ? ($this > $red && $this > ($10m_response_time * 4) ) : ( 0 )
125 delay: down 15m multiplier 1.5 max 1h
126 info: the average time to respond to HTTP requests, over the last 1 minute
129 # -----------------------------------------------------------------------------
130 # web too many or too few requests
132 # the following alarms trigger only when there are enough data.
133 # we assume there are enough data when:
137 # i.e. when there were at least 120 requests during the 5 minutes starting
138 # at -10m and ending at -5m
140 template: 5m_2xx_last
141 on: web_log.response_codes
143 lookup: average -5m at -5m unaligned of 2xx
146 info: average successful HTTP requests over the last 5 minutes
149 on: web_log.response_codes
151 lookup: average -5m unaligned of 2xx
154 info: average successful HTTP requests over the last 5 minutes
156 template: 5m_requests_ratio
157 on: web_log.response_codes
159 calc: ($5m_2xx_last > 0)?($5m_2xx_now * 100 / $5m_2xx_last):(100)
162 warn: ($5m_2xx_last > 120) ? ($this > 200 OR $this < 50) : (0)
163 crit: ($5m_2xx_last > 120) ? ($this > 400 OR $this < 25) : (0)
164 delay: down 15m multiplier 1.5 max 1h
165 options: no-clear-notification
166 info: the percentage of web requests over the last 5 minutes, \
167 compared with the previous 5 minutes