Sha256: baed23c9485b83bed423b87436139af3442f7bdf95a21f9a57f18752f26c9a83

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.3 lib/app_perf_agent/plugin/system/disk.rb