send memory using fluent-bit

This commit is contained in:
Pim Kunis 2023-08-07 22:42:20 +02:00
parent d8342c3067
commit 62a47c1149
3 changed files with 32 additions and 8 deletions

View file

@ -83,17 +83,29 @@
# storage.backlog.mem_limit 5M
[INPUT]
name cpu
tag cpu
Name cpu
Tag cpu
# Read interval (sec) Default: 1
interval_sec 1
Interval_sec 1
[INPUT]
Name exec
Tag memory
Command free -m | tail -2 | tr '\n' ' '
Interval_Sec 1
[OUTPUT]
name forward
match *
host maestro.dmz
port {{ fluent_forward_port }}
Name forward
Match *
Host maestro.dmz
Port {{ fluent_forward_port }}
[FILTER]
Name parser
Match memory
Key_Name exec
Parser free
[FILTER]
Name record_modifier
@ -102,6 +114,6 @@
[FILTER]
Name record_modifier
Match *
Match cpu
Allowlist_key hostname
Allowlist_key cpu_p

View file

@ -0,0 +1,6 @@
# vi: ft=conf
[PARSER]
Name free
Format regex
Regex ^Mem:\s+(?<mem_total>\d+)\s+(?<mem_used>\d+)\s+(?<mem_free>\d+)\s+(?<mem_shared>\d+)\s+(?<mem_buff_cache>\d+)\s+(?<mem_available>\d+) Swap:\s+(?<swap_total>\d+)\s+(?<swap_used>\d+)\s+(?<swap_free>\d+)
Types mem_total:integer mem_used:integer mem_free:integer mem_shared:integer mem_buff_cache:integer mem_available:integer swap_total:integer swap_used:integer

View file

@ -18,3 +18,9 @@
src: "{{ role_path }}/fluent-bit.conf.j2"
dest: /etc/fluent-bit/fluent-bit.conf
notify: restart fluent-bit
- name: Copy fluent-bit parsers configuration
template:
src: "{{ role_path }}/parsers.conf.j2"
dest: /etc/fluent-bit/parsers.conf
notify: restart fluent-bit