Skip to content

Commit 4b7e3dd

Browse files
authored
in_mem_metrics: initial documentation.
This adds documentation for the new `in_mem_metrics` plugin: fluent/fluent-bit#7615. Signed-off-by: Phillip Whelan <[email protected]>
1 parent a6d049c commit 4b7e3dd

File tree

1 file changed

+110
-0
lines changed

1 file changed

+110
-0
lines changed

pipeline/inputs/mem-metrics.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Memory Metrics (mem_metrics)
2+
3+
The **mem_metrics**, or memory metrics plugin, generates metrics for memory statistics for processes using the `smaps_rollup` file for each process in /proc. At the moment this plugin works exclusively on Linux.
4+
5+
# Configuration Parameters
6+
7+
| **Key*** | Description | Default |
8+
| :------------ | :------------------------------------------------- | :----------- |
9+
| proc_path | The path of the proc pseudo filesystem | /proc |
10+
| filter_exec | Filter for a single executable by path | **inactive** |
11+
| filter_cmd | Filter by command line | **inactive** |
12+
| filter_pid | Filter by comma delimited list of PIDs | **inactive** |
13+
| interval_sec | Set the interval seconds between events generation | 5 |
14+
| interval_nsec | Set the nanoseconds interval (sub seconds) | 0 |
15+
16+
The `filter_pid` can include or be set to either `0` or `self` to refer to the fluent-bit process itself.
17+
18+
## Getting Started
19+
20+
You can run the plugin from the command line or through a configuration file. By default metrics will be generated for all processes the current user can analyze.
21+
22+
### Command Line
23+
24+
```bash
25+
$ fluent-bit -i mem_metrics -o stdout
26+
Fluent Bit v2.1.8
27+
* Copyright (C) 2015-2022 The Fluent Bit Authors
28+
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
29+
* https://fluentbit.io
30+
31+
2023-07-26T14:37:49.919778443Z node_smaps_rollup_rss{pid="4540"} = 21064
32+
2023-07-26T14:37:49.919778443Z node_smaps_rollup_pss{pid="4540",type="clean"} = 9598
33+
2023-07-26T14:37:49.919778443Z node_smaps_rollup_pss{pid="4540",type="dirty"} = 5998
34+
2023-07-26T14:37:49.919778443Z node_smaps_rollup_pss{pid="4540",type="anon"} = 5996
35+
2023-07-26T14:37:49.919778443Z node_smaps_rollup_pss{pid="4540",type="file"} = 3602
36+
2023-07-26T14:37:49.919778443Z node_smaps_rollup_pss{pid="4540",type="shmem"} = 0
37+
2023-07-26T14:37:49.919778443Z node_smaps_rollup_shared{pid="4540",type="clean"} = 15008
38+
2023-07-26T14:37:49.919778443Z node_smaps_rollup_shared{pid="4540",type="dirty"} = 4
39+
2023-07-26T14:37:49.919778443Z node_smaps_rollup_private{pid="4540",type="clean"} = 56
40+
2023-07-26T14:37:49.919778443Z node_smaps_rollup_private{pid="4540",type="dirty"} = 5996
41+
2023-07-26T14:37:49.919778443Z node_smaps_rollup_referenced{pid="4540"} = 21064
42+
2023-07-26T14:37:49.919778443Z node_smaps_rollup_anonymous{pid="4540"} = 5996
43+
2023-07-26T14:37:49.919778443Z node_smaps_rollup_lazy_free{pid="4540"} = 0
44+
2023-07-26T14:37:49.919778443Z node_smaps_rollup_anon_huge_pages{pid="4540"} = 0
45+
2023-07-26T14:37:49.919778443Z node_smaps_rollup_shmem_pmd_mapped{pid="4540"} = 0
46+
2023-07-26T14:37:49.919778443Z node_smaps_rollup_file_pmd_mapped{pid="4540"} = 0
47+
2023-07-26T14:37:49.919778443Z node_smaps_rollup_shared_hugetlb{pid="4540"} = 0
48+
2023-07-26T14:37:49.919778443Z node_smaps_rollup_private_hugetlb{pid="4540"} = 0
49+
2023-07-26T14:37:49.919778443Z node_smaps_rollup_swap{pid="4540"} = 0
50+
2023-07-26T14:37:49.919778443Z node_smaps_rollup_swap_pss{pid="4540"} = 0
51+
2023-07-26T14:37:49.919778443Z node_smaps_rollup_locked{pid="4540"} = 0
52+
```
53+
54+
### Configuration File
55+
56+
Minimal pipeline for logging memory metrics to the console:
57+
58+
```ini
59+
[INPUT]
60+
Name mem_metrics
61+
Tag mem
62+
63+
[OUTPUT]
64+
Name stdout
65+
Match mem
66+
```
67+
68+
Log all instances of fluent-bit to prometheus:
69+
70+
```ini
71+
[INPUT]
72+
Name mem_metrics
73+
Filter_cmd fluent-bit
74+
Tag mem
75+
76+
[OUTPUT]
77+
Name prometheus_remote_write
78+
Match mem
79+
Host localhost
80+
Port 9090
81+
Uri /prometheus/v1/write?prometheus_server=mem
82+
```
83+
84+
### Exposed Metrics
85+
86+
All metrics are logged as gauges since they can both increase and decrease. Currenrtly supported gauges are:
87+
* node_smaps_rollup_rss
88+
* node_smaps_rollup_pss
89+
* type=clean
90+
* type=dirty
91+
* type=anon
92+
* type=file
93+
* type=shmem
94+
* node_smaps_rollup_shared
95+
* type=clean
96+
* type=dirty
97+
* node_smaps_rollup_private
98+
* type=dirty
99+
* type=clean
100+
* node_smaps_rollup_referenced
101+
* node_smaps_rollup_anonymous
102+
* node_smaps_rollup_lazy_free
103+
* node_smaps_rollup_anon_huge_pages
104+
* node_smaps_rollup_shmem_pmd_mapped
105+
* node_smaps_rollup_file_pmd_mapped
106+
* node_smaps_rollup_shared_hugetlb
107+
* node_smaps_rollup_private_hugetlb
108+
* node_smaps_rollup_swap
109+
* node_smaps_rollup_swap_pss
110+
* node_smaps_rollup_locked

0 commit comments

Comments
 (0)