Class: ZabbixApi

Inherits:
Object
  • Object
show all
Defined in:
lib/zabbixapi.rb,
lib/zabbixapi/hosts.rb,
lib/zabbixapi/items.rb,
lib/zabbixapi/users.rb,
lib/zabbixapi/client.rb,
lib/zabbixapi/errors.rb,
lib/zabbixapi/graphs.rb,
lib/zabbixapi/server.rb,
lib/zabbixapi/version.rb,
lib/zabbixapi/triggers.rb,
lib/zabbixapi/templates.rb,
lib/zabbixapi/hostgroups.rb,
lib/zabbixapi/applications.rb

Defined Under Namespace

Classes: ApiError, Applications, BaseError, Client, Graphs, HostGroups, Hosts, HttpError, Items, Server, SocketError, Templates, Triggers, Users

Constant Summary collapse

VERSION =
"0.4.7"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ZabbixApi

Returns a new instance of ZabbixApi.



38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/zabbixapi.rb', line 38

def initialize(options = {})
  @client = Client.new(options)
  @server = Server.new(options)
  @users   = Users.new(options)
  @items   = Items.new(options)
  @hosts   = Hosts.new(options)
  @applications = Applications.new(options)
  @templates    = Templates.new(options)
  @hostgroups   = HostGroups.new(options)
  @triggers = Triggers.new(options)
  @graphs = Graphs.new(options)
end

Instance Attribute Details

#applicationsObject (readonly)

Returns the value of attribute applications.



19
20
21
# File 'lib/zabbixapi.rb', line 19

def applications
  @applications
end

#clientObject (readonly)

Returns the value of attribute client.



15
16
17
# File 'lib/zabbixapi.rb', line 15

def client
  @client
end

#graphsObject (readonly)

Returns the value of attribute graphs.



24
25
26
# File 'lib/zabbixapi.rb', line 24

def graphs
  @graphs
end

#hostgroupsObject (readonly)

Returns the value of attribute hostgroups.



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

def hostgroups
  @hostgroups
end

#hostsObject (readonly)

Returns the value of attribute hosts.



22
23
24
# File 'lib/zabbixapi.rb', line 22

def hosts
  @hosts
end

#itemsObject (readonly)

Returns the value of attribute items.



18
19
20
# File 'lib/zabbixapi.rb', line 18

def items
  @items
end

#serverObject (readonly)

Returns the value of attribute server.



16
17
18
# File 'lib/zabbixapi.rb', line 16

def server
  @server
end

#templatesObject (readonly)

Returns the value of attribute templates.



20
21
22
# File 'lib/zabbixapi.rb', line 20

def templates
  @templates
end

#triggersObject (readonly)

Returns the value of attribute triggers.



23
24
25
# File 'lib/zabbixapi.rb', line 23

def triggers
  @triggers
end

#usersObject (readonly)

Returns the value of attribute users.



17
18
19
# File 'lib/zabbixapi.rb', line 17

def users
  @users
end

Class Method Details

.connect(options = {}) ⇒ Object



26
27
28
# File 'lib/zabbixapi.rb', line 26

def self.connect(options = {})
  new(options)
end

.currentObject



30
31
32
# File 'lib/zabbixapi.rb', line 30

def self.current
  @current ||= ZabbixApi.new
end

Instance Method Details

#query(data) ⇒ Object



34
35
36
# File 'lib/zabbixapi.rb', line 34

def query(data)
  @client.api_request(:method => data[:method], :params => data[:params])
end