Class: OsCtl::Lib::Zfs::PoolIOStat

Inherits:
Object
  • Object
show all
Defined in:
lib/libosctl/zfs/pool_iostat.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pool) ⇒ PoolIOStat

Returns a new instance of PoolIOStat.

Parameters:

  • pool (String)


8
9
10
11
# File 'lib/libosctl/zfs/pool_iostat.rb', line 8

def initialize(pool)
  @pool = pool
  parse
end

Instance Attribute Details

#nreadObject (readonly)

Returns the value of attribute nread.



4
5
6
# File 'lib/libosctl/zfs/pool_iostat.rb', line 4

def nread
  @nread
end

#nwrittenObject (readonly)

Returns the value of attribute nwritten.



4
5
6
# File 'lib/libosctl/zfs/pool_iostat.rb', line 4

def nwritten
  @nwritten
end

#poolObject (readonly)

Returns the value of attribute pool.



3
4
5
# File 'lib/libosctl/zfs/pool_iostat.rb', line 3

def pool
  @pool
end

#rcntObject (readonly)

Returns the value of attribute rcnt.



4
5
6
# File 'lib/libosctl/zfs/pool_iostat.rb', line 4

def rcnt
  @rcnt
end

#readsObject (readonly)

Returns the value of attribute reads.



4
5
6
# File 'lib/libosctl/zfs/pool_iostat.rb', line 4

def reads
  @reads
end

#rlentimeObject (readonly)

Returns the value of attribute rlentime.



4
5
6
# File 'lib/libosctl/zfs/pool_iostat.rb', line 4

def rlentime
  @rlentime
end

#rtimeObject (readonly)

Returns the value of attribute rtime.



4
5
6
# File 'lib/libosctl/zfs/pool_iostat.rb', line 4

def rtime
  @rtime
end

#rupdateObject (readonly)

Returns the value of attribute rupdate.



4
5
6
# File 'lib/libosctl/zfs/pool_iostat.rb', line 4

def rupdate
  @rupdate
end

#wcntObject (readonly)

Returns the value of attribute wcnt.



4
5
6
# File 'lib/libosctl/zfs/pool_iostat.rb', line 4

def wcnt
  @wcnt
end

#wlentimeObject (readonly)

Returns the value of attribute wlentime.



4
5
6
# File 'lib/libosctl/zfs/pool_iostat.rb', line 4

def wlentime
  @wlentime
end

#writesObject (readonly)

Returns the value of attribute writes.



4
5
6
# File 'lib/libosctl/zfs/pool_iostat.rb', line 4

def writes
  @writes
end

#wtimeObject (readonly)

Returns the value of attribute wtime.



4
5
6
# File 'lib/libosctl/zfs/pool_iostat.rb', line 4

def wtime
  @wtime
end

#wupdateObject (readonly)

Returns the value of attribute wupdate.



4
5
6
# File 'lib/libosctl/zfs/pool_iostat.rb', line 4

def wupdate
  @wupdate
end

Instance Method Details

#parseObject (protected)



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/libosctl/zfs/pool_iostat.rb', line 14

def parse
  File.open(File.join('/proc/spl/kstat/zfs', pool, 'io')) do |f|
    f.readline
    f.readline

    stats = f.readline.strip.split

    %w(nread nwritten reads writes wtime wlentime wupdate rtime rlentime
       rupdate wcnt rcnt).each do |param|
      instance_variable_set("@#{param}", stats.shift.to_i)
    end
  end
end