Class: Solanum::Source::Uptime
- Inherits:
-
Solanum::Source
- Object
- Solanum::Source
- Solanum::Source::Uptime
- Defined in:
- lib/solanum/source/uptime.rb
Constant Summary collapse
- STAT_FILE =
'/proc/uptime'
Instance Attribute Summary
Attributes inherited from Solanum::Source
Instance Method Summary collapse
- #collect! ⇒ Object
-
#initialize(opts) ⇒ Uptime
constructor
A new instance of Uptime.
Methods inherited from Solanum::Source
Constructor Details
#initialize(opts) ⇒ Uptime
Returns a new instance of Uptime.
9 10 11 |
# File 'lib/solanum/source/uptime.rb', line 9 def initialize(opts) super(opts) end |
Instance Method Details
#collect! ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/solanum/source/uptime.rb', line 14 def collect! events = [] uptime = File.read(STAT_FILE).split(' ').first.to_f events << { service: 'uptime', metric: uptime, description: "Up for #{duration_str(uptime)}", } events end |