intelsdi-x / snap-plugin-collector-disk

Collects Linux disk metrics from /proc/diskstats
http://snap-telemetry.io/
Apache License 2.0
4 stars 23 forks source link

Add config params to be able to ignore loopback and RAM devices #50

Closed IzabellaRaulin closed 6 years ago

IzabellaRaulin commented 6 years ago

Summary of changes:

How to test it

a) ignore_loopback and ignore_ram set to false (default) By default both ignore_loopback and ignore_ram are set to false , so the plugin works exactly as before (collecting metrics from all devices listed in /proc/diskstats) .

For exemplary task manifest:

---
  version: 1
  schedule:
    type: "simple"
    interval: "1s"
  max-failures: 10
  workflow:
    collect:
      metrics:
        /intel/procfs/disk/*/io_time : {}
      config:
        /intel/procfs/disk:
            proc_path: "/proc"

Returned metrics include metrics for loop and ram devices:

/intel/procfs/disk/loop0/io_time                 0                       2017-10-10 09:15:44.448764792 +0000 UTC
/intel/procfs/disk/ram0/io_time                  0                       2017-10-10 09:16:20.453088115 +0000 UTC
/intel/procfs/disk/sda/io_time                   1.3330064672618316      2017-10-10 09:16:21.453571418 +0000 UTC
/intel/procfs/disk/sda1/io_time                  0                       2017-10-10 09:16:20.453088115 +0000 UTC
/intel/procfs/disk/sda2/io_time                  0                       2017-10-10 09:16:20.453088115 +0000 UTC
/intel/procfs/disk/sda3/io_time                  1.3331478533612604      2017-10-10 09:16:20.453088115 +0000 UTC

a) ignore_loopback and ignore_ram set to true

For exemplary task manifest:

---
  version: 1
  schedule:
    type: "simple"
    interval: "1s"
  max-failures: 10
  workflow:
    collect:
      metrics:
        /intel/procfs/disk/* : {}
      config:
        /intel/procfs/disk:
            proc_path: "/proc"
            ignore_loopback: true
            ignore_ram: true

Returned metrics do NOT include metrics for loop and ram devices:

/intel/procfs/disk/sda/io_time                   1.3330064672618316      2017-10-10 09:16:21.453571418 +0000 UTC
/intel/procfs/disk/sda1/io_time                  0                       2017-10-10 09:16:20.453088115 +0000 UTC
/intel/procfs/disk/sda2/io_time                  0                       2017-10-10 09:16:20.453088115 +0000 UTC
/intel/procfs/disk/sda3/io_time                  1.3331478533612604      2017-10-10 09:16:20.453088115 +0000 UTC