From ed26ba2e1585d98d470c87b998290637f4d99fb2 Mon Sep 17 00:00:00 2001 From: KS Chan Date: Mon, 2 May 2016 16:09:01 +0800 Subject: [PATCH 1/2] Add fields for Nginx and Nginx stub metricset --- metricbeat/docs/fields.asciidoc | 84 +++++++++++++++++++ metricbeat/etc/fields.yml | 51 +++++++++++ metricbeat/etc/fields_base.yml | 1 + metricbeat/metricbeat.template-es2x.json | 36 ++++++++ metricbeat/metricbeat.template.json | 35 ++++++++ metricbeat/metricbeat.yml | 2 + metricbeat/module/nginx/fields.yml | 5 ++ metricbeat/module/nginx/stubstatus/fields.yml | 45 ++++++++++ .../module/nginx/stubstatus/stubstatus.go | 2 +- 9 files changed, 260 insertions(+), 1 deletion(-) create mode 100644 metricbeat/module/nginx/fields.yml create mode 100644 metricbeat/module/nginx/stubstatus/fields.yml diff --git a/metricbeat/docs/fields.asciidoc b/metricbeat/docs/fields.asciidoc index eeb51971bb8..53a1fe977ea 100644 --- a/metricbeat/docs/fields.asciidoc +++ b/metricbeat/docs/fields.asciidoc @@ -13,6 +13,7 @@ grouped in the following categories: * <> * <> * <> +* <> * <> [[exported-fields-common]] @@ -518,6 +519,89 @@ type: long The number of bytes sent to all clients. +[[exported-fields-nginx]] +=== Nginx Status Fields + +Nginx server status metrics collected from various modules. + + + +=== nginx-stubstatus Fields + +`nginx-stubstatus` contains the metrics that were scraped from the ngx_http_stub_status_module status page. + + + +==== nginx-stubstatus.hostname + +type: keyword + +Nginx hostname + + +==== nginx-stubstatus.active + +type: integer + +The current number of active client connections including Waiting connections. + + +==== nginx-stubstatus.accepts + +type: integer + +The total number of accepted client connections. + + +==== nginx-stubstatus.handled + +type: integer + +The total number of handled client connections. + + +==== nginx-stubstatus.dropped + +type: integer + +The total number of dropped client connections. + + +==== nginx-stubstatus.requests + +type: integer + +The total number of client requests. + + +==== nginx-stubstatus.current + +type: integer + +The current number of client requests. + + +==== nginx-stubstatus.reading + +type: integer + +The current number of connections where nginx is reading the request header. + + +==== nginx-stubstatus.writing + +type: integer + +The current number of connections where nginx is writing the response back to the client. + + +==== nginx-stubstatus.waiting + +type: integer + +The current number of idle client connections waiting for a request. + + [[exported-fields-system]] === System Status Fields diff --git a/metricbeat/etc/fields.yml b/metricbeat/etc/fields.yml index 0ae0b2cdfcb..905327d1b01 100644 --- a/metricbeat/etc/fields.yml +++ b/metricbeat/etc/fields.yml @@ -10,6 +10,7 @@ sections: - ["apache", "Apache Status"] - ["redis", "Redis Info"] - ["mysql", "MySQL Status"] + - ["nginx", "Nginx Status"] - ["system", "System Status"] common: @@ -284,6 +285,56 @@ mysql: type: long description: > The number of bytes sent to all clients. +nginx: + type: group + description: > + Nginx server status metrics collected from various modules. + fields: + - name: nginx-stubstatus + type: group + description: > + `nginx-stubstatus` contains the metrics that were scraped from the ngx_http_stub_status_module status page. + fields: + - name: hostname + type: keyword + description: > + Nginx hostname + - name: active + type: integer + description: > + The current number of active client connections including Waiting connections. + - name: accepts + type: integer + description: > + The total number of accepted client connections. + - name: handled + type: integer + description: > + The total number of handled client connections. + - name: dropped + type: integer + description: > + The total number of dropped client connections. + - name: requests + type: integer + description: > + The total number of client requests. + - name: current + type: integer + description: > + The current number of client requests. + - name: reading + type: integer + description: > + The current number of connections where nginx is reading the request header. + - name: writing + type: integer + description: > + The current number of connections where nginx is writing the response back to the client. + - name: waiting + type: integer + description: > + The current number of idle client connections waiting for a request. redis: type: group description: > diff --git a/metricbeat/etc/fields_base.yml b/metricbeat/etc/fields_base.yml index 95adfdb6c80..a34817623d9 100644 --- a/metricbeat/etc/fields_base.yml +++ b/metricbeat/etc/fields_base.yml @@ -10,6 +10,7 @@ sections: - ["apache", "Apache Status"] - ["redis", "Redis Info"] - ["mysql", "MySQL Status"] + - ["nginx", "Nginx Status"] - ["system", "System Status"] common: diff --git a/metricbeat/metricbeat.template-es2x.json b/metricbeat/metricbeat.template-es2x.json index 7a14060da9d..dbfffd30252 100644 --- a/metricbeat/metricbeat.template-es2x.json +++ b/metricbeat/metricbeat.template-es2x.json @@ -204,6 +204,42 @@ } } }, + "nginx-stubstatus": { + "properties": { + "accepts": { + "type": "integer" + }, + "active": { + "type": "integer" + }, + "current": { + "type": "integer" + }, + "dropped": { + "type": "integer" + }, + "handled": { + "type": "integer" + }, + "hostname": { + "ignore_above": 1024, + "index": "not_analyzed", + "type": "string" + }, + "reading": { + "type": "integer" + }, + "requests": { + "type": "integer" + }, + "waiting": { + "type": "integer" + }, + "writing": { + "type": "integer" + } + } + }, "redis-info": { "properties": { "clients": { diff --git a/metricbeat/metricbeat.template.json b/metricbeat/metricbeat.template.json index 5a20a96c598..9e685008281 100644 --- a/metricbeat/metricbeat.template.json +++ b/metricbeat/metricbeat.template.json @@ -195,6 +195,41 @@ } } }, + "nginx-stubstatus": { + "properties": { + "accepts": { + "type": "integer" + }, + "active": { + "type": "integer" + }, + "current": { + "type": "integer" + }, + "dropped": { + "type": "integer" + }, + "handled": { + "type": "integer" + }, + "hostname": { + "ignore_above": 1024, + "type": "keyword" + }, + "reading": { + "type": "integer" + }, + "requests": { + "type": "integer" + }, + "waiting": { + "type": "integer" + }, + "writing": { + "type": "integer" + } + } + }, "redis-info": { "properties": { "clients": { diff --git a/metricbeat/metricbeat.yml b/metricbeat/metricbeat.yml index fdfefb80e47..d007d005143 100644 --- a/metricbeat/metricbeat.yml +++ b/metricbeat/metricbeat.yml @@ -358,3 +358,5 @@ logging: # Sets log level. The default log level is error. # Available log levels are: critical, error, warning, info, debug #level: error + + diff --git a/metricbeat/module/nginx/fields.yml b/metricbeat/module/nginx/fields.yml new file mode 100644 index 00000000000..c9226fd4e2f --- /dev/null +++ b/metricbeat/module/nginx/fields.yml @@ -0,0 +1,5 @@ +nginx: + type: group + description: > + Nginx server status metrics collected from various modules. + fields: diff --git a/metricbeat/module/nginx/stubstatus/fields.yml b/metricbeat/module/nginx/stubstatus/fields.yml new file mode 100644 index 00000000000..46baf60fafb --- /dev/null +++ b/metricbeat/module/nginx/stubstatus/fields.yml @@ -0,0 +1,45 @@ +- name: nginx-stubstatus + type: group + description: > + `nginx-stubstatus` contains the metrics that were scraped from the ngx_http_stub_status_module status page. + fields: + - name: hostname + type: keyword + description: > + Nginx hostname + - name: active + type: integer + description: > + The current number of active client connections including Waiting connections. + - name: accepts + type: integer + description: > + The total number of accepted client connections. + - name: handled + type: integer + description: > + The total number of handled client connections. + - name: dropped + type: integer + description: > + The total number of dropped client connections. + - name: requests + type: integer + description: > + The total number of client requests. + - name: current + type: integer + description: > + The current number of client requests. + - name: reading + type: integer + description: > + The current number of connections where nginx is reading the request header. + - name: writing + type: integer + description: > + The current number of connections where nginx is writing the response back to the client. + - name: waiting + type: integer + description: > + The current number of idle client connections waiting for a request. diff --git a/metricbeat/module/nginx/stubstatus/stubstatus.go b/metricbeat/module/nginx/stubstatus/stubstatus.go index 9607379f7ff..da8f8656d62 100755 --- a/metricbeat/module/nginx/stubstatus/stubstatus.go +++ b/metricbeat/module/nginx/stubstatus/stubstatus.go @@ -1,4 +1,4 @@ -// Reads server status from nginx host under /server-status, stub_status module is required. +// Reads server status from nginx host under /server-status, ngx_http_stub_status_module is required. package stubstatus import ( From 5d437f561cb7761c6dc4731d3fb6945eb785e136 Mon Sep 17 00:00:00 2001 From: KS Chan Date: Sat, 14 May 2016 17:21:45 +0800 Subject: [PATCH 2/2] Fix docker image build path --- metricbeat/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metricbeat/docker-compose.yml b/metricbeat/docker-compose.yml index 9a0a793c068..57e55e8c17a 100644 --- a/metricbeat/docker-compose.yml +++ b/metricbeat/docker-compose.yml @@ -32,7 +32,7 @@ mysql: - MYSQL_ROOT_PASSWORD=test nginx: - build: tests/environments/nginx + build: ${PWD}/tests/environments/nginx redis: image: redis:3.0.7