Class: Bark::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/bark/server.rb

Overview

The Server class hits the Status Monit API endpoint and then segments it accordingly

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Server

Returns a new instance of Server.



6
7
8
9
# File 'lib/bark/server.rb', line 6

def initialize(client)
  @client = client
  @status = Bark::Status.new client
end

Instance Method Details

#control_fileString

Retrieves the platform's control file path

Returns:

  • (String)

    "/Users/jdoe/.monitrc"



70
71
72
# File 'lib/bark/server.rb', line 70

def control_file
  @status.current[:monit][:server][:controlfile]
end

#hostnameString

Retrieves the platform's hostname

Returns:

  • (String)

    "JohnDoe-Laptop.com"



63
64
65
# File 'lib/bark/server.rb', line 63

def hostname
  @status.current[:monit][:server][:localhostname]
end

#httpdHash

Retrieves the platform's httpd instance object

Returns:

  • (Hash)

    {:address=>"localhost", :port=>"2812", :ssl=>"0"}



77
78
79
# File 'lib/bark/server.rb', line 77

def httpd
  @status.current[:monit][:server][:httpd]
end

#httpd_addressString

Retrieves the platform's httpd instance address / hostname

Returns:



84
85
86
# File 'lib/bark/server.rb', line 84

def httpd_address
  @status.current[:monit][:server][:httpd][:address]
end

#httpd_portString

Retrieves the platform's httpd instance port number

Returns:



91
92
93
# File 'lib/bark/server.rb', line 91

def httpd_port
  @status.current[:monit][:server][:httpd][:port]
end

#httpd_sslString

Retrieves the platform's httpd instance SSL boolean (binary)

Returns:



98
99
100
# File 'lib/bark/server.rb', line 98

def httpd_ssl
  @status.current[:monit][:server][:httpd][:ssl]
end

#idString

Retrieves the platform's id

Returns:

  • (String)

    "4674ff31c162bba574525571642b67fd"



21
22
23
# File 'lib/bark/server.rb', line 21

def id
  @status.current[:monit][:server][:id]
end

#incarnationString

Retrieves the platform's incarnation

Returns:



28
29
30
# File 'lib/bark/server.rb', line 28

def incarnation
  @status.current[:monit][:server][:incarnation]
end

#monit_versionString

Retrieves the platform's monit version number

Returns:



35
36
37
# File 'lib/bark/server.rb', line 35

def monit_version
  @status.current[:monit][:server][:version]
end

#pollString

Retrieves the platform's polling rate

Returns:



49
50
51
# File 'lib/bark/server.rb', line 49

def poll
  @status.current[:monit][:server][:poll]
end

#start_delayString

Retrieves the platform's start delay time

Returns:



56
57
58
# File 'lib/bark/server.rb', line 56

def start_delay
  @status.current[:monit][:server][:startdelay]
end

#statusHash

Retrieves the server's status

Returns:

  • (Hash)

    {:id=>"4674ff31c162bba574525571642b67fd", :incarnation=>"1443740471", :version=>"5.14", :uptime=>"14536", :poll=>"30", :startdelay=>"0", :localhostname=>"JohnDoe-Laptop.com", :controlfile=>"/Users/jdoe/.monitrc", :httpd=>{:address=>"localhost", :port=>"2812", :ssl=>"0"}}



14
15
16
# File 'lib/bark/server.rb', line 14

def status
  @status.current[:monit][:server]
end

#uptimeString

Retrieves the platform's uptime

Returns:



42
43
44
# File 'lib/bark/server.rb', line 42

def uptime
  @status.current[:monit][:server][:uptime]
end