Class: Adminix::Entities::SysloadStamp
- Inherits:
-
Object
- Object
- Adminix::Entities::SysloadStamp
- Defined in:
- lib/adminix/entities/sysload_stamp.rb
Instance Attribute Summary collapse
-
#cpu_load_percents ⇒ Object
readonly
Returns the value of attribute cpu_load_percents.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#disk_usage_mb ⇒ Object
readonly
Returns the value of attribute disk_usage_mb.
-
#memory_usage_mb ⇒ Object
readonly
Returns the value of attribute memory_usage_mb.
-
#temperature ⇒ Object
readonly
Returns the value of attribute temperature.
Instance Method Summary collapse
- #create_stamp ⇒ Object
-
#initialize ⇒ SysloadStamp
constructor
A new instance of SysloadStamp.
- #to_api ⇒ Object
Constructor Details
#initialize ⇒ SysloadStamp
Returns a new instance of SysloadStamp.
8 9 10 11 |
# File 'lib/adminix/entities/sysload_stamp.rb', line 8 def initialize create_stamp @created_at = Time.now end |
Instance Attribute Details
#cpu_load_percents ⇒ Object (readonly)
Returns the value of attribute cpu_load_percents.
5 6 7 |
# File 'lib/adminix/entities/sysload_stamp.rb', line 5 def cpu_load_percents @cpu_load_percents end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
5 6 7 |
# File 'lib/adminix/entities/sysload_stamp.rb', line 5 def created_at @created_at end |
#disk_usage_mb ⇒ Object (readonly)
Returns the value of attribute disk_usage_mb.
5 6 7 |
# File 'lib/adminix/entities/sysload_stamp.rb', line 5 def disk_usage_mb @disk_usage_mb end |
#memory_usage_mb ⇒ Object (readonly)
Returns the value of attribute memory_usage_mb.
5 6 7 |
# File 'lib/adminix/entities/sysload_stamp.rb', line 5 def memory_usage_mb @memory_usage_mb end |
#temperature ⇒ Object (readonly)
Returns the value of attribute temperature.
5 6 7 |
# File 'lib/adminix/entities/sysload_stamp.rb', line 5 def temperature @temperature end |
Instance Method Details
#create_stamp ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/adminix/entities/sysload_stamp.rb', line 13 def create_stamp case Adminix.os when 'linux' @memory_usage_mb, = Helpers::Command.debian_memory_load @cpu_load_percents = Helpers::Command.debian_cpu_load @disk_usage_mb, = Helpers::Command.debian_disk_usage @temperature = Helpers::Command.debian_temperature when 'mac' @cpu_load_percents = Helpers::Command.darwin_cpu_load @disk_usage_mb, = Helpers::Command.darwin_disk_usage end end |
#to_api ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/adminix/entities/sysload_stamp.rb', line 26 def to_api { memory: memory_usage_mb, cpu: cpu_load_percents, disk: disk_usage_mb, temperature: temperature, created_at: created_at } end |