web_log.conf 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. # make sure we can collect web log data
  2. template: last_collected_secs
  3. on: web_log.response_codes
  4. families: *
  5. calc: $now - $last_collected_t
  6. units: seconds ago
  7. every: 10s
  8. warn: $this > (($status >= $WARNING) ? ($update_every) : ( 5 * $update_every))
  9. crit: $this > (($status == $CRITICAL) ? ($update_every) : (60 * $update_every))
  10. delay: down 5m multiplier 1.5 max 1h
  11. info: number of seconds since the last successful data collection
  12. to: webmaster
  13. # -----------------------------------------------------------------------------
  14. # high level response code alarms
  15. # the following alarms trigger only when there are enough data.
  16. # we assume there are enough data when:
  17. #
  18. # $1m_requests > 120
  19. #
  20. # i.e. when there are at least 120 requests during the last minute
  21. template: 1m_requests
  22. on: web_log.response_statuses
  23. families: *
  24. lookup: sum -1m unaligned
  25. calc: ($this == 0)?(1):($this)
  26. units: requests
  27. every: 10s
  28. info: the sum of all HTTP requests over the last minute
  29. template: 1m_successful
  30. on: web_log.response_statuses
  31. families: *
  32. lookup: sum -1m unaligned of successful_requests
  33. calc: $this * 100 / $1m_requests
  34. units: %
  35. every: 10s
  36. warn: ($1m_requests > 120) ? ($this < (($status >= $WARNING ) ? ( 95 ) : ( 85 )) ) : ( 0 )
  37. crit: ($1m_requests > 120) ? ($this < (($status == $CRITICAL) ? ( 85 ) : ( 75 )) ) : ( 0 )
  38. delay: up 2m down 15m multiplier 1.5 max 1h
  39. info: the ratio of successful HTTP responses (1xx, 2xx, 304) over the last minute
  40. to: webmaster
  41. template: 1m_redirects
  42. on: web_log.response_statuses
  43. families: *
  44. lookup: sum -1m unaligned of redirects
  45. calc: $this * 100 / $1m_requests
  46. units: %
  47. every: 10s
  48. warn: ($1m_requests > 120) ? ($this > (($status >= $WARNING ) ? ( 1 ) : ( 20 )) ) : ( 0 )
  49. crit: ($1m_requests > 120) ? ($this > (($status == $CRITICAL) ? ( 20 ) : ( 30 )) ) : ( 0 )
  50. delay: up 2m down 15m multiplier 1.5 max 1h
  51. info: the ratio of HTTP redirects (3xx except 304) over the last minute
  52. to: webmaster
  53. template: 1m_bad_requests
  54. on: web_log.response_statuses
  55. families: *
  56. lookup: sum -1m unaligned of bad_requests
  57. calc: $this * 100 / $1m_requests
  58. units: %
  59. every: 10s
  60. warn: ($1m_requests > 120) ? ($this > (($status >= $WARNING) ? ( 10 ) : ( 30 )) ) : ( 0 )
  61. crit: ($1m_requests > 120) ? ($this > (($status == $CRITICAL) ? ( 30 ) : ( 50 )) ) : ( 0 )
  62. delay: up 2m down 15m multiplier 1.5 max 1h
  63. info: the ratio of HTTP bad requests (4xx) over the last minute
  64. to: webmaster
  65. template: 1m_internal_errors
  66. on: web_log.response_statuses
  67. families: *
  68. lookup: sum -1m unaligned of server_errors
  69. calc: $this * 100 / $1m_requests
  70. units: %
  71. every: 10s
  72. warn: ($1m_requests > 120) ? ($this > (($status >= $WARNING) ? ( 1 ) : ( 2 )) ) : ( 0 )
  73. crit: ($1m_requests > 120) ? ($this > (($status == $CRITICAL) ? ( 2 ) : ( 5 )) ) : ( 0 )
  74. delay: up 2m down 15m multiplier 1.5 max 1h
  75. info: the ratio of HTTP internal server errors (5xx), over the last minute
  76. to: webmaster
  77. # unmatched lines
  78. # the following alarms trigger only when there are enough data.
  79. # we assume there are enough data when:
  80. #
  81. # $1m_total_requests > 120
  82. #
  83. # i.e. when there are at least 120 requests during the last minute
  84. template: 1m_total_requests
  85. on: web_log.response_codes
  86. families: *
  87. lookup: sum -1m unaligned
  88. calc: ($this == 0)?(1):($this)
  89. units: requests
  90. every: 10s
  91. info: the sum of all HTTP requests over the last minute
  92. template: 1m_unmatched
  93. on: web_log.response_codes
  94. families: *
  95. lookup: sum -1m unaligned of unmatched
  96. calc: $this * 100 / $1m_total_requests
  97. units: %
  98. every: 10s
  99. warn: ($1m_total_requests > 120) ? ($this > 1) : ( 0 )
  100. crit: ($1m_total_requests > 120) ? ($this > 5) : ( 0 )
  101. delay: up 1m down 5m multiplier 1.5 max 1h
  102. info: the ratio of unmatched lines, over the last minute
  103. to: webmaster
  104. # -----------------------------------------------------------------------------
  105. # web slow
  106. # the following alarms trigger only when there are enough data.
  107. # we assume there are enough data when:
  108. #
  109. # $1m_requests > 120
  110. #
  111. # i.e. when there are at least 120 requests during the last minute
  112. template: 10m_response_time
  113. on: web_log.response_time
  114. families: *
  115. lookup: average -10m unaligned of avg
  116. units: ms
  117. every: 30s
  118. info: the average time to respond to HTTP requests, over the last 10 minutes
  119. template: web_slow
  120. on: web_log.response_time
  121. families: *
  122. lookup: average -1m unaligned of avg
  123. units: ms
  124. every: 10s
  125. green: 500
  126. red: 1000
  127. warn: ($1m_requests > 120) ? ($this > $green && $this > ($10m_response_time * 2) ) : ( 0 )
  128. crit: ($1m_requests > 120) ? ($this > $red && $this > ($10m_response_time * 4) ) : ( 0 )
  129. delay: down 15m multiplier 1.5 max 1h
  130. info: the average time to respond to HTTP requests, over the last 1 minute
  131. options: no-clear-notification
  132. to: webmaster
  133. # -----------------------------------------------------------------------------
  134. # web too many or too few requests
  135. # the following alarms trigger only when there are enough data.
  136. # we assume there are enough data when:
  137. #
  138. # $5m_successful_old > 120
  139. #
  140. # i.e. when there were at least 120 requests during the 5 minutes starting
  141. # at -10m and ending at -5m
  142. template: 5m_successful_old
  143. on: web_log.response_statuses
  144. families: *
  145. lookup: average -5m at -5m unaligned of successful_requests
  146. units: requests/s
  147. every: 30s
  148. info: average rate of successful HTTP requests over the last 5 minutes
  149. template: 5m_successful
  150. on: web_log.response_statuses
  151. families: *
  152. lookup: average -5m unaligned of successful_requests
  153. units: requests/s
  154. every: 30s
  155. info: average successful HTTP requests over the last 5 minutes
  156. template: 5m_requests_ratio
  157. on: web_log.response_codes
  158. families: *
  159. calc: ($5m_successful_old > 0)?($5m_successful * 100 / $5m_successful_old):(100)
  160. units: %
  161. every: 30s
  162. warn: ($5m_successful_old > 120) ? ($this > 200 OR $this < 50) : (0)
  163. crit: ($5m_successful_old > 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 successful web requests over the last 5 minutes, \
  167. compared with the previous 5 minutes \
  168. (clear notification for this alarm will not be sent)
  169. to: webmaster