class Bark::Client
The Client
class is the primary communicator between the program and the
Attributes
‘:host` = The hostname of the Monit server `:port` = The port used to connect to the Monit server `:user` = The username used for basic auth with Monit server `:password` = The password used for basic auth with Monit server `:status` = The status xml api endpoint client `:server` = The server section retrieved via the status xml api `:platform` = The platform section retrieved via the status xml api `:service` = The service section retrieved via the status xml api
‘:host` = The hostname of the Monit server `:port` = The port used to connect to the Monit server `:user` = The username used for basic auth with Monit server `:password` = The password used for basic auth with Monit server `:status` = The status xml api endpoint client `:server` = The server section retrieved via the status xml api `:platform` = The platform section retrieved via the status xml api `:service` = The service section retrieved via the status xml api
‘:host` = The hostname of the Monit server `:port` = The port used to connect to the Monit server `:user` = The username used for basic auth with Monit server `:password` = The password used for basic auth with Monit server `:status` = The status xml api endpoint client `:server` = The server section retrieved via the status xml api `:platform` = The platform section retrieved via the status xml api `:service` = The service section retrieved via the status xml api
‘:host` = The hostname of the Monit server `:port` = The port used to connect to the Monit server `:user` = The username used for basic auth with Monit server `:password` = The password used for basic auth with Monit server `:status` = The status xml api endpoint client `:server` = The server section retrieved via the status xml api `:platform` = The platform section retrieved via the status xml api `:service` = The service section retrieved via the status xml api
‘:host` = The hostname of the Monit server `:port` = The port used to connect to the Monit server `:user` = The username used for basic auth with Monit server `:password` = The password used for basic auth with Monit server `:status` = The status xml api endpoint client `:server` = The server section retrieved via the status xml api `:platform` = The platform section retrieved via the status xml api `:service` = The service section retrieved via the status xml api
‘:host` = The hostname of the Monit server `:port` = The port used to connect to the Monit server `:user` = The username used for basic auth with Monit server `:password` = The password used for basic auth with Monit server `:status` = The status xml api endpoint client `:server` = The server section retrieved via the status xml api `:platform` = The platform section retrieved via the status xml api `:service` = The service section retrieved via the status xml api
‘:host` = The hostname of the Monit server `:port` = The port used to connect to the Monit server `:user` = The username used for basic auth with Monit server `:password` = The password used for basic auth with Monit server `:status` = The status xml api endpoint client `:server` = The server section retrieved via the status xml api `:platform` = The platform section retrieved via the status xml api `:service` = The service section retrieved via the status xml api
‘:host` = The hostname of the Monit server `:port` = The port used to connect to the Monit server `:user` = The username used for basic auth with Monit server `:password` = The password used for basic auth with Monit server `:status` = The status xml api endpoint client `:server` = The server section retrieved via the status xml api `:platform` = The platform section retrieved via the status xml api `:service` = The service section retrieved via the status xml api
Public Class Methods
# File lib/bark/client.rb, line 14 def initialize(opts = {}) default_if_opts_nil opts @client = Hurley::Client.new "http://#{@user}:#{@password}"\ "@#{@host}:#{@port}" end
Private Instance Methods
Checks if the value / option is nil. If it is, use the default value, otherwise, use the user provided input.
@return [‘String`]
# File lib/bark/client.rb, line 66 def decide_if_default_or_user_input(opt, default) if opt.nil? return default else return opt end end
Monit’s default hostname
@return [‘String`]
# File lib/bark/client.rb, line 77 def default_host @host = 'localhost' end
Used to determine whether or not the user provided the Monit server’s hostname, port, username, and password.
@return [‘Symbol`]
# File lib/bark/client.rb, line 54 def default_if_opts_nil(opts) @host = decide_if_default_or_user_input opts[:host], default_host @port = decide_if_default_or_user_input opts[:port], default_port @user = decide_if_default_or_user_input opts[:user], default_user @password = decide_if_default_or_user_input opts[:pass], default_password :ok end
Monit’s default password
@return [‘String`]
# File lib/bark/client.rb, line 98 def default_password @password = 'monit' end
Monit’s default port number
@return [‘String`]
# File lib/bark/client.rb, line 84 def default_port @port = '2812' end
Monit’s default username
@return [‘String`]
# File lib/bark/client.rb, line 91 def default_user @user = 'admin' end