class Nagios::API::Client

Create a new client to interact with the nagios-api server.

client = Nagios::API::Client.new("http://nagios-server:8181")

Optionally set authentication credentials

client = Nagios::API::Client.new("http://nagios-server:8181", user: 'user', password: 'password')

Attributes

base_url[R]
options[R]
state[R]

Public Class Methods

new(base_url, extra_args = {}) click to toggle source
# File lib/nagios/api/client.rb, line 13
def initialize(base_url, extra_args = {})
  @base_url = base_url
  @options = extra_args
end

Public Instance Methods

api() click to toggle source
# File lib/nagios/api/client.rb, line 18
def api
  @api ||= Nagios::API::Interface.new(options.merge(base_url: base_url))
end
hosts() click to toggle source
# File lib/nagios/api/client.rb, line 22
def hosts
  @hosts ||= Nagios::API::Hosts.new(api_client: self)
end