Skip to content

Commit b98e343

Browse files
authored
pipeline: inputs: memory-metrics: update doc with metrics table, examples, and pid output (#2281)
Added metrics table, config parameters table, example and more. Fixes #2280. Signed-off-by: Eric D. Schabell <eric@schabell.org>
1 parent dc0465e commit b98e343

File tree

1 file changed

+44
-12
lines changed

1 file changed

+44
-12
lines changed

pipeline/inputs/memory-metrics.md

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,44 @@
11
# Memory metrics
22

3-
The _Memory_ (`mem`) input plugin gathers information about the memory and swap usage of the running system every certain interval of time and reports the total amount of memory and the amount of free available.
3+
The _Memory_ (`mem`) input plugin gathers memory and swap usage on Linux at a fixed interval and reports totals and free space. The plugin emits log-based metrics (for Prometheus-format metrics see the Node Exporter metrics input plugin).
4+
5+
## Metrics reported
6+
7+
| Key | Description | Units |
8+
|:-------------|:-----------------------------------------------------------------------|:------------|
9+
| `Mem.free` | Free or available memory reported by the kernel. | Kilobytes |
10+
| `Mem.total` | Total system memory. | Kilobytes |
11+
| `Mem.used` | Memory in use (`Mem.total` - `Mem.free`). | Kilobytes |
12+
| `Swap.free` | Free swap space. | Kilobytes |
13+
| `Swap.total` | Total system swap. | Kilobytes |
14+
| `Swap.used` | Swap space in use (`Swap.total` - `Swap.free`). | Kilobytes |
15+
| `proc_bytes` | Optional. Resident set size for the configured process (`pid`). | Bytes |
16+
| `proc_hr` | Optional. Human-readable value of `proc_bytes` (for example, `12.00M`). | Formatted |
17+
18+
## Configuration parameters
19+
20+
The plugin supports the following configuration parameters:
21+
22+
| Key | Description | Default |
23+
|:----------------|:--------------------------------------------------------------------------------------------------------|:--------|
24+
| `interval_nsec` | Polling interval in nanoseconds. | `0` |
25+
| `interval_sec` | Polling interval in seconds. | `1` |
26+
| `pid` | Process ID to measure. When set, the plugin also reports `proc_bytes` and `proc_hr`. | _none_ |
27+
| `threaded` | Run this input in its own [thread](../../administration/multithreading.md#inputs). | `false` |
428

529
## Get started
630

7-
To get memory and swap usage from your system, you can run the plugin from the command line or through the configuration file:
31+
To collect memory and swap usage from your system, run the plugin from the command line or through the configuration file.
832

933
### Command line
1034

11-
Run the following command from the command line, noting this is for a Linux machine:
35+
Run the following command from the command line:
1236

1337
```shell
1438
fluent-bit -i mem -t memory -o stdout -m '*'
1539
```
1640

17-
Which outputs information similar to:
41+
The output is similar to:
1842

1943
```text
2044
...
@@ -25,11 +49,6 @@ Which outputs information similar to:
2549
...
2650
```
2751

28-
## Threading
29-
30-
You can enable the `threaded` setting to run this input in its own
31-
[thread](../../administration/multithreading.md#inputs).
32-
3352
### Configuration file
3453

3554
In your main configuration file append the following:
@@ -42,6 +61,8 @@ pipeline:
4261
inputs:
4362
- name: mem
4463
tag: memory
64+
interval_sec: 5
65+
pid: 1234
4566

4667
outputs:
4768
- name: stdout
@@ -53,13 +74,24 @@ pipeline:
5374
5475
```text
5576
[INPUT]
56-
Name mem
57-
Tag memory
77+
Name mem
78+
Tag memory
79+
Interval_Sec 5
80+
Interval_NSec 0
81+
PID 1234
5882

5983
[OUTPUT]
6084
Name stdout
6185
Match *
6286
```
6387

6488
{% endtab %}
65-
{% endtabs %}
89+
{% endtabs %}
90+
91+
Example output when `pid` is set:
92+
93+
```text
94+
...
95+
[0] memory: [[1751381087.225589224, {}], {"Mem.total"=>3986708, "Mem.used"=>560708, "Mem.free"=>3426000, "Swap.total"=>0, "Swap.used"=>0, "Swap.free"=>0, "proc_bytes"=>12349440, "proc_hr"=>"11.78M"}]
96+
...
97+
```

0 commit comments

Comments
 (0)