class Bark::Platform
The Platform
class hits the Status
Monit API endpoint and then segments it accordingly
Public Class Methods
new(client)
click to toggle source
# File lib/bark/platform.rb, line 6 def initialize(client) @client = client @status = Bark::Status.new client end
Public Instance Methods
cpu()
click to toggle source
Retrieves the platform’s aggregate (user / system) CPU usage
@return [String] ‘“4”`
# File lib/bark/platform.rb, line 58 def cpu @status.current[:monit][:platform][:cpu] end
full()
click to toggle source
Retrieves the full platform object
@return [‘Hash`] {
: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"
}
# File lib/bark/platform.rb, line 23 def full @status.current[:monit][:platform] end
machine()
click to toggle source
Retrieves the platform’s machine type
@return [String] ‘“x86_64”`
# File lib/bark/platform.rb, line 51 def machine @status.current[:monit][:platform][:machine] end
memory()
click to toggle source
Retrieves the platform’s total RAM (used & available)
@return [String] ‘“16777216”`
# File lib/bark/platform.rb, line 65 def memory @status.current[:monit][:platform][:memory] end
name()
click to toggle source
Retrieves the platform’s name
@return [String] ‘“Darwin”`
# File lib/bark/platform.rb, line 30 def name @status.current[:monit][:platform][:name] end
release()
click to toggle source
Retrieves the platform’s release number
@return [String] ‘“15.0.0”`
# File lib/bark/platform.rb, line 37 def release @status.current[:monit][:platform][:release] end
swap()
click to toggle source
Retrieves the platform’s total swap (used & available)
@return [String] ‘“0”`
# File lib/bark/platform.rb, line 72 def swap @status.current[:monit][:platform][:swap] end
version()
click to toggle source
Retrieves the platform’s version number
@return [String] ‘“Darwin Kernel Version 15.0.0: Wed Aug 26 16:57:32 PDT 2015; root:xnu-3247.1.106~1/RELEASE_X86_64”`
# File lib/bark/platform.rb, line 44 def version @status.current[:monit][:platform][:version] end