]> arthur.barton.de Git - netdata.git/commitdiff
Merge pull request #1758 from ktsaou/master
authorCosta Tsaousis <costa@tsaousis.gr>
Sat, 11 Feb 2017 15:17:25 +0000 (17:17 +0200)
committerGitHub <noreply@github.com>
Sat, 11 Feb 2017 15:17:25 +0000 (17:17 +0200)
web_log fixes No 2

conf.d/health.d/web_log.conf
configs.signatures
python.d/web_log.chart.py
web/dashboard_info.js
web/index.html

index 4300fe7557f2b741676dbebe5e7793d63d0ddac4..b6d2d537f9a811e16d9aae59937bb1bacfeba450 100644 (file)
@@ -16,6 +16,15 @@ families: *
 # -----------------------------------------------------------------------------
 # high level response code alarms
 
+template: 1m_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_2xx
       on: web_log.response_codes
 families: *
@@ -25,20 +34,33 @@ families: *
    every: 10s
     info: the sum of successful HTTP requests over the last minute
 
-template: 1m_redirects
+template: 1m_successful
       on: web_log.response_codes
 families: *
-  lookup: sum -1m unaligned of 3xx
-    calc: $this * 100 / ( $1m_2xx + $this )
+    calc: $1m_2xx * 100 / $1m_requests
    units: %
    every: 10s
-    warn: $this > (($status >= $WARNING)  ? ( 1 ) : ( 2 ))
-    crit: $this > (($status == $CRITICAL) ? ( 2 ) : ( 5 ))
+    warn: ($1m_requests > 30) ? ($this < (($status >= $WARNING ) ? ( 98 ) : ( 95 )) ) : ( 0 )
+    crit: ($1m_requests > 30) ? ($this < (($status == $CRITICAL) ? ( 95 ) : ( 90 )) ) : ( 0 )
    delay: down 15m multiplier 1.5 max 1h
     info: the ratio of HTTP redirects (3xx) vs the successful requests, \
           over the last minute
       to: webmaster
 
+template: 1m_redirects
+      on: web_log.detailed_response_codes
+families: *
+  lookup: sum -1m unaligned of 301,303,307,308
+    calc: $this * 100 / ( $1m_2xx + $this )
+   units: %
+   every: 10s
+    warn: ($1m_requests > 30) ? ($this > (($status >= $WARNING ) ? ( 1 ) : ( 2 )) ) : ( 0 )
+    crit: ($1m_requests > 30) ? ($this > (($status == $CRITICAL) ? ( 2 ) : ( 5 )) ) : ( 0 )
+   delay: down 15m multiplier 1.5 max 1h
+    info: the ratio of HTTP redirects (301, 303, 307, 308) vs the successful requests, \
+          over the last minute
+      to: webmaster
+
 template: 1m_bad_requests
       on: web_log.response_codes
 families: *
@@ -46,8 +68,8 @@ families: *
     calc: $this * 100 / ( $1m_2xx + $this )
    units: %
    every: 10s
-    warn: $this > (($status >= $WARNING)  ? ( 1 ) : (  5 ))
-    crit: $this > (($status == $CRITICAL) ? ( 5 ) : ( 10 ))
+    warn: ($1m_requests > 30) ? ($this > (($status >= $WARNING)  ? ( 1 ) : (  5 )) ) : ( 0 )
+    crit: ($1m_requests > 30) ? ($this > (($status == $CRITICAL) ? ( 5 ) : ( 10 )) ) : ( 0 )
    delay: down 15m multiplier 1.5 max 1h
     info: the ratio of HTTP bad requests (4xx) vs the successful requests, \
           over the last minute
@@ -60,8 +82,8 @@ families: *
     calc: $this * 100 / ( $1m_2xx + $this )
    units: %
    every: 10s
-    warn: $this > (($status >= $WARNING)  ? ( 1 ) : ( 2 ))
-    crit: $this > (($status == $CRITICAL) ? ( 2 ) : ( 5 ))
+    warn: ($1m_requests > 30) ? ($this > (($status >= $WARNING)  ? ( 1 ) : ( 2 )) ) : ( 0 )
+    crit: ($1m_requests > 30) ? ($this > (($status == $CRITICAL) ? ( 2 ) : ( 5 )) ) : ( 0 )
    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
@@ -78,7 +100,6 @@ families: *
    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: *
@@ -87,8 +108,8 @@ families: *
    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 > 30) ? ($this > $green && $this > ($10m_response_time * 2) ) : ( 0 )
+    crit: ($1m_requests > 30) ? ($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
@@ -118,8 +139,8 @@ families: *
     calc: ($5m_2xx_last > 0)?($5m_2xx_now * 100 / $5m_2xx_last):(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: ($1m_requests > 30) ? (($5m_2xx_last > 30) ? ($this > 200 OR $this < 50) : (0) ) : ( 0 )
+    crit: ($1m_requests > 30) ? (($5m_2xx_last > 30) ? ($this > 400 OR $this < 25) : (0) ) : ( 0 )
    delay: down 15m multiplier 1.5 max 1h
 options: no-clear-notification
     info: the percentage of web requests over the last 5 minutes, \
index 48a97e4e41e610814ece52d9a1411c89baeb2a8f..1b4167d1e893af7b1b4ac696ce0e0e0ac6d253dd 100644 (file)
@@ -11,6 +11,7 @@ declare -A configs_signatures=(
   ['0529b679d3c0e7e6332753c7f6484731']='health.d/net.conf'
   ['057d12aaff0467e64529e839a258806b']='health.d/entropy.conf'
   ['059d98d0c562e1c81653d1e64673deab']='python.d/web_log.conf'
+  ['05a8f39f134850c1e8d6267dbe706273']='health.d/web_log.conf'
   ['061c45b0e34170d357e47883166ecf40']='python.d/nginx.conf'
   ['074df527cc70b5f38c0714f08f20e57c']='health.d/apache.conf'
   ['08042325ab27256b938575deafee8ecf']='python.d/nginx.conf'
@@ -152,6 +153,7 @@ declare -A configs_signatures=(
   ['61b7ed36f35e7bd930f5f7f91694a112']='charts.d/postfix.conf'
   ['621f10b257a11add5ff5aff41e9662e3']='health.d/memcached.conf'
   ['623771eecb3c277fc728b5304793f93b']='health.d/cpu.conf'
+  ['632c28d714c87a4969d11cf36a5edaa8']='health.d/web_log.conf'
   ['636d032928ea0f4741eab264fb49c099']='apps_groups.conf'
   ['6398ef37a15cb6a0bc921f58948d2b39']='health.d/softnet.conf'
   ['64070d856ab1b47a18ec871e49bbc13b']='python.d/squid.conf'
@@ -182,6 +184,7 @@ declare -A configs_signatures=(
   ['707a63f53f4b32e01d134ae90ba94aad']='health_alarm_notify.conf'
   ['707a63f53f4b32e01d134ae90ba94aad']='health_email_recipients.conf'
   ['70d82dabecb09a1da4684f293abef0c9']='health_alarm_notify.conf'
+  ['729b3e24a72f7d566fd429617d51a21b']='health.d/web_log.conf'
   ['73125ae64d5c6e9361944cd9bd14844e']='python.d/exim.conf'
   ['731a1fcfe9b2da1b9d685056a59541b8']='python.d/hddtemp.conf'
   ['73a8e10dfe4183aca751e9e2a80dabe3']='node.d.conf'
@@ -353,6 +356,7 @@ declare -A configs_signatures=(
   ['df7e8044902b5e155fad8430c2ddcfa8']='health.d/fping.conf'
   ['dfd5431b11cf2f3852a40d390c1d5a92']='python.d/varnish.conf'
   ['e0242003fd2e3f9ac1b9314e802ada79']='python.d/hddtemp.conf'
+  ['e0ba3bc216ffc9933b4741dbb6b1f8c8']='health.d/web_log.conf'
   ['e0e96cc47ed61d6492416be5236cd4d3']='python.d/apache_cache.conf'
   ['e2f3388c06726154c10ec22bad5bc7ec']='fping.conf'
   ['e3023092e3b2bbb5351e0fe6682f4fe9']='health_alarm_notify.conf'
index 6cb594f6ae02c62f7b72bbb9e9e4e54abafa80b2..042b575469e9f76d38a1a5a0a8e1e9fc5fbaf482 100644 (file)
@@ -39,9 +39,9 @@ CHARTS = {
     'response_time': {
         'options': [None, 'Processing Time', 'milliseconds', 'timings', 'web_log.response_time', 'area'],
         'lines': [
-            ['resp_time_min', 'min', 'absolute', 1, 1],
-            ['resp_time_max', 'max', 'absolute', 1, 1],
-            ['resp_time_avg', 'avg', 'absolute', 1, 1]
+            ['resp_time_min', 'min', 'absolute', 1, 1000],
+            ['resp_time_max', 'max', 'absolute', 1, 1000],
+            ['resp_time_avg', 'avg', 'absolute', 1, 1000]
         ]},
     'clients': {
         'options': [None, 'Current Poll Unique Client IPs', 'unique ips', 'clients', 'web_log.clients', 'stacked'],
@@ -170,7 +170,7 @@ class Service(LogService):
                                       r' ([\d.]+) ')
 
         regex_function = zip([access_apache_ext, access_nginx_ext, access_default],
-                             [lambda x: x, lambda x: x * 1000, lambda x: x],
+                             [lambda x: x, lambda x: x * 1000000, lambda x: x],
                              ['access_apache_ext', 'access_nginx_ext', 'access_default'])
         regex_name = None
         for regex, function, name in regex_function:
@@ -208,17 +208,12 @@ class Service(LogService):
 
         job_name = find_job_name(self.override_name, self.name)
         self.detailed_chart = 'CHART %s.detailed_response_codes ""' \
-                              ' "Response Codes" requests/s responses' \
+                              ' "Detailed Response Codes" requests/s responses' \
                               ' web_log.detailed_response_codes stacked 1 %s\n' % (job_name, self.update_every)
         self.http_method_chart = 'CHART %s.http_method' \
-                                 ' "" "Requests Per HTTP Method" requests/s requests' \
+                                 ' "" "Requests Per HTTP Method" requests/s "http methods"' \
                                  ' web_log.http_method stacked 2 %s\n' % (job_name, self.update_every)
 
-        if regex_name == 'access_apache_ext':
-            self.definitions['response_time']['lines'][0][4] = 1000
-            self.definitions['response_time']['lines'][1][4] = 1000
-            self.definitions['response_time']['lines'][2][4] = 1000
-
         # Remove 'request_time' chart from ORDER if request_time not in logs
         if regex_name == 'access_default':
             self.order.remove('response_time')
@@ -322,7 +317,7 @@ class Service(LogService):
         # timings
         if request_time:
             to_netdata['resp_time_min'] = request_time[0]
-            to_netdata['resp_time_avg'] = float(request_counter['sum']) / request_counter['count']
+            to_netdata['resp_time_avg'] = round(float(request_counter['sum']) / request_counter['count'])
             to_netdata['resp_time_max'] = request_time[-1]
 
         to_netdata.update(self.storage)
index 03b2a4cedbe4372d2e7035a5e1470e38c0726d6f..7da621ef10eae5b0ee80008faec771d4c4773eea 100644 (file)
@@ -921,6 +921,26 @@ netdataDashboard.context = {
         ]
     },
 
+    'web_log.response_time': {
+        mainheads: [
+            function(os, id) {
+                void(os);
+                return  '<div data-netdata="' + id + '"'
+                    + ' data-dimensions="avg"'
+                    + ' data-chart-library="gauge"'
+                    + ' data-title="Average Response"'
+                    + ' data-units="milliseconds"'
+                    + ' data-gauge-adjust="width"'
+                    + ' data-width="12%"'
+                    + ' data-before="0"'
+                    + ' data-after="-CHART_DURATION"'
+                    + ' data-points="CHART_DURATION"'
+                    + ' data-colors="' + NETDATA.colors[4] + '"'
+                    + ' role="application"></div>';
+            }
+        ]
+    },
+
     'web_log.detailed_response_codes': {
         info: 'Number of responses for each response code.'
     },
index 273502ae2930383d8ad0df4c4303a3c8debb0d59..b21998bdc0e08e8b43c0afe33ea9307a2f3abaf5 100644 (file)
             });
 
             NETDATA.requiredJs.push({
-                url: NETDATA.serverDefault + 'dashboard_info.js?v20170211-18',
+                url: NETDATA.serverDefault + 'dashboard_info.js?v20170211-19',
                 async: false,
                 isAlreadyLoaded: function() { return false; }
             });