You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
4
4
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%):
6
6
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.
9
8
10
-
|key|description|
9
+
|Key|Description|
11
10
| :--- | :--- |
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`. |
16
15
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:
18
17
19
-
|key|description|
18
+
|Key|Description|
20
19
| :--- | :--- |
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. |
24
23
25
-
## Configuration Parameters
24
+
## Configuration parameters
26
25
27
26
The plugin supports the following configuration parameters:
28
27
29
28
| Key | Description | Default |
30
29
| :--- | :--- | :--- |
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_|
34
33
35
-
## Getting Started
34
+
## Get started
36
35
37
36
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:
38
37
39
-
### Command Line
38
+
### Command line
39
+
40
+
You can run this filter from the command line using a command like the following:
40
41
41
42
```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:
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).
57
63
58
-
### Configuration File
64
+
### Configuration file
59
65
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:
61
67
62
68
{% tabs %}
63
69
{% tab title="fluent-bit.conf" %}
70
+
64
71
```python
65
72
[INPUT]
66
73
Name cpu
@@ -70,10 +77,13 @@ In your main configuration file append the following _Input_ and _Output_ sectio
0 commit comments