diff --git a/packages/php_fpm/_dev/build/docs/README.md b/packages/php_fpm/_dev/build/docs/README.md index 4fddeaebca7..5d73b7393f1 100644 --- a/packages/php_fpm/_dev/build/docs/README.md +++ b/packages/php_fpm/_dev/build/docs/README.md @@ -8,7 +8,7 @@ PHP-FPM (FastCGI Process Manager) is a web tool used to speed up the performance The PHP-FPM integration collects metrics data. -Metrics give you insight into the statistics of the PHP-FPM. Metrics data streams collected by the PHP-FPM integration include [pool](https://www.php.net/manual/en/fpm.status.php#:~:text=Basic%20information%20%2D%20Always%20displayed%20on%20the%20status%20page) so that the user could monitor and troubleshoot the performance of the PHP-FPM instances. +Metrics give you insight into the statistics of the PHP-FPM. Metrics data streams collected by the PHP-FPM integration include [pool](https://www.php.net/manual/en/fpm.status.php#:~:text=Basic%20information%20%2D%20Always%20displayed%20on%20the%20status%20page) and [process](https://www.php.net/manual/en/fpm.status.php#:~:text=Per%2Dprocess%20information%20%2D%20only%20displayed%20in%20full%20output%20mode) so that the user can monitor and troubleshoot the performance of the PHP-FPM instances. Note: - Users can monitor and see the metrics inside the ingested documents for PHP-FPM in the logs-* index pattern from `Discover`. @@ -40,3 +40,11 @@ This is the `pool` data stream. `pool` data stream collects metrics related to t {{event "pool"}} {{fields "pool"}} + +### Process + +This is the `process` data stream. `process` data stream collects metrics like request duration, content length, process state, etc. + +{{event "process"}} + +{{fields "process"}} diff --git a/packages/php_fpm/changelog.yml b/packages/php_fpm/changelog.yml index d11d4d53f1d..05993ca1ffc 100644 --- a/packages/php_fpm/changelog.yml +++ b/packages/php_fpm/changelog.yml @@ -1,4 +1,9 @@ # newer versions go on top +- version: "0.2.0" + changes: + - description: PHP-FPM integration package with "Process" data stream. + type: enhancement + link: https://github.com/elastic/integrations/pull/4652 - version: "0.1.0" changes: - description: PHP-FPM integration package with "Pool" data stream. diff --git a/packages/php_fpm/data_stream/process/_dev/test/pipeline/test-common-config.yml b/packages/php_fpm/data_stream/process/_dev/test/pipeline/test-common-config.yml new file mode 100644 index 00000000000..4da22641654 --- /dev/null +++ b/packages/php_fpm/data_stream/process/_dev/test/pipeline/test-common-config.yml @@ -0,0 +1,3 @@ +fields: + tags: + - preserve_original_event diff --git a/packages/php_fpm/data_stream/process/_dev/test/pipeline/test-process-metrics.log b/packages/php_fpm/data_stream/process/_dev/test/pipeline/test-process-metrics.log new file mode 100644 index 00000000000..ef8dd571372 --- /dev/null +++ b/packages/php_fpm/data_stream/process/_dev/test/pipeline/test-process-metrics.log @@ -0,0 +1 @@ +{"pool":"www","process manager":"dynamic","start time":1667299161,"start since":515234,"accepted conn":16647,"listen queue":0,"max listen queue":0,"listen queue len":0,"idle processes":1,"active processes":1,"total processes":2,"max active processes":1,"max children reached":0,"slow requests":0, "processes":{"pid":183251,"state":"Running","start time":1667299161,"start since":515234,"requests":8324,"request duration":208,"request method":"GET","request uri":"/status?json&full","content length":0,"user":"-","script":"-","last request cpu":0.00,"last request memory":0}} \ No newline at end of file diff --git a/packages/php_fpm/data_stream/process/_dev/test/pipeline/test-process-metrics.log-expected.json b/packages/php_fpm/data_stream/process/_dev/test/pipeline/test-process-metrics.log-expected.json new file mode 100644 index 00000000000..15d02c4d65d --- /dev/null +++ b/packages/php_fpm/data_stream/process/_dev/test/pipeline/test-process-metrics.log-expected.json @@ -0,0 +1,63 @@ +{ + "expected": [ + { + "ecs": { + "version": "8.4.0" + }, + "event": { + "category": [ + "web", + "configuration", + "process" + ], + "kind": "event", + "module": "php_fpm", + "original": "{\"pool\":\"www\",\"process manager\":\"dynamic\",\"start time\":1667299161,\"start since\":515234,\"accepted conn\":16647,\"listen queue\":0,\"max listen queue\":0,\"listen queue len\":0,\"idle processes\":1,\"active processes\":1,\"total processes\":2,\"max active processes\":1,\"max children reached\":0,\"slow requests\":0, \"processes\":{\"pid\":183251,\"state\":\"Running\",\"start time\":1667299161,\"start since\":515234,\"requests\":8324,\"request duration\":208,\"request method\":\"GET\",\"request uri\":\"/status?json\u0026full\",\"content length\":0,\"user\":\"-\",\"script\":\"-\",\"last request cpu\":0.00,\"last request memory\":0}}", + "type": [ + "info" + ] + }, + "http": { + "request": { + "body": { + "bytes": 0 + }, + "method": "GET" + } + }, + "php_fpm": { + "process": { + "pool": { + "name": "www" + }, + "request": { + "count": 8324, + "duration": 208, + "last": { + "cpu": { + "pct": 0.0 + }, + "memory": 0 + } + }, + "script": "-", + "start_since": 515234, + "start_time": 1667299161, + "state": "Running" + } + }, + "process": { + "pid": 183251 + }, + "tags": [ + "preserve_original_event" + ], + "url": { + "original": "/status?json\u0026full" + }, + "user": { + "name": "-" + } + } + ] +} \ No newline at end of file diff --git a/packages/php_fpm/data_stream/process/_dev/test/system/test-default-config.yml b/packages/php_fpm/data_stream/process/_dev/test/system/test-default-config.yml new file mode 100644 index 00000000000..2abbf6c2629 --- /dev/null +++ b/packages/php_fpm/data_stream/process/_dev/test/system/test-default-config.yml @@ -0,0 +1,5 @@ +vars: + hostname: + - http://{{Hostname}} + status_path: + - /status diff --git a/packages/php_fpm/data_stream/process/agent/stream/httpjson.yml.hbs b/packages/php_fpm/data_stream/process/agent/stream/httpjson.yml.hbs new file mode 100644 index 00000000000..746f207cadd --- /dev/null +++ b/packages/php_fpm/data_stream/process/agent/stream/httpjson.yml.hbs @@ -0,0 +1,24 @@ +config_version: 2 +interval: {{period}} +{{#if ssl}} +request.ssl: {{ssl}} +{{/if}} +request.method: GET +request.url: {{hostname}}{{status_path}}?json&full +response.split: + keep_parent: true + target: body.processes +tags: +{{#if preserve_original_event}} + - preserve_original_event +{{/if}} +{{#each tags as |tag|}} + - {{tag}} +{{/each}} +{{#contains "forwarded" tags}} +publisher_pipeline.disable_host: true +{{/contains}} +{{#if processors}} +processors: +{{processors}} +{{/if}} diff --git a/packages/php_fpm/data_stream/process/elasticsearch/ingest_pipeline/default.yml b/packages/php_fpm/data_stream/process/elasticsearch/ingest_pipeline/default.yml new file mode 100644 index 00000000000..12d8020c576 --- /dev/null +++ b/packages/php_fpm/data_stream/process/elasticsearch/ingest_pipeline/default.yml @@ -0,0 +1,138 @@ +--- +description: Pipeline for parsing PHP-FPM Process metrics. +processors: + - set: + field: ecs.version + value: 8.4.0 + ignore_failure: true + ignore_empty_value: true + - set: + field: event.type + value: ["info"] + ignore_failure: true + ignore_empty_value: true + - set: + field: event.kind + value: event + ignore_failure: true + ignore_empty_value: true + - set: + field: event.category + value: ["web","configuration","process"] + ignore_failure: true + ignore_empty_value: true + - set: + field: event.module + value: php_fpm + ignore_failure: true + ignore_empty_value: true + - rename: + field: message + target_field: event.original + ignore_missing: true + ignore_failure: true + - json: + field: event.original + target_field: json + ignore_failure: true + - rename: + field: json.processes.state + target_field: php_fpm.process.state + ignore_missing: true + ignore_failure: true + - rename: + field: json.processes.requests + target_field: php_fpm.process.request.count + ignore_missing: true + ignore_failure: true + - rename: + field: json.processes.request duration + target_field: php_fpm.process.request.duration + ignore_missing: true + ignore_failure: true + - rename: + field: json.processes.script + target_field: php_fpm.process.script + ignore_missing: true + ignore_failure: true + - rename: + field: json.pool + target_field: php_fpm.process.pool.name + ignore_missing: true + ignore_failure: true + - rename: + field: json.processes.last request cpu + target_field: php_fpm.process.request.last.cpu.pct + ignore_missing: true + ignore_failure: true + - rename: + field: json.processes.last request memory + target_field: php_fpm.process.request.last.memory + ignore_missing: true + ignore_failure: true + - rename: + field: json.processes.pid + target_field: process.pid + ignore_missing: true + ignore_failure: true + - rename: + field: json.processes.request uri + target_field: url.original + ignore_missing: true + ignore_failure: true + - rename: + field: json.processes.user + target_field: user.name + ignore_missing: true + ignore_failure: true + - rename: + field: json.processes.request method + target_field: http.request.method + ignore_missing: true + ignore_failure: true + - rename: + field: json.processes.content length + target_field: http.request.body.bytes + ignore_missing: true + ignore_failure: true + - rename: + field: json.processes.start since + target_field: php_fpm.process.start_since + ignore_missing: true + ignore_failure: true + - rename: + field: json.processes.start time + target_field: php_fpm.process.start_time + ignore_missing: true + ignore_failure: true + - remove: + field: event.original + if: "ctx.tags == null || !(ctx.tags.contains('preserve_original_event'))" + ignore_missing: true + ignore_failure: true + - script: + description: Drops null/empty values recursively. + lang: painless + source: | + boolean drop(Object o) { + if (o == null || o == "" || o == "(null)") { + return true; + } else if (o instanceof Map) { + ((Map) o).values().removeIf(v -> drop(v)); + return (((Map) o).size() == 0); + } else if (o instanceof List) { + ((List) o).removeIf(v -> drop(v)); + return (((List) o).length == 0); + } + return false; + } + drop(ctx); + - remove: + field: + - json + ignore_missing: true + ignore_failure: true +on_failure: + - set: + field: error.message + value: "{{{_ingest.on_failure_message}}}" diff --git a/packages/php_fpm/data_stream/process/fields/base-fields.yml b/packages/php_fpm/data_stream/process/fields/base-fields.yml new file mode 100644 index 00000000000..71df896d68c --- /dev/null +++ b/packages/php_fpm/data_stream/process/fields/base-fields.yml @@ -0,0 +1,15 @@ +- name: data_stream.type + type: constant_keyword + description: Data stream type. +- name: data_stream.dataset + type: constant_keyword + description: Data stream dataset. +- name: data_stream.namespace + type: constant_keyword + description: Data stream namespace. +- name: input.type + type: keyword + description: Type of Filebeat input. +- name: '@timestamp' + type: date + description: Event timestamp. diff --git a/packages/php_fpm/data_stream/process/fields/ecs.yml b/packages/php_fpm/data_stream/process/fields/ecs.yml new file mode 100644 index 00000000000..6f895e400f5 --- /dev/null +++ b/packages/php_fpm/data_stream/process/fields/ecs.yml @@ -0,0 +1,28 @@ +- external: ecs + name: ecs.version +- external: ecs + name: error.message +- external: ecs + name: event.category +- external: ecs + name: event.dataset +- external: ecs + name: event.ingested +- external: ecs + name: event.kind +- external: ecs + name: event.module +- external: ecs + name: event.type +- external: ecs + name: http.request.body.bytes +- external: ecs + name: http.request.method +- external: ecs + name: process.pid +- external: ecs + name: url.original +- external: ecs + name: user.name +- external: ecs + name: tags diff --git a/packages/php_fpm/data_stream/process/fields/fields.yml b/packages/php_fpm/data_stream/process/fields/fields.yml new file mode 100644 index 00000000000..a2e7ba1b157 --- /dev/null +++ b/packages/php_fpm/data_stream/process/fields/fields.yml @@ -0,0 +1,47 @@ +- name: php_fpm + type: group + fields: + - name: process + type: group + fields: + - name: pool.name + type: keyword + description: The name of the FPM process pool. + - name: request + type: group + fields: + - name: count + type: long + description: The total number of requests served. + metric_type: counter + - name: duration + type: long + description: The total time in seconds spent serving requests. + metric_type: counter + unit: s + - name: last + type: group + fields: + - name: cpu.pct + type: long + description: The %cpu of the last request. This will be 0 if the process is not Idle because the calculation is done when the request processing is complete. + metric_type: gauge + unit: percent + - name: memory + type: long + description: The maximum amount of memory consumed by the last request. This will be 0 if the process is not Idle because the calculation is done when the request processing is complete. + metric_type: gauge + - name: script + type: keyword + description: The full path of the script executed by the last request. This will be '-' if not applicable (eg. status page requests). + - name: start_since + type: long + description: The number of seconds since the process started. + metric_type: counter + unit: s + - name: start_time + type: long + description: The date/time at which the process started. + - name: state + type: keyword + description: The state of the process. diff --git a/packages/php_fpm/data_stream/process/manifest.yml b/packages/php_fpm/data_stream/process/manifest.yml new file mode 100644 index 00000000000..da54f39a443 --- /dev/null +++ b/packages/php_fpm/data_stream/process/manifest.yml @@ -0,0 +1,38 @@ +title: Process metrics +type: logs +streams: + - input: httpjson + vars: + - name: period + type: text + required: true + title: Period + default: 10s + description: Period of fetching metrics, i.e. 1s/1m/1h. + - name: tags + type: text + title: Tags + multi: true + required: true + show_user: false + default: + - php_fpm-process + - forwarded + - name: preserve_original_event + required: true + show_user: true + title: Preserve original event + description: Preserves a raw copy of the original event, added to the field `event.original`. + type: bool + multi: false + default: false + - name: processors + type: yaml + title: Processors + multi: false + required: false + show_user: false + description: Processors are used to reduce the number of fields in the exported event or to enhance the event with metadata. This executes in the agent before the logs are parsed. See [Processors](https://www.elastic.co/guide/en/beats/filebeat/current/filtering-and-enhancing-data.html) for details. + template_path: httpjson.yml.hbs + title: PHP-FPM Process metrics + description: Collect PHP-FPM Process metrics. diff --git a/packages/php_fpm/data_stream/process/sample_event.json b/packages/php_fpm/data_stream/process/sample_event.json new file mode 100644 index 00000000000..a40b294b1e7 --- /dev/null +++ b/packages/php_fpm/data_stream/process/sample_event.json @@ -0,0 +1,84 @@ +{ + "@timestamp": "2022-11-15T14:01:31.755Z", + "agent": { + "ephemeral_id": "c505ab2b-ef2e-45aa-8ee4-998433179139", + "id": "eb39489c-ee82-4bd4-b2d3-31f09610ca2e", + "name": "docker-fleet-agent", + "type": "filebeat", + "version": "8.4.1" + }, + "data_stream": { + "dataset": "php_fpm.process", + "namespace": "ep", + "type": "logs" + }, + "ecs": { + "version": "8.4.0" + }, + "elastic_agent": { + "id": "eb39489c-ee82-4bd4-b2d3-31f09610ca2e", + "snapshot": false, + "version": "8.4.1" + }, + "event": { + "agent_id_status": "verified", + "category": [ + "web", + "configuration", + "process" + ], + "created": "2022-11-15T14:01:31.755Z", + "dataset": "php_fpm.process", + "ingested": "2022-11-15T14:01:35Z", + "kind": "event", + "module": "php_fpm", + "type": [ + "info" + ] + }, + "http": { + "request": { + "body": { + "bytes": 0 + }, + "method": "GET" + } + }, + "input": { + "type": "httpjson" + }, + "php_fpm": { + "process": { + "pool": { + "name": "www" + }, + "request": { + "count": 2, + "duration": 186, + "last": { + "cpu": { + "pct": 0 + }, + "memory": 0 + } + }, + "script": "-", + "start_since": 6, + "start_time": 1668520885, + "state": "Running" + } + }, + "process": { + "pid": 33 + }, + "tags": [ + "php_fpm-process", + "forwarded" + ], + "url": { + "original": "/status?json\u0026full" + }, + "user": { + "name": "-" + } +} \ No newline at end of file diff --git a/packages/php_fpm/docs/README.md b/packages/php_fpm/docs/README.md index 2f507ff22a7..3866eee67c7 100644 --- a/packages/php_fpm/docs/README.md +++ b/packages/php_fpm/docs/README.md @@ -8,7 +8,7 @@ PHP-FPM (FastCGI Process Manager) is a web tool used to speed up the performance The PHP-FPM integration collects metrics data. -Metrics give you insight into the statistics of the PHP-FPM. Metrics data streams collected by the PHP-FPM integration include [pool](https://www.php.net/manual/en/fpm.status.php#:~:text=Basic%20information%20%2D%20Always%20displayed%20on%20the%20status%20page) so that the user could monitor and troubleshoot the performance of the PHP-FPM instances. +Metrics give you insight into the statistics of the PHP-FPM. Metrics data streams collected by the PHP-FPM integration include [pool](https://www.php.net/manual/en/fpm.status.php#:~:text=Basic%20information%20%2D%20Always%20displayed%20on%20the%20status%20page) and [process](https://www.php.net/manual/en/fpm.status.php#:~:text=Per%2Dprocess%20information%20%2D%20only%20displayed%20in%20full%20output%20mode) so that the user can monitor and troubleshoot the performance of the PHP-FPM instances. Note: - Users can monitor and see the metrics inside the ingested documents for PHP-FPM in the logs-* index pattern from `Discover`. @@ -153,3 +153,132 @@ An example event for `pool` looks as following: | php_fpm.pool.start_time | The date/time that the process pool was last started. | long | | counter | | tags | List of keywords used to tag each event. | keyword | | | + +### Process + +This is the `process` data stream. `process` data stream collects metrics like request duration, content length, process state, etc. + +An example event for `process` looks as following: + +```json +{ + "@timestamp": "2022-11-15T14:01:31.755Z", + "agent": { + "ephemeral_id": "c505ab2b-ef2e-45aa-8ee4-998433179139", + "id": "eb39489c-ee82-4bd4-b2d3-31f09610ca2e", + "name": "docker-fleet-agent", + "type": "filebeat", + "version": "8.4.1" + }, + "data_stream": { + "dataset": "php_fpm.process", + "namespace": "ep", + "type": "logs" + }, + "ecs": { + "version": "8.4.0" + }, + "elastic_agent": { + "id": "eb39489c-ee82-4bd4-b2d3-31f09610ca2e", + "snapshot": false, + "version": "8.4.1" + }, + "event": { + "agent_id_status": "verified", + "category": [ + "web", + "configuration", + "process" + ], + "created": "2022-11-15T14:01:31.755Z", + "dataset": "php_fpm.process", + "ingested": "2022-11-15T14:01:35Z", + "kind": "event", + "module": "php_fpm", + "type": [ + "info" + ] + }, + "http": { + "request": { + "body": { + "bytes": 0 + }, + "method": "GET" + } + }, + "input": { + "type": "httpjson" + }, + "php_fpm": { + "process": { + "pool": { + "name": "www" + }, + "request": { + "count": 2, + "duration": 186, + "last": { + "cpu": { + "pct": 0 + }, + "memory": 0 + } + }, + "script": "-", + "start_since": 6, + "start_time": 1668520885, + "state": "Running" + } + }, + "process": { + "pid": 33 + }, + "tags": [ + "php_fpm-process", + "forwarded" + ], + "url": { + "original": "/status?json\u0026full" + }, + "user": { + "name": "-" + } +} +``` + +**Exported fields** + +| Field | Description | Type | Unit | Metric Type | +|---|---|---|---|---| +| @timestamp | Event timestamp. | date | | | +| data_stream.dataset | Data stream dataset. | constant_keyword | | | +| data_stream.namespace | Data stream namespace. | constant_keyword | | | +| data_stream.type | Data stream type. | constant_keyword | | | +| ecs.version | ECS version this event conforms to. `ecs.version` is a required field and must exist in all events. When querying across multiple indices -- which may conform to slightly different ECS versions -- this field lets integrations adjust to the schema version of the events. | keyword | | | +| error.message | Error message. | match_only_text | | | +| event.category | This is one of four ECS Categorization Fields, and indicates the second level in the ECS category hierarchy. `event.category` represents the "big buckets" of ECS categories. For example, filtering on `event.category:process` yields all events relating to process activity. This field is closely related to `event.type`, which is used as a subcategory. This field is an array. This will allow proper categorization of some events that fall in multiple categories. | keyword | | | +| event.dataset | Name of the dataset. If an event source publishes more than one type of log or events (e.g. access log, error log), the dataset is used to specify which one the event comes from. It's recommended but not required to start the dataset name with the module name, followed by a dot, then the dataset name. | keyword | | | +| event.ingested | Timestamp when an event arrived in the central data store. This is different from `@timestamp`, which is when the event originally occurred. It's also different from `event.created`, which is meant to capture the first time an agent saw the event. In normal conditions, assuming no tampering, the timestamps should chronologically look like this: `@timestamp` \< `event.created` \< `event.ingested`. | date | | | +| event.kind | This is one of four ECS Categorization Fields, and indicates the highest level in the ECS category hierarchy. `event.kind` gives high-level information about what type of information the event contains, without being specific to the contents of the event. For example, values of this field distinguish alert events from metric events. The value of this field can be used to inform how these kinds of events should be handled. They may warrant different retention, different access control, it may also help understand whether the data coming in at a regular interval or not. | keyword | | | +| event.module | Name of the module this data is coming from. If your monitoring agent supports the concept of modules or plugins to process events of a given source (e.g. Apache logs), `event.module` should contain the name of this module. | keyword | | | +| event.type | This is one of four ECS Categorization Fields, and indicates the third level in the ECS category hierarchy. `event.type` represents a categorization "sub-bucket" that, when used along with the `event.category` field values, enables filtering events down to a level appropriate for single visualization. This field is an array. This will allow proper categorization of some events that fall in multiple event types. | keyword | | | +| http.request.body.bytes | Size in bytes of the request body. | long | | | +| http.request.method | HTTP request method. The value should retain its casing from the original event. For example, `GET`, `get`, and `GeT` are all considered valid values for this field. | keyword | | | +| input.type | Type of Filebeat input. | keyword | | | +| php_fpm.process.pool.name | The name of the FPM process pool. | keyword | | | +| php_fpm.process.request.count | The total number of requests served. | long | | counter | +| php_fpm.process.request.duration | The total time in seconds spent serving requests. | long | s | counter | +| php_fpm.process.request.last.cpu.pct | The %cpu of the last request. This will be 0 if the process is not Idle because the calculation is done when the request processing is complete. | long | percent | gauge | +| php_fpm.process.request.last.memory | The maximum amount of memory consumed by the last request. This will be 0 if the process is not Idle because the calculation is done when the request processing is complete. | long | | gauge | +| php_fpm.process.script | The full path of the script executed by the last request. This will be '-' if not applicable (eg. status page requests). | keyword | | | +| php_fpm.process.start_since | The number of seconds since the process started. | long | s | counter | +| php_fpm.process.start_time | The date/time at which the process started. | long | | | +| php_fpm.process.state | The state of the process. | keyword | | | +| process.pid | Process id. | long | | | +| tags | List of keywords used to tag each event. | keyword | | | +| url.original | Unmodified original url as seen in the event source. Note that in network monitoring, the observed URL may be a full URL, whereas in access logs, the URL is often just represented as a path. This field is meant to represent the URL as it was observed, complete or not. | wildcard | | | +| url.original.text | Multi-field of `url.original`. | match_only_text | | | +| user.name | Short name or login of the user. | keyword | | | +| user.name.text | Multi-field of `user.name`. | match_only_text | | | + diff --git a/packages/php_fpm/img/php_fpm-process-dashboard.png b/packages/php_fpm/img/php_fpm-process-dashboard.png new file mode 100644 index 00000000000..9eca7ef0684 Binary files /dev/null and b/packages/php_fpm/img/php_fpm-process-dashboard.png differ diff --git a/packages/php_fpm/kibana/dashboard/php_fpm-30d6d490-60c6-11ed-a227-676557292b43.json b/packages/php_fpm/kibana/dashboard/php_fpm-30d6d490-60c6-11ed-a227-676557292b43.json new file mode 100644 index 00000000000..cf8222c50db --- /dev/null +++ b/packages/php_fpm/kibana/dashboard/php_fpm-30d6d490-60c6-11ed-a227-676557292b43.json @@ -0,0 +1,803 @@ +{ + "attributes": { + "description": "This PHP-FPM dashboard visualizes Process metrics.", + "hits": 0, + "kibanaSavedObjectMeta": { + "searchSourceJSON": { + "filter": [], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "optionsJSON": { + "hidePanelTitles": false, + "syncColors": false, + "syncTooltips": false, + "useMargins": true + }, + "panelsJSON": [ + { + "embeddableConfig": { + "attributes": { + "references": [ + { + "id": "logs-*", + "name": "indexpattern-datasource-layer-fbe2058d-ab9e-4a5b-9e37-9ef507abbe6b", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "fd13d0f4-4ec2-44ed-b0f0-43cbefac151e", + "type": "index-pattern" + } + ], + "state": { + "datasourceStates": { + "indexpattern": { + "layers": { + "fbe2058d-ab9e-4a5b-9e37-9ef507abbe6b": { + "columnOrder": [ + "0cabd051-9070-4043-8c10-77b2d0d58304", + "453d6177-9684-47f9-adca-085092916add", + "2bba30b0-5402-41ba-891c-5f4761c42d42", + "576c7b06-a296-4e8c-b537-00cbfa6e010c", + "559cd91e-ea35-47a2-a470-96e2a63f119c", + "7a032388-c4bb-41fd-a435-ca80476b364d", + "8fde96f6-0666-4681-bb5f-ee062616676b" + ], + "columns": { + "0cabd051-9070-4043-8c10-77b2d0d58304": { + "customLabel": true, + "dataType": "number", + "isBucketed": true, + "label": "PID", + "operationType": "terms", + "params": { + "missingBucket": false, + "orderBy": { + "columnId": "2bba30b0-5402-41ba-891c-5f4761c42d42", + "type": "column" + }, + "orderDirection": "desc", + "otherBucket": true, + "parentFormat": { + "id": "terms" + }, + "size": 10000 + }, + "scale": "ordinal", + "sourceField": "process.pid" + }, + "2bba30b0-5402-41ba-891c-5f4761c42d42": { + "customLabel": true, + "dataType": "number", + "filter": { + "language": "kuery", + "query": "php_fpm.process.request.count: *" + }, + "isBucketed": false, + "label": "Request count", + "operationType": "last_value", + "params": { + "sortField": "@timestamp" + }, + "scale": "ratio", + "sourceField": "php_fpm.process.request.count" + }, + "453d6177-9684-47f9-adca-085092916add": { + "customLabel": true, + "dataType": "string", + "filter": { + "language": "kuery", + "query": "php_fpm.process.state: *" + }, + "isBucketed": false, + "label": "State", + "operationType": "last_value", + "params": { + "sortField": "@timestamp" + }, + "scale": "ordinal", + "sourceField": "php_fpm.process.state" + }, + "559cd91e-ea35-47a2-a470-96e2a63f119c": { + "customLabel": true, + "dataType": "string", + "filter": { + "language": "kuery", + "query": "user.name: *" + }, + "isBucketed": false, + "label": "User name", + "operationType": "last_value", + "params": { + "sortField": "@timestamp" + }, + "scale": "ordinal", + "sourceField": "user.name" + }, + "576c7b06-a296-4e8c-b537-00cbfa6e010c": { + "customLabel": true, + "dataType": "number", + "filter": { + "language": "kuery", + "query": "php_fpm.process.request.duration: *" + }, + "isBucketed": false, + "label": "Request duration", + "operationType": "last_value", + "params": { + "sortField": "@timestamp" + }, + "scale": "ratio", + "sourceField": "php_fpm.process.request.duration" + }, + "7a032388-c4bb-41fd-a435-ca80476b364d": { + "customLabel": true, + "dataType": "number", + "filter": { + "language": "kuery", + "query": "http.request.body.bytes: *" + }, + "isBucketed": false, + "label": "Content length", + "operationType": "last_value", + "params": { + "format": { + "id": "bytes", + "params": { + "decimals": 2 + } + }, + "sortField": "@timestamp" + }, + "scale": "ratio", + "sourceField": "http.request.body.bytes" + }, + "8fde96f6-0666-4681-bb5f-ee062616676b": { + "customLabel": true, + "dataType": "number", + "filter": { + "language": "kuery", + "query": "php_fpm.process.request.last.memory: *" + }, + "isBucketed": false, + "label": "Request memory", + "operationType": "last_value", + "params": { + "sortField": "@timestamp" + }, + "scale": "ratio", + "sourceField": "php_fpm.process.request.last.memory" + } + }, + "incompleteColumns": {} + } + } + } + }, + "filters": [ + { + "$state": { + "store": "appState" + }, + "meta": { + "alias": null, + "disabled": false, + "index": "fd13d0f4-4ec2-44ed-b0f0-43cbefac151e", + "key": "event.dataset", + "negate": false, + "params": { + "query": "php_fpm.process" + }, + "type": "phrase" + }, + "query": { + "match_phrase": { + "event.dataset": "php_fpm.process" + } + } + } + ], + "query": { + "language": "kuery", + "query": "" + }, + "visualization": { + "columns": [ + { + "alignment": "left", + "columnId": "0cabd051-9070-4043-8c10-77b2d0d58304" + }, + { + "columnId": "453d6177-9684-47f9-adca-085092916add", + "isTransposed": false + }, + { + "alignment": "left", + "columnId": "2bba30b0-5402-41ba-891c-5f4761c42d42", + "isTransposed": false + }, + { + "alignment": "left", + "columnId": "576c7b06-a296-4e8c-b537-00cbfa6e010c", + "isTransposed": false + }, + { + "columnId": "559cd91e-ea35-47a2-a470-96e2a63f119c", + "isTransposed": false + }, + { + "alignment": "left", + "columnId": "7a032388-c4bb-41fd-a435-ca80476b364d", + "isTransposed": false + }, + { + "alignment": "left", + "columnId": "8fde96f6-0666-4681-bb5f-ee062616676b", + "isTransposed": false + } + ], + "headerRowHeight": "auto", + "layerId": "fbe2058d-ab9e-4a5b-9e37-9ef507abbe6b", + "layerType": "data", + "paging": { + "enabled": true, + "size": 10 + }, + "rowHeight": "auto" + } + }, + "title": "", + "type": "lens", + "visualizationType": "lnsDatatable" + }, + "enhancements": {}, + "hidePanelTitles": false + }, + "gridData": { + "h": 14, + "i": "5c4d2a38-4913-43b6-a54a-a56cb1f9bb3d", + "w": 48, + "x": 0, + "y": 0 + }, + "panelIndex": "5c4d2a38-4913-43b6-a54a-a56cb1f9bb3d", + "title": "Statistics of processes [Metrics PHP-FPM]", + "type": "lens", + "version": "8.4.1" + }, + { + "embeddableConfig": { + "attributes": { + "references": [ + { + "id": "logs-*", + "name": "indexpattern-datasource-layer-d9643729-e12e-4e3d-ba08-d48da266bbce", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "9c4df760-98db-4493-865e-0eca0fbf159c", + "type": "index-pattern" + } + ], + "state": { + "datasourceStates": { + "indexpattern": { + "layers": { + "d9643729-e12e-4e3d-ba08-d48da266bbce": { + "columnOrder": [ + "f5cbb076-1a0e-4ea3-8470-7238c004f0da", + "72832731-0703-4df0-9ab5-c452c13cd7d3", + "769422db-6636-4226-a5f6-bdf0308e0a9a" + ], + "columns": { + "72832731-0703-4df0-9ab5-c452c13cd7d3": { + "dataType": "date", + "isBucketed": true, + "label": "@timestamp", + "operationType": "date_histogram", + "params": { + "dropPartials": false, + "includeEmptyRows": true, + "interval": "auto" + }, + "scale": "interval", + "sourceField": "@timestamp" + }, + "769422db-6636-4226-a5f6-bdf0308e0a9a": { + "customLabel": true, + "dataType": "number", + "filter": { + "language": "kuery", + "query": "php_fpm.process.request.last.memory: *" + }, + "isBucketed": false, + "label": "Request memory", + "operationType": "last_value", + "params": { + "sortField": "@timestamp" + }, + "scale": "ratio", + "sourceField": "php_fpm.process.request.last.memory" + }, + "f5cbb076-1a0e-4ea3-8470-7238c004f0da": { + "dataType": "string", + "isBucketed": true, + "label": "Top 10 values of process.pid", + "operationType": "terms", + "params": { + "missingBucket": false, + "orderBy": { + "columnId": "769422db-6636-4226-a5f6-bdf0308e0a9a", + "type": "column" + }, + "orderDirection": "desc", + "otherBucket": true, + "parentFormat": { + "id": "terms" + }, + "size": 10 + }, + "scale": "ordinal", + "sourceField": "process.pid" + } + }, + "incompleteColumns": {} + } + } + } + }, + "filters": [ + { + "$state": { + "store": "appState" + }, + "meta": { + "alias": null, + "disabled": false, + "index": "9c4df760-98db-4493-865e-0eca0fbf159c", + "key": "event.dataset", + "negate": false, + "params": { + "query": "php_fpm.process" + }, + "type": "phrase" + }, + "query": { + "match_phrase": { + "event.dataset": "php_fpm.process" + } + } + } + ], + "query": { + "language": "kuery", + "query": "" + }, + "visualization": { + "axisTitlesVisibilitySettings": { + "x": true, + "yLeft": true, + "yRight": true + }, + "fittingFunction": "None", + "gridlinesVisibilitySettings": { + "x": true, + "yLeft": true, + "yRight": true + }, + "labelsOrientation": { + "x": 0, + "yLeft": 0, + "yRight": 0 + }, + "layers": [ + { + "accessors": [ + "769422db-6636-4226-a5f6-bdf0308e0a9a" + ], + "layerId": "d9643729-e12e-4e3d-ba08-d48da266bbce", + "layerType": "data", + "position": "top", + "seriesType": "line", + "showGridlines": false, + "splitAccessor": "f5cbb076-1a0e-4ea3-8470-7238c004f0da", + "xAccessor": "72832731-0703-4df0-9ab5-c452c13cd7d3" + } + ], + "legend": { + "isVisible": true, + "position": "right" + }, + "preferredSeriesType": "line", + "tickLabelsVisibilitySettings": { + "x": true, + "yLeft": true, + "yRight": true + }, + "valueLabels": "hide" + } + }, + "title": "", + "type": "lens", + "visualizationType": "lnsXY" + }, + "enhancements": {}, + "hidePanelTitles": false + }, + "gridData": { + "h": 15, + "i": "1ed5459a-d03e-4a4b-872d-faff58d014de", + "w": 48, + "x": 0, + "y": 14 + }, + "panelIndex": "1ed5459a-d03e-4a4b-872d-faff58d014de", + "title": "Memory consumed by last request over time [Metrics PHP-FPM]", + "type": "lens", + "version": "8.4.1" + }, + { + "embeddableConfig": { + "attributes": { + "references": [ + { + "id": "logs-*", + "name": "indexpattern-datasource-layer-d9643729-e12e-4e3d-ba08-d48da266bbce", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "1581d698-0c3b-4022-a763-eccbc407edf3", + "type": "index-pattern" + } + ], + "state": { + "datasourceStates": { + "indexpattern": { + "layers": { + "d9643729-e12e-4e3d-ba08-d48da266bbce": { + "columnOrder": [ + "72832731-0703-4df0-9ab5-c452c13cd7d3", + "35717227-37dc-47aa-bf2d-2a5dd76069a0", + "2a9fa2e5-4f93-4b00-920e-adbbffcd7668" + ], + "columns": { + "2a9fa2e5-4f93-4b00-920e-adbbffcd7668": { + "customLabel": true, + "dataType": "number", + "isBucketed": false, + "label": "Maximum", + "operationType": "max", + "params": { + "emptyAsNull": true + }, + "scale": "ratio", + "sourceField": "php_fpm.process.request.count" + }, + "35717227-37dc-47aa-bf2d-2a5dd76069a0": { + "customLabel": true, + "dataType": "number", + "isBucketed": false, + "label": "Minimum", + "operationType": "min", + "params": { + "emptyAsNull": true + }, + "scale": "ratio", + "sourceField": "php_fpm.process.request.count" + }, + "72832731-0703-4df0-9ab5-c452c13cd7d3": { + "dataType": "date", + "isBucketed": true, + "label": "@timestamp", + "operationType": "date_histogram", + "params": { + "dropPartials": false, + "includeEmptyRows": true, + "interval": "auto" + }, + "scale": "interval", + "sourceField": "@timestamp" + } + }, + "incompleteColumns": {} + } + } + } + }, + "filters": [ + { + "$state": { + "store": "appState" + }, + "meta": { + "alias": null, + "disabled": false, + "index": "1581d698-0c3b-4022-a763-eccbc407edf3", + "key": "event.dataset", + "negate": false, + "params": { + "query": "php_fpm.process" + }, + "type": "phrase" + }, + "query": { + "match_phrase": { + "event.dataset": "php_fpm.process" + } + } + } + ], + "query": { + "language": "kuery", + "query": "" + }, + "visualization": { + "axisTitlesVisibilitySettings": { + "x": true, + "yLeft": true, + "yRight": true + }, + "fittingFunction": "None", + "gridlinesVisibilitySettings": { + "x": true, + "yLeft": true, + "yRight": true + }, + "labelsOrientation": { + "x": 0, + "yLeft": 0, + "yRight": 0 + }, + "layers": [ + { + "accessors": [ + "35717227-37dc-47aa-bf2d-2a5dd76069a0", + "2a9fa2e5-4f93-4b00-920e-adbbffcd7668" + ], + "layerId": "d9643729-e12e-4e3d-ba08-d48da266bbce", + "layerType": "data", + "position": "top", + "seriesType": "line", + "showGridlines": false, + "xAccessor": "72832731-0703-4df0-9ab5-c452c13cd7d3" + } + ], + "legend": { + "isVisible": true, + "position": "right" + }, + "preferredSeriesType": "line", + "tickLabelsVisibilitySettings": { + "x": true, + "yLeft": true, + "yRight": true + }, + "valueLabels": "hide", + "yTitle": "Requests" + } + }, + "title": "", + "type": "lens", + "visualizationType": "lnsXY" + }, + "enhancements": {}, + "hidePanelTitles": false + }, + "gridData": { + "h": 15, + "i": "c733e783-e914-4a17-85a8-cda612ef83e6", + "w": 48, + "x": 0, + "y": 29 + }, + "panelIndex": "c733e783-e914-4a17-85a8-cda612ef83e6", + "title": "Total requests over time [Metrics PHP-FPM]", + "type": "lens", + "version": "8.4.1" + }, + { + "embeddableConfig": { + "enhancements": {}, + "hidePanelTitles": false, + "savedVis": { + "data": { + "aggs": [], + "searchSource": { + "filter": [ + { + "$state": { + "store": "appState" + }, + "meta": { + "alias": null, + "disabled": false, + "indexRefName": "kibanaSavedObjectMeta.searchSourceJSON.filter[0].meta.index", + "key": "event.dataset", + "negate": false, + "params": { + "query": "php_fpm.process" + }, + "type": "phrase" + }, + "query": { + "match_phrase": { + "event.dataset": "php_fpm.process" + } + } + } + ], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "description": "", + "id": "", + "params": { + "axis_formatter": "number", + "axis_position": "left", + "axis_scale": "normal", + "bar_color_rules": [ + { + "id": "d8ea6d10-641b-11ed-8aec-4f36d657ecf1" + } + ], + "drop_last_bucket": 0, + "gauge_color_rules": [ + { + "id": "da1669f0-641b-11ed-8aec-4f36d657ecf1" + } + ], + "gauge_inner_width": 10, + "gauge_style": "half", + "gauge_width": 10, + "id": "eb376c28-06c9-4914-9fd5-3eb948bc5d5f", + "index_pattern_ref_name": "metrics_b4772749-232c-49a2-b12e-d9b559e51b33_0_index_pattern", + "interval": "", + "isModelInvalid": false, + "max_lines_legend": 1, + "series": [ + { + "axis_position": "right", + "chart_type": "line", + "color": "#68BC00", + "fill": 0.5, + "formatter": "s,humanize,", + "id": "9dfb9434-2dbe-4546-89b1-96efaa41765c", + "label": "Minimum request duration", + "line_width": 1, + "metrics": [ + { + "field": "php_fpm.process.request.duration", + "id": "c21abcbd-5241-460e-b357-e42a9934f3ca", + "type": "min" + } + ], + "override_index_pattern": 0, + "palette": { + "name": "default", + "type": "palette" + }, + "point_size": 1, + "separate_axis": 0, + "series_drop_last_bucket": 0, + "split_mode": "everything", + "stacked": "none", + "time_range_mode": "entire_time_range" + }, + { + "axis_position": "right", + "chart_type": "line", + "color": "rgba(96,146,192,1)", + "fill": 0.5, + "formatter": "s,humanize,", + "id": "16551510-641c-11ed-8aec-4f36d657ecf1", + "label": "Maximum request duration", + "line_width": 1, + "metrics": [ + { + "field": "php_fpm.process.request.duration", + "id": "16551511-641c-11ed-8aec-4f36d657ecf1", + "type": "max" + } + ], + "override_index_pattern": 0, + "palette": { + "name": "default", + "type": "palette" + }, + "point_size": 1, + "separate_axis": 0, + "series_drop_last_bucket": 0, + "split_mode": "everything", + "stacked": "none", + "time_range_mode": "entire_time_range" + } + ], + "show_grid": 1, + "show_legend": 1, + "time_field": "", + "time_range_mode": "entire_time_range", + "tooltip_mode": "show_all", + "truncate_legend": 1, + "type": "timeseries", + "use_kibana_indexes": true + }, + "title": "", + "type": "metrics", + "uiState": {} + } + }, + "gridData": { + "h": 15, + "i": "b4772749-232c-49a2-b12e-d9b559e51b33", + "w": 48, + "x": 0, + "y": 44 + }, + "panelIndex": "b4772749-232c-49a2-b12e-d9b559e51b33", + "title": "Request duration over time [Metrics PHP-FPM]", + "type": "visualization", + "version": "8.4.1" + } + ], + "timeRestore": false, + "title": "[Metrics PHP-FPM] Process", + "version": 1 + }, + "coreMigrationVersion": "8.4.1", + "id": "php_fpm-30d6d490-60c6-11ed-a227-676557292b43", + "migrationVersion": { + "dashboard": "8.4.0" + }, + "references": [ + { + "id": "logs-*", + "name": "5c4d2a38-4913-43b6-a54a-a56cb1f9bb3d:indexpattern-datasource-layer-fbe2058d-ab9e-4a5b-9e37-9ef507abbe6b", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "5c4d2a38-4913-43b6-a54a-a56cb1f9bb3d:fd13d0f4-4ec2-44ed-b0f0-43cbefac151e", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "1ed5459a-d03e-4a4b-872d-faff58d014de:indexpattern-datasource-layer-d9643729-e12e-4e3d-ba08-d48da266bbce", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "1ed5459a-d03e-4a4b-872d-faff58d014de:9c4df760-98db-4493-865e-0eca0fbf159c", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "c733e783-e914-4a17-85a8-cda612ef83e6:indexpattern-datasource-layer-d9643729-e12e-4e3d-ba08-d48da266bbce", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "c733e783-e914-4a17-85a8-cda612ef83e6:1581d698-0c3b-4022-a763-eccbc407edf3", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "b4772749-232c-49a2-b12e-d9b559e51b33:kibanaSavedObjectMeta.searchSourceJSON.filter[0].meta.index", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "b4772749-232c-49a2-b12e-d9b559e51b33:metrics_b4772749-232c-49a2-b12e-d9b559e51b33_0_index_pattern", + "type": "index-pattern" + } + ], + "type": "dashboard" +} \ No newline at end of file diff --git a/packages/php_fpm/manifest.yml b/packages/php_fpm/manifest.yml index 19aba08cf84..b24abe2aaf5 100644 --- a/packages/php_fpm/manifest.yml +++ b/packages/php_fpm/manifest.yml @@ -1,7 +1,7 @@ format_version: 2.0.0 name: php_fpm title: PHP-FPM -version: 0.1.0 +version: 0.2.0 description: This Elastic integration collects metrics from PHP-FPM. type: integration categories: @@ -19,6 +19,10 @@ screenshots: title: PHP-FPM Pool dashboard size: 600x600 type: image/png + - src: /img/php_fpm-process-dashboard.png + title: PHP-FPM Process dashboard + size: 600x600 + type: image/png policy_templates: - name: PHP-FPM title: PHP-FPM metrics