Sha256: a65d22e58e8fba4dcafdb6234e4b150fee7390f1de9726dbb2c3d03499723c47

Contents?: true

Size: 367 Bytes

Versions: 2

Compression:

Stored size: 367 Bytes

Contents

module Nagios
  module ZFS
    class Zpool
      attr_reader :name

      def initialize(name)
        raise 'missing pool name' if [nil, ''].include?(name)
        @name = name
      end

      def capacity
        query.split("\t").last[/^(\d+)/,1].to_i
      end

      def query
        @query ||= `zpool list -H -o name,cap #{@name}`
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nagios-zfs-0.1.1 lib/nagios/zfs/zpool.rb
nagios-zfs-0.1.0 lib/nagios/zfs/zpool.rb