]> arthur.barton.de Git - netdata.git/blobdiff - conf.d/health.d/web_log.conf
dns_query_time plugin: replace "." with "_" in dimensions
[netdata.git] / conf.d / health.d / web_log.conf
index 82e7d987e2439db55efa00527011e7ae760a16ee..c668959f51b4bed77ba40e8a491bafdd003b747d 100644 (file)
@@ -3,6 +3,7 @@
 
 template: last_collected_secs
       on: web_log.response_codes
+families: *
     calc: $now - $last_collected_t
    units: seconds ago
    every: 10s
@@ -12,76 +13,107 @@ template: last_collected_secs
     info: number of seconds since the last successful data collection
       to: webmaster
 
+
 # -----------------------------------------------------------------------------
 # high level response code alarms
 
-template: 1m_2xx
-      on: web_log.response_codes
-  lookup: sum -1m unaligned of 2xx
+# 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 successful HTTP requests over the last minute
+    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) over the last minute
+      to: webmaster
 
 template: 1m_redirects
-      on: web_log.response_codes
-  lookup: sum -1m unaligned of 3xx
-    calc: $this * 100 / ( $1m_2xx + $this )
+      on: web_log.response_statuses
+families: *
+  lookup: sum -1m unaligned of redirects
+    calc: $this * 100 / $1m_requests
    units: %
    every: 10s
-    warn: $this > (($status >= $WARNING)  ? ( 1 ) : ( 2 ))
-    crit: $this > (($status == $CRITICAL) ? ( 2 ) : ( 5 ))
-   delay: down 15m multiplier 1.5 max 1h
-    info: the ratio of HTTP redirects (3xx) vs the successful requests, \
-          over the last minute
+    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_codes
-  lookup: sum -1m unaligned of 4xx
-    calc: $this * 100 / ( $1m_2xx + $this )
+      on: web_log.response_statuses
+families: *
+  lookup: sum -1m unaligned of bad_requests
+    calc: $this * 100 / $1m_requests
    units: %
    every: 10s
-    warn: $this > (($status >= $WARNING)  ? ( 1 ) : (  5 ))
-    crit: $this > (($status == $CRITICAL) ? ( 5 ) : ( 10 ))
-   delay: down 15m multiplier 1.5 max 1h
-    info: the ratio of HTTP bad requests (4xx) vs the successful requests, \
-          over the last minute
+    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) over the last minute
       to: webmaster
 
 template: 1m_internal_errors
-      on: web_log.response_codes
-  lookup: sum -1m unaligned of 5xx
-    calc: $this * 100 / ( $1m_2xx + $this )
+      on: web_log.response_statuses
+families: *
+  lookup: sum -1m unaligned of server_errors
+    calc: $this * 100 / $1m_requests
    units: %
    every: 10s
-    warn: $this > (($status >= $WARNING)  ? ( 1 ) : ( 2 ))
-    crit: $this > (($status == $CRITICAL) ? ( 2 ) : ( 5 ))
-   delay: down 15m multiplier 1.5 max 1h
-    info: the ratio of HTTP internal server errors (5xx) vs the successful \
-          requests, over the last minute
+    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
 
+
 # -----------------------------------------------------------------------------
 # 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
-  lookup: sum -1m unaligned of avg
+families: *
+  lookup: average -1m unaligned of avg
    units: ms
    every: 10s
    green: 500
      red: 1000
-    warn: $this > $green && $this > ($10m_response_time * 2)
-    crit: $this > $red   && $this > ($10m_response_time * 4)
+    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
       to: webmaster
@@ -89,30 +121,41 @@ template: web_slow
 # -----------------------------------------------------------------------------
 # web too many or too few requests
 
-template: 5m_2xx_last
-      on: web_log.response_codes
-  lookup: average -5m at -5m unaligned of 2xx
-   units: 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 successful HTTP requests over the last 5 minutes
+    info: average rate of successful HTTP requests over the last 5 minutes
 
-template: 5m_2xx_now
-      on: web_log.response_codes
-  lookup: average -5m unaligned of 2xx
-   units: requests
+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
-    calc: ($5m_2xx_last > 0)?($5m_2xx_now * 100 / $5m_2xx_last):(100)
+families: *
+    calc: ($5m_successful_old > 0)?($5m_successful * 100 / $5m_successful_old):(100)
    units: %
    every: 30s
-    warn: ($5m_2xx_last > 30)?($this > 200 OR $this < 50):(0)
-    crit: ($5m_2xx_last > 30)?($this > 400 OR $this < 25):(0)
+    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 web requests over the last 5 minutes, \
-          compared with the previous 15 minutes
+    info: the percentage of successful web requests over the last 5 minutes, \
+          compared with the previous 5 minutes
       to: webmaster