From b7863fffbe6fbcae98f18531df86732ad022a590 Mon Sep 17 00:00:00 2001 From: Phillip Whelan Date: Tue, 21 Sep 2021 11:56:52 -0300 Subject: [PATCH 1/3] in_proc_metrics: document the new process metrics plugin. Signed-off-by: Phillip Whelan --- pipeline/inputs/process-metrics.md | 92 ++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 pipeline/inputs/process-metrics.md diff --git a/pipeline/inputs/process-metrics.md b/pipeline/inputs/process-metrics.md new file mode 100644 index 000000000..55a1defc9 --- /dev/null +++ b/pipeline/inputs/process-metrics.md @@ -0,0 +1,92 @@ +# Process Metrics + +_Process_ _Metrics_ input plugin allows you to gather metrics from a process. When using a process name, ie: a non-numeric process parameter, the _process_ _metrics_ plugin will track all processes that match. + +The Process metrics plugin creates cmetrics based metrics. If you are looking for log-based metrics \(i.e. JSON payload) you can use the Process plugin instead. + +## Configuration Parameters + +The plugin supports the following configuration parameters: + +| Key | Description | +| :--- | :--- | +| Process | Name or PID the target Process to check, defaults to the current instance of fluent-bit. | + +## Getting Started + +In order to start performing the checks, you can run the plugin from the command line or through the configuration file: + +The following example will check the health of _crond_ process. + +```bash +$ fluent-bit -i proc_metrics -p process=crond -o stdout +``` + +### Configuration File + +In your main configuration file append the following _Input_ & _Output_ sections: + +```python +[INPUT] + Name proc_metrics + Process crond + +[OUTPUT] + Name stdout + Match * +``` + +## Testing + +Once Fluent Bit is running, you can see the metrics for the process: + +```bash +$ fluent-bit -i proc_metrics -o stdout +Fluent Bit v1.x.x +* Copyright (C) 2019-2021 The Fluent Bit Authors +* Copyright (C) 2015-2018 Treasure Data +* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd +* https://fluentbit.io + +[2021/09/21 11:54:24] [ info] [engine] started (pid=1705018) +[2021/09/21 11:54:24] [ info] [storage] version=1.1.1, initializing... +[2021/09/21 11:54:24] [ info] [storage] in-memory +[2021/09/21 11:54:24] [ info] [storage] normal synchronization mode, checksum disabled, max_chunks_up=128 +[2021/09/21 11:54:24] [ info] [cmetrics] version=0.2.1 +[2021/09/21 11:54:24] [ info] [sp] stream processor started +2021-09-21T14:54:25.224786230Z proc_metrics_io_rchar{pid="1705018",cmdline="fluent-bit"} = 44965 +2021-09-21T14:54:25.224786230Z proc_metrics_io_wchar{pid="1705018",cmdline="fluent-bit"} = 25367 +2021-09-21T14:54:25.224786230Z proc_metrics_io_syscr{pid="1705018",cmdline="fluent-bit"} = 41 +2021-09-21T14:54:25.224786230Z proc_metrics_io_syscw{pid="1705018",cmdline="fluent-bit"} = 18 +2021-09-21T14:54:25.224786230Z proc_metrics_io_read_bytes{pid="1705018",cmdline="fluent-bit"} = 2818048 +2021-09-21T14:54:25.224786230Z proc_metrics_io_write_bytes{pid="1705018",cmdline="fluent-bit"} = 0 +2021-09-21T14:54:25.224786230Z proc_metrics_io_cancelled_write_bytes{pid="1705018",cmdline="fluent-bit"} = 0 +2021-09-21T14:54:25.224786230Z proc_metrics_mem_size{pid="1705018",cmdline="fluent-bit"} = 13040 +2021-09-21T14:54:25.224786230Z proc_metrics_mem_resident{pid="1705018",cmdline="fluent-bit"} = 2771 +2021-09-21T14:54:25.224786230Z proc_metrics_mem_shared{pid="1705018",cmdline="fluent-bit"} = 2285 +2021-09-21T14:54:25.224786230Z proc_metrics_mem_trs{pid="1705018",cmdline="fluent-bit"} = 1486 +2021-09-21T14:54:25.224786230Z proc_metrics_mem_lrs{pid="1705018",cmdline="fluent-bit"} = 0 +2021-09-21T14:54:25.224786230Z proc_metrics_mem_drs{pid="1705018",cmdline="fluent-bit"} = 8231 +2021-09-21T14:54:25.224786230Z proc_metrics_mem_dt{pid="1705018",cmdline="fluent-bit"} = 0 +^C[2021/09/21 11:54:31] [engine] caught signal (SIGINT) +2021-09-21T14:54:30.224519586Z proc_metrics_io_rchar{pid="1705018",cmdline="fluent-bit"} = 45773 +2021-09-21T14:54:30.224519586Z proc_metrics_io_wchar{pid="1705018",cmdline="fluent-bit"} = 26821 +2021-09-21T14:54:30.224519586Z proc_metrics_io_syscr{pid="1705018",cmdline="fluent-bit"} = 67 +2021-09-21T14:54:30.224519586Z proc_metrics_io_syscw{pid="1705018",cmdline="fluent-bit"} = 25 +2021-09-21T14:54:30.224519586Z proc_metrics_io_read_bytes{pid="1705018",cmdline="fluent-bit"} = 2818048 +2021-09-21T14:54:30.224519586Z proc_metrics_io_write_bytes{pid="1705018",cmdline="fluent-bit"} = 0 +2021-09-21T14:54:30.224519586Z proc_metrics_io_cancelled_write_bytes{pid="1705018",cmdline="fluent-bit"} = 0 +2021-09-21T14:54:30.224519586Z proc_metrics_mem_size{pid="1705018",cmdline="fluent-bit"} = 13040 +2021-09-21T14:54:30.224519586Z proc_metrics_mem_resident{pid="1705018",cmdline="fluent-bit"} = 2771 +2021-09-21T14:54:30.224519586Z proc_metrics_mem_shared{pid="1705018",cmdline="fluent-bit"} = 2285 +2021-09-21T14:54:30.224519586Z proc_metrics_mem_trs{pid="1705018",cmdline="fluent-bit"} = 1486 +2021-09-21T14:54:30.224519586Z proc_metrics_mem_lrs{pid="1705018",cmdline="fluent-bit"} = 0 +2021-09-21T14:54:30.224519586Z proc_metrics_mem_drs{pid="1705018",cmdline="fluent-bit"} = 8231 +2021-09-21T14:54:30.224519586Z proc_metrics_mem_dt{pid="1705018",cmdline="fluent-bit"} = 0 +[2021/09/21 11:54:31] [ warn] [engine] service will stop in 5 seconds +[2021/09/21 11:54:32] [error] [input:proc_metrics:proc_metrics.0] could not append metrics +[2021/09/21 11:54:33] [error] [input:proc_metrics:proc_metrics.0] could not append metrics +[2021/09/21 11:54:34] [error] [input:proc_metrics:proc_metrics.0] could not append metrics +[2021/09/21 11:54:35] [error] [input:proc_metrics:proc_metrics.0] could not append metrics +[2021/09/21 11:54:36] [ info] [engine] service stopped +``` From 461825609ed923b5b3a56776b6d2d1d9b8247839 Mon Sep 17 00:00:00 2001 From: esmerel <6818907+esmerel@users.noreply.github.com> Date: Wed, 23 Oct 2024 11:03:24 -0700 Subject: [PATCH 2/3] Apply suggestions from code review Signed-off-by: esmerel <6818907+esmerel@users.noreply.github.com> --- pipeline/inputs/process-metrics.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pipeline/inputs/process-metrics.md b/pipeline/inputs/process-metrics.md index 55a1defc9..1833ac8ca 100644 --- a/pipeline/inputs/process-metrics.md +++ b/pipeline/inputs/process-metrics.md @@ -1,10 +1,10 @@ # Process Metrics -_Process_ _Metrics_ input plugin allows you to gather metrics from a process. When using a process name, ie: a non-numeric process parameter, the _process_ _metrics_ plugin will track all processes that match. +The Process Metrics input plugin lets you gather metrics from a process. When using a process name like a non-numeric process parameter, the process metrics plugin tracks all processes that match. -The Process metrics plugin creates cmetrics based metrics. If you are looking for log-based metrics \(i.e. JSON payload) you can use the Process plugin instead. +The Process metrics plugin creates `cmetrics` based metrics. For log-based metrics like JSON payload, use the [Process Log Based Metrics](pipeline/inputs/process.md) plugin instead. -## Configuration Parameters +## Configuration parameters The plugin supports the following configuration parameters: @@ -16,7 +16,7 @@ The plugin supports the following configuration parameters: In order to start performing the checks, you can run the plugin from the command line or through the configuration file: -The following example will check the health of _crond_ process. +The following example will check the health of `crond` process. ```bash $ fluent-bit -i proc_metrics -p process=crond -o stdout @@ -24,7 +24,7 @@ $ fluent-bit -i proc_metrics -p process=crond -o stdout ### Configuration File -In your main configuration file append the following _Input_ & _Output_ sections: +In your main configuration file append the following `Input` and `Output` sections: ```python [INPUT] From b0e86225b21d54eb5573672200ae6a9cf4f72b39 Mon Sep 17 00:00:00 2001 From: esmerel <6818907+esmerel@users.noreply.github.com> Date: Wed, 23 Oct 2024 11:03:37 -0700 Subject: [PATCH 3/3] Apply suggestions from code review Signed-off-by: esmerel <6818907+esmerel@users.noreply.github.com> --- pipeline/inputs/process-metrics.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pipeline/inputs/process-metrics.md b/pipeline/inputs/process-metrics.md index 1833ac8ca..7ceae6c55 100644 --- a/pipeline/inputs/process-metrics.md +++ b/pipeline/inputs/process-metrics.md @@ -8,9 +8,9 @@ The Process metrics plugin creates `cmetrics` based metrics. For log-based metri The plugin supports the following configuration parameters: -| Key | Description | -| :--- | :--- | -| Process | Name or PID the target Process to check, defaults to the current instance of fluent-bit. | +| Key | Description | +| :--------- | :----------- | +| `Process` | Name or PID of the target Process to check, defaults to the current instance of fluent-bit. | ## Getting Started