Skip to content

Commit 70aa806

Browse files
authored
Merge pull request #1712 from fluent/lynettemiles/sc-136168/update-fluent-bit-docs-pipeline-inputs-cpu
2 parents 68be52a + e928dd8 commit 70aa806

File tree

1 file changed

+36
-25
lines changed

1 file changed

+36
-25
lines changed

pipeline/inputs/cpu-metrics.md

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,51 @@
1-
# CPU Metrics
1+
# CPU metrics
22

3-
The **cpu** input plugin, measures the CPU usage of a process or the whole system by default \(considering per CPU core\). It reports values in percentage unit for every interval of time set. At the moment this plugin is only available for Linux.
3+
The _CPU_ input plugin, measures the CPU usage of a process or the whole system by default (considering per CPU core). It reports values in percentage unit for every interval of time set. This plugin is available only for Linux.
44

5-
The following tables describes the information generated by the plugin. The keys below represent the data used by the overall system, all values associated to the keys are in a percentage unit \(0 to 100%\):
5+
The following tables describe the information generated by the plugin. The following keys represent the data used by the overall system, and all values associated to the keys are in a percentage unit (0 to 100%):
66

7-
The CPU metrics plugin creates metrics that are log-based, such as JSON payload. For
8-
Prometheus-based metrics, see the Node Exporter Metrics input plugin.
7+
The CPU metrics plugin creates metrics that are log-based, such as JSON payload. For Prometheus-based metrics, see the _Node Exporter Metrics_ input plugin.
98

10-
| key | description |
9+
| Key | Description |
1110
| :--- | :--- |
12-
| cpu\_p | CPU usage of the overall system, this value is the summation of time spent on user and kernel space. The result takes in consideration the numbers of CPU cores in the system. |
13-
| user\_p | CPU usage in User mode, for short it means the CPU usage by user space programs. The result of this value takes in consideration the numbers of CPU cores in the system. |
14-
| system\_p | CPU usage in Kernel mode, for short it means the CPU usage by the Kernel. The result of this value takes in consideration the numbers of CPU cores in the system. |
15-
| threaded | Indicates whether to run this input in its own [thread](../../administration/multithreading.md#inputs). Default: `false`. |
11+
| `cpu_p` | CPU usage of the overall system, this value is the summation of time spent on user and kernel space. The result takes in consideration the numbers of CPU cores in the system. |
12+
| `user_p` | CPU usage in User mode, for short it means the CPU usage by user space programs. The result of this value takes in consideration the numbers of CPU cores in the system. |
13+
| `system_p` | CPU usage in Kernel mode, for short it means the CPU usage by the Kernel. The result of this value takes in consideration the numbers of CPU cores in the system. |
14+
| `threaded` | Indicates whether to run this input in its own [thread](../../administration/multithreading.md#inputs). Default: `false`. |
1615

17-
In addition to the keys reported in the above table, a similar content is created **per** CPU core. The cores are listed from _0_ to _N_ as the Kernel reports:
16+
In addition to the keys reported in the previous table, a similar content is created per CPU core. The cores are listed from `0` to `N` as the Kernel reports:
1817

19-
| key | description |
18+
| Key | Description |
2019
| :--- | :--- |
21-
| cpu**N**.p\_cpu | Represents the total CPU usage by core **N**. |
22-
| cpu**N**.p\_user | Total CPU spent in user mode or user space programs associated to this core. |
23-
| cpu**N**.p\_system | Total CPU spent in system or kernel mode associated to this core. |
20+
| `cpuN.p_cpu` | Represents the total CPU usage by core `N`. |
21+
| `cpuN.p_user` | Total CPU spent in user mode or user space programs associated to this core. |
22+
| `cpuN.p_system` | Total CPU spent in system or kernel mode associated to this core. |
2423

25-
## Configuration Parameters
24+
## Configuration parameters
2625

2726
The plugin supports the following configuration parameters:
2827

2928
| Key | Description | Default |
3029
| :--- | :--- | :--- |
31-
| Interval\_Sec | Polling interval in seconds | 1 |
32-
| Interval\_NSec | Polling interval in nanoseconds | 0 |
33-
| PID | Specify the ID \(PID\) of a running process in the system. By default the plugin monitors the whole system but if this option is set, it will only monitor the given process ID. | |
30+
| `Interval_Sec` | Polling interval in seconds. | `1` |
31+
| `Interval_NSec | Polling interval in nanoseconds` | `0` |
32+
| `PID` | Specify the `ID` (`PID`) of a running process in the system. By default, the plugin monitors the whole system but if this option is set, it will only monitor the given process ID. | _none_ |
3433

35-
## Getting Started
34+
## Get started
3635

3736
In order to get the statistics of the CPU usage of your system, you can run the plugin from the command line or through the configuration file:
3837

39-
### Command Line
38+
### Command line
39+
40+
You can run this filter from the command line using a command like the following:
4041

4142
```bash
42-
$ build/bin/fluent-bit -i cpu -t my_cpu -o stdout -m '*'
43+
build/bin/fluent-bit -i cpu -t my_cpu -o stdout -m '*'
44+
```
45+
46+
The command returns results similar to the following:
47+
48+
```text
4349
Fluent Bit v1.x.x
4450
* Copyright (C) 2019-2020 The Fluent Bit Authors
4551
* Copyright (C) 2015-2018 Treasure Data
@@ -53,14 +59,15 @@ Fluent Bit v1.x.x
5359
[3] [1452185192, {"cpu_p"=>4.50, "user_p"=>3.50, "system_p"=>1.00, "cpu0.p_cpu"=>6.00, "cpu0.p_user"=>5.00, "cpu0.p_system"=>1.00, "cpu1.p_cpu"=>5.00, "cpu1.p_user"=>3.00, "cpu1.p_system"=>2.00}]
5460
```
5561

56-
As described above, the CPU input plugin gathers the overall usage every one second and flushed the information to the output on the fifth second. On this example we used the **stdout** plugin to demonstrate the output records. In a real use-case you may want to flush this information to some central aggregator such as [Fluentd](http://fluentd.org) or [Elasticsearch](http://elastic.co).
62+
As described previously, the CPU input plugin gathers the overall usage every one second and flushed the information to the output on the fifth second. This example uses the `stdout` plugin to demonstrate the output records. In a real use-case you might want to flush this information to some central aggregator such as [Fluentd](http://fluentd.org) or [Elasticsearch](http://elastic.co).
5763

58-
### Configuration File
64+
### Configuration file
5965

60-
In your main configuration file append the following _Input_ and _Output_ sections:
66+
In your main configuration file append the following `Input` and `Output` sections:
6167

6268
{% tabs %}
6369
{% tab title="fluent-bit.conf" %}
70+
6471
```python
6572
[INPUT]
6673
Name cpu
@@ -70,10 +77,13 @@ In your main configuration file append the following _Input_ and _Output_ sectio
7077
Name stdout
7178
Match *
7279
```
80+
7381
{% endtab %}
7482

7583
{% tab title="fluent-bit.yaml" %}
84+
7685
```yaml
86+
7787
pipeline:
7888
inputs:
7989
- name: cpu
@@ -83,5 +93,6 @@ pipeline:
8393
- name: stdout
8494
match: '*'
8595
```
96+
8697
{% endtab %}
8798
{% endtabs %}

0 commit comments

Comments
 (0)