Class: ZabbixApi

Inherits:
Object
  • Object
show all
Defined in:
lib/zabbixapi.rb,
lib/zabbixapi/client.rb,
lib/zabbixapi/version.rb,
lib/zabbixapi/classes/hosts.rb,
lib/zabbixapi/classes/items.rb,
lib/zabbixapi/classes/users.rb,
lib/zabbixapi/classes/errors.rb,
lib/zabbixapi/classes/graphs.rb,
lib/zabbixapi/classes/server.rb,
lib/zabbixapi/classes/proxies.rb,
lib/zabbixapi/classes/screens.rb,
lib/zabbixapi/basic/basic_func.rb,
lib/zabbixapi/basic/basic_init.rb,
lib/zabbixapi/classes/triggers.rb,
lib/zabbixapi/classes/unusable.rb,
lib/zabbixapi/basic/basic_alias.rb,
lib/zabbixapi/basic/basic_logic.rb,
lib/zabbixapi/classes/templates.rb,
lib/zabbixapi/classes/hostgroups.rb,
lib/zabbixapi/classes/mediatypes.rb,
lib/zabbixapi/classes/usergroups.rb,
lib/zabbixapi/classes/usermacros.rb,
lib/zabbixapi/classes/applications.rb

Defined Under Namespace

Classes: ApiError, Applications, BaseError, Basic, Client, Graphs, HostGroups, Hosts, HttpError, Items, Mediatypes, Proxies, Screens, Server, SocketError, Templates, Triggers, Usergroups, Usermacros, Users

Constant Summary collapse

VERSION =
"2.0.0"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ZabbixApi

Returns a new instance of ZabbixApi


42
43
44
45
46
47
# File 'lib/zabbixapi.rb', line 42

def initialize(options = {})
  @client = Client.new(options)
  unless @client.api_version == "1.4" || @client.api_version =~ /2\.0\.\d+/
    raise "Zabbix API version: #{@client.api_version} is not support by this version of zabbixapi"
  end
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client


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

def client
  @client
end

Class Method Details

.connect(options = {}) ⇒ Object


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

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

.currentObject


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

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

Instance Method Details

#applicationsObject


65
66
67
# File 'lib/zabbixapi.rb', line 65

def applications
  @applications ||= Applications.new(@client)
end

#graphsObject


81
82
83
# File 'lib/zabbixapi.rb', line 81

def graphs
  @graphs ||= Graphs.new(@client)
end

#hostgroupsObject


73
74
75
# File 'lib/zabbixapi.rb', line 73

def hostgroups
  @hostgroups ||= HostGroups.new(@client)
end

#hostsObject


61
62
63
# File 'lib/zabbixapi.rb', line 61

def hosts
  @hosts ||= Hosts.new(@client)
end

#itemsObject


57
58
59
# File 'lib/zabbixapi.rb', line 57

def items
  @items ||= Items.new(@client)
end

#mediatypesObject


101
102
103
# File 'lib/zabbixapi.rb', line 101

def mediatypes
  @mediatypes ||= Mediatypes.new(@client)
end

#proxiesObject


85
86
87
# File 'lib/zabbixapi.rb', line 85

def proxies
  @proxies ||= Proxies.new(@client)
end

#query(data) ⇒ Object


38
39
40
# File 'lib/zabbixapi.rb', line 38

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

#screensObject


89
90
91
# File 'lib/zabbixapi.rb', line 89

def screens
  @screens ||= Screens.new(@client)
end

#serverObject


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

def server
  @server ||= Server.new(@client)
end

#templatesObject


69
70
71
# File 'lib/zabbixapi.rb', line 69

def templates
  @templates ||= Templates.new(@client)
end

#triggersObject


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

def triggers
  @triggers ||= Triggers.new(@client)
end

#usergroupsObject


93
94
95
# File 'lib/zabbixapi.rb', line 93

def usergroups
  @usergroups ||= Usergroups.new(@client)
end

#usermacrosObject


97
98
99
# File 'lib/zabbixapi.rb', line 97

def usermacros
  @usermacros ||= Usermacros.new(@client)
end

#usersObject


53
54
55
# File 'lib/zabbixapi.rb', line 53

def users
  @users ||= Users.new(@client)
end