Class: Bark::Platform
- Inherits:
-
Object
- Object
- Bark::Platform
- Defined in:
- lib/bark/platform.rb
Overview
The Platform class hits the Status Monit API endpoint and then segments it accordingly
Instance Method Summary collapse
-
#cpu ⇒ String
Retrieves the platform's aggregate (user / system) CPU usage.
-
#full ⇒ `Hash`
Retrieves the full platform object.
-
#initialize(client) ⇒ Platform
constructor
A new instance of Platform.
-
#machine ⇒ String
Retrieves the platform's machine type.
-
#memory ⇒ String
Retrieves the platform's total RAM (used & available).
-
#name ⇒ String
Retrieves the platform's name.
-
#release ⇒ String
Retrieves the platform's release number.
-
#swap ⇒ String
Retrieves the platform's total swap (used & available).
-
#version ⇒ String
Retrieves the platform's version number.
Constructor Details
#initialize(client) ⇒ Platform
Returns a new instance of Platform.
6 7 8 9 |
# File 'lib/bark/platform.rb', line 6 def initialize(client) @client = client @status = Bark::Status.new client end |
Instance Method Details
#cpu ⇒ String
Retrieves the platform's aggregate (user / system) CPU usage
58 59 60 |
# File 'lib/bark/platform.rb', line 58 def cpu @status.current[:monit][:platform][:cpu] end |
#full ⇒ `Hash`
Retrieves the full platform object
{ :name => "Darwin", :release => "15.0.0", :version => "Darwin Kernel Version 15.0.0: Wed Aug 26 16:57:32 PDT 2015; root:xnu-3247.1.106~1/RELEASE_X86_64", :machine => "x86_64", :cpu => "4", :memory => "16777216", :swap => "0" }
23 24 25 |
# File 'lib/bark/platform.rb', line 23 def full @status.current[:monit][:platform] end |
#machine ⇒ String
Retrieves the platform's machine type
51 52 53 |
# File 'lib/bark/platform.rb', line 51 def machine @status.current[:monit][:platform][:machine] end |
#memory ⇒ String
Retrieves the platform's total RAM (used & available)
65 66 67 |
# File 'lib/bark/platform.rb', line 65 def memory @status.current[:monit][:platform][:memory] end |
#name ⇒ String
Retrieves the platform's name
30 31 32 |
# File 'lib/bark/platform.rb', line 30 def name @status.current[:monit][:platform][:name] end |
#release ⇒ String
Retrieves the platform's release number
37 38 39 |
# File 'lib/bark/platform.rb', line 37 def release @status.current[:monit][:platform][:release] end |
#swap ⇒ String
Retrieves the platform's total swap (used & available)
72 73 74 |
# File 'lib/bark/platform.rb', line 72 def swap @status.current[:monit][:platform][:swap] end |
#version ⇒ String
Retrieves the platform's version number
44 45 46 |
# File 'lib/bark/platform.rb', line 44 def version @status.current[:monit][:platform][:version] end |