# CONFIGURED BY ANSIBLE # https://docs.fluentbit.io/manual/pipeline/inputs/cpu-metrics # https://docs.fluentbit.io/manual/pipeline/inputs/memory-metrics # https://docs.fluentbit.io/manual/pipeline/inputs/disk-io-metrics # https://docs.fluentbit.io/manual/pipeline/inputs/network-io-metrics # https://github.com/sysstat/sysstat # https://docs.fluentbit.io/manual/pipeline/filters/log_to_metrics # # INDENTATION WITH SPACES NOT TABS # # flb thermal [INPUT] name thermal tag hw.temp interval_sec 5 # flb cpu [INPUT] name cpu tag hw.cpu interval_sec 5 # hard-code total cpu for better load avgs (check /proc/cpuinfo) # TODO define cpu_total on-the-fly during playbook execution [FILTER] name modify match hw.cpu add cpu_total 1 # sysstat load [INPUT] name exec tag hw.load interval_sec 5 command sar -q 0 [FILTER] name grep match hw.load regex exec [0-9.,]+$ [FILTER] name parser match hw.load key_name exec parser load_avg preserve_key false reserve_data false # flb mem required for swap [INPUT] name mem tag hw.mem interval_sec 5 # sysstat ram [INPUT] name exec tag hw.ram interval_sec 5 command sar -r 0 [FILTER] name grep match hw.ram regex exec [0-9.,]+$ [FILTER] name parser match hw.ram key_name exec parser ram_used_percent preserve_key false reserve_data false # flb i/o [INPUT] name disk tag hw.disk interval_sec 5 # sysstat i/o [INPUT] name exec tag hw.io interval_sec 5 command sar -d 0 [FILTER] name grep match hw.io regex exec [0-9.,]+$ [FILTER] name parser match hw.io key_name exec parser io_used_percent preserve_key false reserve_data false # flb tx/rx [INPUT] name netif tag hw.netif interval_sec 5 interface eth0 # sysstat DEV eth0 [INPUT] name exec tag hw.iface interval_sec 5 command sar -n DEV --iface=eth0 0 [FILTER] name grep match hw.iface regex exec [0-9.,]+$ [FILTER] name parser match hw.iface key_name exec parser iface_p preserve_key false reserve_data false # # https://docs.fluentbit.io/manual/pipeline/filters/log_to_metrics # # TEMP # hw.thermal: [1706249487.809969825, {"name":"hwmon0_temp1_input","type":"nvme","temp":47.85}] [FILTER] name log_to_metrics match hw.temp tag hw_metrics metric_mode gauge metric_name nvme value_field temp regex name hwmon0_temp1_input metric_description nvme temperature # hw.thermal: [1706249487.809976075, {"name":"hwmon1_temp1_input","type":"k10temp","temp":90.0}] # hw.thermal: [1706249487.809982385, {"name":"hwmon1_temp3_input","type":"k10temp","temp":87.75}] # hw.thermal: [1706249487.809984535, {"name":"hwmon1_temp4_input","type":"k10temp","temp":81.0}] [FILTER] name log_to_metrics match hw.temp tag hw_metrics metric_mode gauge metric_name k10temp value_field temp regex name hwmon1_temp1_input metric_description k10temp temperature # CPU [FILTER] name log_to_metrics match hw.cpu tag hw_metrics metric_mode gauge metric_name cpu_p value_field cpu_p metric_description CPU usage % [FILTER] name log_to_metrics match hw.cpu tag hw_metrics metric_mode gauge metric_name cpu_total value_field cpu_total metric_description total amount of CPU cores # SYSTEM LOAD [FILTER] name log_to_metrics match hw.load tag hw_metrics metric_mode gauge metric_name ldavg1 value_field ldavg1 metric_description system load 1 minute [FILTER] name log_to_metrics match hw.load tag hw_metrics metric_mode gauge metric_name ldavg5 value_field ldavg5 metric_description system load 5 minutes [FILTER] name log_to_metrics match hw.load tag hw_metrics metric_mode gauge metric_name ldavg15 value_field ldavg15 metric_description system load 15 minutes # RAM [FILTER] name log_to_metrics match hw.ram tag hw_metrics metric_mode gauge metric_name ram_used_percent value_field ram_used_percent metric_description RAM usage % excl. buff/cache # SWAP [FILTER] name log_to_metrics match hw.mem tag hw_metrics metric_mode gauge metric_name swap.used value_field Swap.used metric_description used SWAP bytes [FILTER] name log_to_metrics match hw.mem tag hw_metrics metric_mode gauge metric_name swap.total value_field Swap.total metric_description total SWAP bytes # DISK I/O [FILTER] name log_to_metrics match hw.disk tag hw_metrics metric_mode gauge metric_name write_size value_field write_size metric_description disk output [FILTER] name log_to_metrics match hw.disk tag hw_metrics metric_mode gauge metric_name read_size value_field read_size metric_description disk input [FILTER] name log_to_metrics match hw.io tag hw_metrics metric_mode gauge metric_name io_used_percent value_field io_used_percent metric_description disk i/o # IFACE USAGE [FILTER] name log_to_metrics match hw.iface tag hw_metrics.iface metric_mode gauge metric_name iface_p value_field iface_p metric_description network tx/rx # TX/RX [FILTER] name log_to_metrics match hw.netif tag hw_metrics.netif metric_mode gauge metric_name eth0.tx.bytes value_field eth0.tx.bytes metric_description TX bytes [FILTER] name log_to_metrics match hw.netif tag hw_metrics.netif metric_mode gauge metric_name eth0.rx.bytes value_field eth0.rx.bytes metric_description RX bytes [FILTER] name log_to_metrics match hw.netif tag hw_metrics.netif metric_mode gauge metric_name eth0.tx.packets value_field eth0.tx.packets metric_description TX pkts [FILTER] name log_to_metrics match hw.netif tag hw_metrics.netif metric_mode gauge metric_name eth0.rx.packets value_field eth0.rx.packets metric_description RX pkts #[OUTPUT] # name file # match hw_metrics.iface # path /var/log # file fluent-bit.log [OUTPUT] name prometheus_remote_write match hw_metrics* host {{tsdb_host}} port {{tsdb_port}} tls on tls.verify on http_user {{tsdb_http_user}} http_passwd {{tsdb_http_passwd}} # standalone uri /api/v1/write # cluster #uri /insert/0/prometheus/api/v1/write log_response_payload true add_label sensor flb@{{inventory_hostname}} add_label instance {{inventory_hostname}} add_label host {{inventory_hostname}} add_label site {{site}}