Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fields for Nginx and Nginx stub metricset #2

Merged
merged 2 commits into from
May 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion metricbeat/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
84 changes: 84 additions & 0 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ grouped in the following categories:
* <<exported-fields-apache>>
* <<exported-fields-redis>>
* <<exported-fields-mysql>>
* <<exported-fields-nginx>>
* <<exported-fields-system>>

[[exported-fields-common]]
Expand Down Expand Up @@ -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

Expand Down
51 changes: 51 additions & 0 deletions metricbeat/etc/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ sections:
- ["apache", "Apache Status"]
- ["redis", "Redis Info"]
- ["mysql", "MySQL Status"]
- ["nginx", "Nginx Status"]
- ["system", "System Status"]

common:
Expand Down Expand Up @@ -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: >
Expand Down
1 change: 1 addition & 0 deletions metricbeat/etc/fields_base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ sections:
- ["apache", "Apache Status"]
- ["redis", "Redis Info"]
- ["mysql", "MySQL Status"]
- ["nginx", "Nginx Status"]
- ["system", "System Status"]

common:
Expand Down
36 changes: 36 additions & 0 deletions metricbeat/metricbeat.template-es2x.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
35 changes: 35 additions & 0 deletions metricbeat/metricbeat.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 2 additions & 0 deletions metricbeat/metricbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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


5 changes: 5 additions & 0 deletions metricbeat/module/nginx/fields.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
nginx:
type: group
description: >
Nginx server status metrics collected from various modules.
fields:
45 changes: 45 additions & 0 deletions metricbeat/module/nginx/stubstatus/fields.yml
Original file line number Diff line number Diff line change
@@ -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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could make sense to switch this to "long" as "integer" could overflow here.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean we better not to use Atoi()?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, was not thinking of the implementation itself. The question here is what nginx will report as a max value and if it will exceed int or not. We hit some issues here recently in topbeat and filebeat where we use integer and switched to long as the values got too big.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think i would keep integer here until we no longer user Atoi() :)

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.
2 changes: 1 addition & 1 deletion metricbeat/module/nginx/stubstatus/stubstatus.go
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down