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/drules.rb,
lib/zabbixapi/classes/errors.rb,
lib/zabbixapi/classes/events.rb,
lib/zabbixapi/classes/graphs.rb,
lib/zabbixapi/classes/server.rb,
lib/zabbixapi/classes/actions.rb,
lib/zabbixapi/classes/proxies.rb,
lib/zabbixapi/classes/screens.rb,
lib/zabbixapi/classes/scripts.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/httptests.rb,
lib/zabbixapi/classes/templates.rb,
lib/zabbixapi/classes/valuemaps.rb,
lib/zabbixapi/classes/hostgroups.rb,
lib/zabbixapi/classes/mediatypes.rb,
lib/zabbixapi/classes/usergroups.rb,
lib/zabbixapi/classes/usermacros.rb,
lib/zabbixapi/classes/maintenance.rb,
lib/zabbixapi/classes/applications.rb,
lib/zabbixapi/classes/configurations.rb

Defined Under Namespace

Classes: Actions, ApiError, Applications, BaseError, Basic, Client, Configurations, Drules, Events, Graphs, HostGroups, Hosts, HttpError, HttpTests, Items, Maintenance, Mediatypes, Proxies, Screens, Scripts, Server, Templates, Triggers, Usergroups, Usermacros, Users, ValueMaps

Constant Summary collapse

VERSION =
'4.2.0'.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ZabbixApi::Client

Initializes a new ZabbixApi object

Parameters:

  • options (Hash) (defaults to: {})

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

def initialize(options = {})
  @client = Client.new(options)
end

Instance Attribute Details

#clientZabbixApi::Client (readonly)

Returns:


36
37
38
# File 'lib/zabbixapi.rb', line 36

def client
  @client
end

Class Method Details

.connect(options = {}) ⇒ ZabbixApi

Initializes a new ZabbixApi object

Parameters:

  • options (Hash) (defaults to: {})

Returns:


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

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

.currentZabbixApi

Returns:


47
48
49
# File 'lib/zabbixapi.rb', line 47

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

Instance Method Details

#actionsZabbixApi::Actions

Returns:


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

def actions
  @actions ||= Actions.new(@client)
end

#applicationsZabbixApi::Applications


79
80
81
# File 'lib/zabbixapi.rb', line 79

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

#configurationsZabbixApi::Configurations


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

def configurations
  @configurations ||= Configurations.new(@client)
end

#drulesZabbixApi::Drules

Returns:


179
180
181
# File 'lib/zabbixapi.rb', line 179

def drules
  @drules ||= Drules.new(@client)
end

#eventsZabbixApi::Events

Returns:


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

def events
  @events ||= Events.new(@client)
end

#graphsZabbixApi::Graphs

Returns:


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

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

#hostgroupsZabbixApi::HostGroups


99
100
101
# File 'lib/zabbixapi.rb', line 99

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

#hostsZabbixApi::Hosts

Returns:


104
105
106
# File 'lib/zabbixapi.rb', line 104

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

#httptestsZabbixApi::HttpTests


109
110
111
# File 'lib/zabbixapi.rb', line 109

def httptests
  @httptests ||= HttpTests.new(@client)
end

#itemsZabbixApi::Items

Returns:


114
115
116
# File 'lib/zabbixapi.rb', line 114

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

#logoutBoolean

Invalidate current authentication token

Returns:

  • (Boolean)

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

def logout
  @client.logout
end

#maintenanceZabbixApi::Maintenance


119
120
121
# File 'lib/zabbixapi.rb', line 119

def maintenance
  @maintenance ||= Maintenance.new(@client)
end

#mediatypesZabbixApi::Mediatypes


124
125
126
# File 'lib/zabbixapi.rb', line 124

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

#proxiesZabbixApi::Proxies

Returns:


129
130
131
# File 'lib/zabbixapi.rb', line 129

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

#query(data) ⇒ Hash

Executes an API request directly using a custom query

Parameters:

  • data (Hash)

Returns:

  • (Hash)

55
56
57
# File 'lib/zabbixapi.rb', line 55

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

#screensZabbixApi::Screens

Returns:


134
135
136
# File 'lib/zabbixapi.rb', line 134

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

#scriptsZabbixApi::Scripts

Returns:


139
140
141
# File 'lib/zabbixapi.rb', line 139

def scripts
  @scripts ||= Scripts.new(@client)
end

#serverZabbixApi::Server

Returns:


144
145
146
# File 'lib/zabbixapi.rb', line 144

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

#templatesZabbixApi::Templates


149
150
151
# File 'lib/zabbixapi.rb', line 149

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

#triggersZabbixApi::Triggers

Returns:


154
155
156
# File 'lib/zabbixapi.rb', line 154

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

#usergroupsZabbixApi::Usergroups


159
160
161
# File 'lib/zabbixapi.rb', line 159

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

#usermacrosZabbixApi::Usermacros


164
165
166
# File 'lib/zabbixapi.rb', line 164

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

#usersZabbixApi::Users

Returns:


169
170
171
# File 'lib/zabbixapi.rb', line 169

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

#valuemapsZabbixApi::ValueMaps


174
175
176
# File 'lib/zabbixapi.rb', line 174

def valuemaps
  @valuemaps ||= ValueMaps.new(@client)
end