Memory Metics

mem 输入插件,每隔一定的时间间隔收集正在运行的系统的内存和 swap 使用情况的信息,并报告内存总量和可用空间。

快速开始

要从系统获取内存和 swap 使用情况,可以从命令行或通过配置文件运行插件:

命令行

  1. $ fluent-bit -i mem -t memory -o stdout -m '*'
  2. Fluent Bit v1.x.x
  3. * Copyright (C) 2019-2020 The Fluent Bit Authors
  4. * Copyright (C) 2015-2018 Treasure Data
  5. * Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
  6. * https://fluentbit.io
  7. [2017/03/03 21:12:35] [ info] [engine] started
  8. [0] memory: [1488543156, {"Mem.total"=>1016044, "Mem.used"=>841388, "Mem.free"=>174656, "Swap.total"=>2064380, "Swap.used"=>139888, "Swap.free"=>1924492}]
  9. [1] memory: [1488543157, {"Mem.total"=>1016044, "Mem.used"=>841420, "Mem.free"=>174624, "Swap.total"=>2064380, "Swap.used"=>139888, "Swap.free"=>1924492}]
  10. [2] memory: [1488543158, {"Mem.total"=>1016044, "Mem.used"=>841420, "Mem.free"=>174624, "Swap.total"=>2064380, "Swap.used"=>139888, "Swap.free"=>1924492}]
  11. [3] memory: [1488543159, {"Mem.total"=>1016044, "Mem.used"=>841420, "Mem.free"=>174624, "Swap.total"=>2064380, "Swap.used"=>139888, "Swap.free"=>1924492}]

配置文件

在您的主配置文件中,添加以下 InputOutput 配置段:

  1. [INPUT]
  2. Name mem
  3. Tag memory
  4. [OUTPUT]
  5. Name stdout
  6. Match *