Class: Perus::Pinger::Mem
- Defined in:
- lib/perus/pinger/metrics/mem.rb
Instance Attribute Summary
Attributes inherited from Command
Instance Method Summary collapse
Methods inherited from Command
abstract!, abstract?, #cleanup, #darwin?, description, human_name, inherited, #initialize, metric!, metric?, option, options, #shell, subclasses
Constructor Details
This class inherits a constructor from Perus::Pinger::Command
Instance Method Details
#run ⇒ Object
6 7 8 9 |
# File 'lib/perus/pinger/metrics/mem.rb', line 6 def run percent = shell(%Q[cat /proc/meminfo | awk '{if ($1=="MemTotal:") total = $2; if ($1 == "MemFree:") free = $2;} END {print (1 - (free / total))*100}']) {mem_all: percent.to_f} end |