Class: RorVsWild::Metrics::Storage

Inherits:
Object
  • Object
show all
Defined in:
lib/rorvswild/metrics/storage.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#freeObject (readonly)

Returns the value of attribute free.



4
5
6
# File 'lib/rorvswild/metrics/storage.rb', line 4

def free
  @free
end

#usedObject (readonly)

Returns the value of attribute used.



4
5
6
# File 'lib/rorvswild/metrics/storage.rb', line 4

def used
  @used
end

Instance Method Details

#totalObject



12
13
14
# File 'lib/rorvswild/metrics/storage.rb', line 12

def total
  used + free
end

#updateObject



6
7
8
9
10
# File 'lib/rorvswild/metrics/storage.rb', line 6

def update
  array = `df -k | grep " /$"`.split
  @used = array[2].to_i * 1000
  @free = array[3].to_i * 1000
end