From: Costa Tsaousis Date: Sat, 11 Feb 2017 15:17:25 +0000 (+0200) Subject: Merge pull request #1758 from ktsaou/master X-Git-Tag: ab-debian_0.20170213.01-0ab1~1^2~14 X-Git-Url: https://arthur.barton.de/gitweb/?a=commitdiff_plain;h=4178d2dcd6142976a16dc04016d854097370305b;hp=44fb3850f676ab6ff5ab3b491da9d40b64b8f960;p=netdata.git Merge pull request #1758 from ktsaou/master web_log fixes No 2 --- diff --git a/conf.d/health.d/web_log.conf b/conf.d/health.d/web_log.conf index 4300fe75..b6d2d537 100644 --- a/conf.d/health.d/web_log.conf +++ b/conf.d/health.d/web_log.conf @@ -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, \ diff --git a/configs.signatures b/configs.signatures index 48a97e4e..1b4167d1 100644 --- a/configs.signatures +++ b/configs.signatures @@ -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' diff --git a/python.d/web_log.chart.py b/python.d/web_log.chart.py index 6cb594f6..042b5754 100644 --- a/python.d/web_log.chart.py +++ b/python.d/web_log.chart.py @@ -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) diff --git a/web/dashboard_info.js b/web/dashboard_info.js index 03b2a4ce..7da621ef 100644 --- a/web/dashboard_info.js +++ b/web/dashboard_info.js @@ -921,6 +921,26 @@ netdataDashboard.context = { ] }, + 'web_log.response_time': { + mainheads: [ + function(os, id) { + void(os); + return '
'; + } + ] + }, + 'web_log.detailed_response_codes': { info: 'Number of responses for each response code.' }, diff --git a/web/index.html b/web/index.html index 273502ae..b21998bd 100644 --- a/web/index.html +++ b/web/index.html @@ -2800,7 +2800,7 @@ }); 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; } });