Sha256: 29bcda7a2d5e831673da2cac1d7a1d8c01f196ac53d580d80f93bd7200849f53

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

require "vmstat"
require_relative "../base"

module AppPerfAgent
  module Plugin
    module System
      class Disk < AppPerfAgent::Plugin::Base
        def call
          disks = Vmstat.snapshot.disks
          disks.flat_map {|disk|
            [
              [
                AppPerfAgent::Types::DISK,
                "system.disk.used_bytes",
                "#{disk.origin} - #{disk.type} (#{disk.mount})",
                disk.used_bytes
              ],
              [
                AppPerfAgent::Types::DISK,
                "system.disk.free_bytes",
                "#{disk.origin} - #{disk.type} (#{disk.mount})",
                disk.free_bytes
              ],
              [
                AppPerfAgent::Types::DISK,
                "system.disk.available_bytes",
                "#{disk.origin} - #{disk.type} (#{disk.mount})",
                disk.available_bytes
              ],
              [
                AppPerfAgent::Types::DISK,
                "system.disk.total_bytes",
                "#{disk.origin} - #{disk.type} (#{disk.mount})",
                disk.total_bytes
              ]
            ]
          }
        end
      end
    end
  end
end

AppPerfAgent.logger.info "Loading Disk monitoring."

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
app_perf_agent-0.0.4 lib/app_perf_agent/plugin/system/disk.rb