Class: Nagios::ZFS::Zpool
- Inherits:
-
Object
- Object
- Nagios::ZFS::Zpool
- Defined in:
- lib/nagios/zfs/zpool.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #capacity ⇒ Object
-
#initialize(name) ⇒ Zpool
constructor
A new instance of Zpool.
- #query ⇒ Object
Constructor Details
#initialize(name) ⇒ Zpool
Returns a new instance of Zpool.
6 7 8 9 |
# File 'lib/nagios/zfs/zpool.rb', line 6 def initialize(name) raise 'missing pool name' if [nil, ''].include?(name) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/nagios/zfs/zpool.rb', line 4 def name @name end |
Instance Method Details
#capacity ⇒ Object
11 12 13 |
# File 'lib/nagios/zfs/zpool.rb', line 11 def capacity query.split("\t").last[/^(\d+)/,1].to_i end |
#query ⇒ Object
15 16 17 |
# File 'lib/nagios/zfs/zpool.rb', line 15 def query @query ||= `zpool list -H -o name,cap #{@name}` end |