|
| 1 | +# Process Metrics |
| 2 | + |
| 3 | +_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. |
| 4 | + |
| 5 | +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. |
| 6 | + |
| 7 | +## Configuration Parameters |
| 8 | + |
| 9 | +The plugin supports the following configuration parameters: |
| 10 | + |
| 11 | +| Key | Description | |
| 12 | +| :--- | :--- | |
| 13 | +| Process | Name or PID the target Process to check, defaults to the current instance of fluent-bit. | |
| 14 | + |
| 15 | +## Getting Started |
| 16 | + |
| 17 | +In order to start performing the checks, you can run the plugin from the command line or through the configuration file: |
| 18 | + |
| 19 | +The following example will check the health of _crond_ process. |
| 20 | + |
| 21 | +```bash |
| 22 | +$ fluent-bit -i proc_metrics -p process=crond -o stdout |
| 23 | +``` |
| 24 | + |
| 25 | +### Configuration File |
| 26 | + |
| 27 | +In your main configuration file append the following _Input_ & _Output_ sections: |
| 28 | + |
| 29 | +```python |
| 30 | +[INPUT] |
| 31 | + Name proc_metrics |
| 32 | + Process crond |
| 33 | + |
| 34 | +[OUTPUT] |
| 35 | + Name stdout |
| 36 | + Match * |
| 37 | +``` |
| 38 | + |
| 39 | +## Testing |
| 40 | + |
| 41 | +Once Fluent Bit is running, you can see the metrics for the process: |
| 42 | + |
| 43 | +```bash |
| 44 | +$ fluent-bit -i proc_metrics -o stdout |
| 45 | +Fluent Bit v1.x.x |
| 46 | +* Copyright (C) 2019-2021 The Fluent Bit Authors |
| 47 | +* Copyright (C) 2015-2018 Treasure Data |
| 48 | +* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd |
| 49 | +* https://fluentbit.io |
| 50 | + |
| 51 | +[2021/09/21 11:54:24] [ info] [engine] started (pid=1705018) |
| 52 | +[2021/09/21 11:54:24] [ info] [storage] version=1.1.1, initializing... |
| 53 | +[2021/09/21 11:54:24] [ info] [storage] in-memory |
| 54 | +[2021/09/21 11:54:24] [ info] [storage] normal synchronization mode, checksum disabled, max_chunks_up=128 |
| 55 | +[2021/09/21 11:54:24] [ info] [cmetrics] version=0.2.1 |
| 56 | +[2021/09/21 11:54:24] [ info] [sp] stream processor started |
| 57 | +2021-09-21T14:54:25.224786230Z proc_metrics_io_rchar{pid="1705018",cmdline="fluent-bit"} = 44965 |
| 58 | +2021-09-21T14:54:25.224786230Z proc_metrics_io_wchar{pid="1705018",cmdline="fluent-bit"} = 25367 |
| 59 | +2021-09-21T14:54:25.224786230Z proc_metrics_io_syscr{pid="1705018",cmdline="fluent-bit"} = 41 |
| 60 | +2021-09-21T14:54:25.224786230Z proc_metrics_io_syscw{pid="1705018",cmdline="fluent-bit"} = 18 |
| 61 | +2021-09-21T14:54:25.224786230Z proc_metrics_io_read_bytes{pid="1705018",cmdline="fluent-bit"} = 2818048 |
| 62 | +2021-09-21T14:54:25.224786230Z proc_metrics_io_write_bytes{pid="1705018",cmdline="fluent-bit"} = 0 |
| 63 | +2021-09-21T14:54:25.224786230Z proc_metrics_io_cancelled_write_bytes{pid="1705018",cmdline="fluent-bit"} = 0 |
| 64 | +2021-09-21T14:54:25.224786230Z proc_metrics_mem_size{pid="1705018",cmdline="fluent-bit"} = 13040 |
| 65 | +2021-09-21T14:54:25.224786230Z proc_metrics_mem_resident{pid="1705018",cmdline="fluent-bit"} = 2771 |
| 66 | +2021-09-21T14:54:25.224786230Z proc_metrics_mem_shared{pid="1705018",cmdline="fluent-bit"} = 2285 |
| 67 | +2021-09-21T14:54:25.224786230Z proc_metrics_mem_trs{pid="1705018",cmdline="fluent-bit"} = 1486 |
| 68 | +2021-09-21T14:54:25.224786230Z proc_metrics_mem_lrs{pid="1705018",cmdline="fluent-bit"} = 0 |
| 69 | +2021-09-21T14:54:25.224786230Z proc_metrics_mem_drs{pid="1705018",cmdline="fluent-bit"} = 8231 |
| 70 | +2021-09-21T14:54:25.224786230Z proc_metrics_mem_dt{pid="1705018",cmdline="fluent-bit"} = 0 |
| 71 | +^C[2021/09/21 11:54:31] [engine] caught signal (SIGINT) |
| 72 | +2021-09-21T14:54:30.224519586Z proc_metrics_io_rchar{pid="1705018",cmdline="fluent-bit"} = 45773 |
| 73 | +2021-09-21T14:54:30.224519586Z proc_metrics_io_wchar{pid="1705018",cmdline="fluent-bit"} = 26821 |
| 74 | +2021-09-21T14:54:30.224519586Z proc_metrics_io_syscr{pid="1705018",cmdline="fluent-bit"} = 67 |
| 75 | +2021-09-21T14:54:30.224519586Z proc_metrics_io_syscw{pid="1705018",cmdline="fluent-bit"} = 25 |
| 76 | +2021-09-21T14:54:30.224519586Z proc_metrics_io_read_bytes{pid="1705018",cmdline="fluent-bit"} = 2818048 |
| 77 | +2021-09-21T14:54:30.224519586Z proc_metrics_io_write_bytes{pid="1705018",cmdline="fluent-bit"} = 0 |
| 78 | +2021-09-21T14:54:30.224519586Z proc_metrics_io_cancelled_write_bytes{pid="1705018",cmdline="fluent-bit"} = 0 |
| 79 | +2021-09-21T14:54:30.224519586Z proc_metrics_mem_size{pid="1705018",cmdline="fluent-bit"} = 13040 |
| 80 | +2021-09-21T14:54:30.224519586Z proc_metrics_mem_resident{pid="1705018",cmdline="fluent-bit"} = 2771 |
| 81 | +2021-09-21T14:54:30.224519586Z proc_metrics_mem_shared{pid="1705018",cmdline="fluent-bit"} = 2285 |
| 82 | +2021-09-21T14:54:30.224519586Z proc_metrics_mem_trs{pid="1705018",cmdline="fluent-bit"} = 1486 |
| 83 | +2021-09-21T14:54:30.224519586Z proc_metrics_mem_lrs{pid="1705018",cmdline="fluent-bit"} = 0 |
| 84 | +2021-09-21T14:54:30.224519586Z proc_metrics_mem_drs{pid="1705018",cmdline="fluent-bit"} = 8231 |
| 85 | +2021-09-21T14:54:30.224519586Z proc_metrics_mem_dt{pid="1705018",cmdline="fluent-bit"} = 0 |
| 86 | +[2021/09/21 11:54:31] [ warn] [engine] service will stop in 5 seconds |
| 87 | +[2021/09/21 11:54:32] [error] [input:proc_metrics:proc_metrics.0] could not append metrics |
| 88 | +[2021/09/21 11:54:33] [error] [input:proc_metrics:proc_metrics.0] could not append metrics |
| 89 | +[2021/09/21 11:54:34] [error] [input:proc_metrics:proc_metrics.0] could not append metrics |
| 90 | +[2021/09/21 11:54:35] [error] [input:proc_metrics:proc_metrics.0] could not append metrics |
| 91 | +[2021/09/21 11:54:36] [ info] [engine] service stopped |
| 92 | +``` |
0 commit comments