From 8d79c8f364bfd085c303fa295496ffd0d044ff3e Mon Sep 17 00:00:00 2001 From: Gilad Peleg Date: Tue, 3 Oct 2017 09:51:04 +0300 Subject: [PATCH] Add additional php-fpm pool status kpis for Metricbeat module (#5287) --- CHANGELOG.asciidoc | 1 + metricbeat/docs/fields.asciidoc | 66 +++++++++++++++++++ .../module/php_fpm/pool/_meta/data.json | 22 +++++-- .../module/php_fpm/pool/_meta/fields.yml | 36 ++++++++++ metricbeat/module/php_fpm/pool/data.go | 20 ++++-- 5 files changed, 132 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 20bcd934d791..097e56781f73 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -105,6 +105,7 @@ https://github.com/elastic/beats/compare/v6.0.0-beta2...master[Check the HEAD di - Add system uptime metricset. {issue}[4848[4848] - Add `filesystem.ignore_types` to system module for ignoring filesystem types. {issue}4685[4685] - Add experimental `queue` metricset to RabbitMQ module. {pull}4788[4788] +- Add additional php-fpm pool status kpis for Metricbeat module {pull}5287[5287] *Packetbeat* diff --git a/metricbeat/docs/fields.asciidoc b/metricbeat/docs/fields.asciidoc index 6afabb028f4f..2301923d53bb 100644 --- a/metricbeat/docs/fields.asciidoc +++ b/metricbeat/docs/fields.asciidoc @@ -7042,6 +7042,14 @@ type: keyword The name of the pool. +[float] +=== `php_fpm.pool.process_manager` + +type: keyword + +Static, dynamic or ondemand. + + [float] == connections fields @@ -7065,6 +7073,22 @@ type: long The current number of connections that have been initiated, but not yet accepted. If this value is non-zero it typically means that all the available server processes are currently busy, and there are no processes available to serve the next request. Raising `pm.max_children` (provided the server can handle it) should help keep this number low. This property follows from the fact that PHP-FPM listens via a socket (TCP or file based), and thus inherits some of the characteristics of sockets. +[float] +=== `php_fpm.pool.connections.max_listen_queue` + +type: long + +The maximum number of requests in the queue of pending connections since FPM has started. + + +[float] +=== `php_fpm.pool.connections.listen_queue_len` + +type: long + +The size of the socket queue of pending connections. + + [float] == processes fields @@ -7088,6 +7112,30 @@ type: long The number of servers current processing a page - the minimum is `1` (so even on a fully idle server, the result will be not read `0`). +[float] +=== `php_fpm.pool.processes.total` + +type: long + +The number of idle + active processes. + + +[float] +=== `php_fpm.pool.processes.max_active` + +type: long + +The maximum number of active processes since FPM has started. + + +[float] +=== `php_fpm.pool.processes.max_children_reached` + +type: long + +Number of times, the process limit has been reached, when pm tries to start more children (works only for pm 'dynamic' and 'ondemand'). + + [float] === `php_fpm.pool.slow_requests` @@ -7096,6 +7144,24 @@ type: long The number of times a request execution time has exceeded `request_slowlog_timeout`. +[float] +=== `php_fpm.pool.start_since` + +type: long + +Number of seconds since FPM has started. + + +[float] +=== `php_fpm.pool.start_time` + +type: date + +format: epoch_second + +The date and time FPM has started. + + [[exported-fields-postgresql]] == PostgreSQL fields diff --git a/metricbeat/module/php_fpm/pool/_meta/data.json b/metricbeat/module/php_fpm/pool/_meta/data.json index 8616a772903d..0fe1c239c8de 100644 --- a/metricbeat/module/php_fpm/pool/_meta/data.json +++ b/metricbeat/module/php_fpm/pool/_meta/data.json @@ -1,5 +1,5 @@ { - "@timestamp": "2016-05-23T08:05:34.853Z", + "@timestamp": "2017-09-30T12:03:14.242Z", "beat": { "hostname": "host.example.com", "name": "host.example.com" @@ -13,16 +13,24 @@ "php_fpm": { "pool": { "connections": { - "accepted": 13, + "accepted": 28729, + "listen_queue_len": 128, + "max_listen_queue": 1, "queued": 0 }, - "pool": "www", + "name": "www", + "process_manager": "dynamic", "processes": { - "active": 1, - "idle": 2 + "active": 2, + "idle": 3, + "max_active": 8, + "max_children_reached": 2, + "total": 5 }, - "slow_requests": 0 + "slow_requests": 0, + "start_since": 171707, + "start_time": 1506604034 } }, "type": "metricsets" -} \ No newline at end of file +} diff --git a/metricbeat/module/php_fpm/pool/_meta/fields.yml b/metricbeat/module/php_fpm/pool/_meta/fields.yml index c4e2a096b0b7..a4a43f884a5e 100644 --- a/metricbeat/module/php_fpm/pool/_meta/fields.yml +++ b/metricbeat/module/php_fpm/pool/_meta/fields.yml @@ -8,6 +8,10 @@ type: keyword description: > The name of the pool. + - name: process_manager + type: keyword + description: > + Static, dynamic or ondemand. - name: connections type: group description: > @@ -29,6 +33,15 @@ keep this number low. This property follows from the fact that PHP-FPM listens via a socket (TCP or file based), and thus inherits some of the characteristics of sockets. + - name: max_listen_queue + type: long + description: > + The maximum number of requests in the queue of pending + connections since FPM has started. + - name: listen_queue_len + type: long + description: > + The size of the socket queue of pending connections. - name: processes type: group description: > @@ -46,8 +59,31 @@ description: > The number of servers current processing a page - the minimum is `1` (so even on a fully idle server, the result will be not read `0`). + - name: total + type: long + description: > + The number of idle + active processes. + - name: max_active + type: long + description: > + The maximum number of active processes since FPM has started. + - name: max_children_reached + type: long + description: > + Number of times, the process limit has been reached, + when pm tries to start more children (works only for + pm 'dynamic' and 'ondemand'). - name: slow_requests type: long description: > The number of times a request execution time has exceeded `request_slowlog_timeout`. + - name: start_since + type: long + description: > + Number of seconds since FPM has started. + - name: start_time + type: date + format: epoch_second + description: > + The date and time FPM has started. diff --git a/metricbeat/module/php_fpm/pool/data.go b/metricbeat/module/php_fpm/pool/data.go index 74f66865aa1b..a44eb3112790 100644 --- a/metricbeat/module/php_fpm/pool/data.go +++ b/metricbeat/module/php_fpm/pool/data.go @@ -7,15 +7,23 @@ import ( var ( schema = s.Schema{ - "name": c.Str("pool"), + "name": c.Str("pool"), + "process_manager": c.Str("process manager"), + "slow_requests": c.Int("slow requests"), + "start_time": c.Int("start time"), + "start_since": c.Int("start since"), "connections": s.Object{ - "accepted": c.Int("accepted conn"), - "queued": c.Int("listen queue"), + "accepted": c.Int("accepted conn"), + "listen_queue_len": c.Int("listen queue len"), + "max_listen_queue": c.Int("max listen queue"), + "queued": c.Int("listen queue"), }, "processes": s.Object{ - "idle": c.Int("idle processes"), - "active": c.Int("active processes"), + "active": c.Int("active processes"), + "idle": c.Int("idle processes"), + "max_active": c.Int("max active processes"), + "max_children_reached": c.Int("max children reached"), + "total": c.Int("total processes"), }, - "slow_requests": c.Int("slow requests"), } )