Class: CloudWatchMetrics::Linux::LoadAvg
- Inherits:
-
Object
- Object
- CloudWatchMetrics::Linux::LoadAvg
- Defined in:
- lib/cloud_watch_metrics/linux/loadavg.rb
Constant Summary collapse
- PATH =
'/proc/loadavg'
Instance Attribute Summary collapse
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Instance Method Summary collapse
-
#initialize ⇒ LoadAvg
constructor
A new instance of LoadAvg.
- #loadavg1 ⇒ Object
- #loadavg15 ⇒ Object
- #loadavg5 ⇒ Object
Constructor Details
#initialize ⇒ LoadAvg
Returns a new instance of LoadAvg.
10 11 12 13 |
# File 'lib/cloud_watch_metrics/linux/loadavg.rb', line 10 def initialize @time = Time.now @data = File.read(PATH).split(/\s+/) end |
Instance Attribute Details
#time ⇒ Object (readonly)
Returns the value of attribute time.
8 9 10 |
# File 'lib/cloud_watch_metrics/linux/loadavg.rb', line 8 def time @time end |
Instance Method Details
#loadavg1 ⇒ Object
15 16 17 |
# File 'lib/cloud_watch_metrics/linux/loadavg.rb', line 15 def loadavg1 @data.fetch(0).to_f end |
#loadavg15 ⇒ Object
23 24 25 |
# File 'lib/cloud_watch_metrics/linux/loadavg.rb', line 23 def loadavg15 @data.fetch(2).to_f end |
#loadavg5 ⇒ Object
19 20 21 |
# File 'lib/cloud_watch_metrics/linux/loadavg.rb', line 19 def loadavg5 @data.fetch(1).to_f end |