class Nagios::ZFS::Zpool
Constants
- KNOWN_POOL_HEALTHS
Attributes
name[R]
Public Class Methods
new(name)
click to toggle source
# File lib/nagios/zfs/zpool.rb, line 8 def initialize(name) raise 'missing pool name' if [nil, ''].include?(name) @name = name end
Public Instance Methods
capacity()
click to toggle source
# File lib/nagios/zfs/zpool.rb, line 13 def capacity query.split("\t").last[/^(\d+)/,1].to_i end
health()
click to toggle source
# File lib/nagios/zfs/zpool.rb, line 21 def health @health ||= `zpool list -H -o health #{name}`.strip raise "unknown health: #{@health}" unless KNOWN_POOL_HEALTHS.include?(@health) @health end
query()
click to toggle source
# File lib/nagios/zfs/zpool.rb, line 17 def query @query ||= `zpool list -H -o name,cap #{name}` end