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 # storage.backlog.mem_limit 5M
[INPUT] [INPUT]
name cpu Name cpu
tag cpu Tag cpu
# Read interval (sec) Default: 1 # 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] [OUTPUT]
name forward Name forward
match * Match *
host maestro.dmz Host maestro.dmz
port {{ fluent_forward_port }} Port {{ fluent_forward_port }}
[FILTER]
Name parser
Match memory
Key_Name exec
Parser free
[FILTER] [FILTER]
Name record_modifier Name record_modifier
@ -102,6 +114,6 @@
[FILTER] [FILTER]
Name record_modifier Name record_modifier
Match * Match cpu
Allowlist_key hostname Allowlist_key hostname
Allowlist_key cpu_p 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" src: "{{ role_path }}/fluent-bit.conf.j2"
dest: /etc/fluent-bit/fluent-bit.conf dest: /etc/fluent-bit/fluent-bit.conf
notify: restart fluent-bit 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