Class: ZabbixManager

Inherits:
Object
  • Object
show all
Defined in:
lib/zabbix_manager.rb,
lib/zabbix_manager/client.rb,
lib/zabbix_manager/version.rb,
lib/zabbix_manager/monitoring.rb,
lib/zabbix_manager/classes/hosts.rb,
lib/zabbix_manager/classes/items.rb,
lib/zabbix_manager/classes/roles.rb,
lib/zabbix_manager/classes/users.rb,
lib/zabbix_manager/log_sanitizer.rb,
lib/zabbix_manager/classes/drules.rb,
lib/zabbix_manager/classes/errors.rb,
lib/zabbix_manager/classes/events.rb,
lib/zabbix_manager/classes/graphs.rb,
lib/zabbix_manager/classes/server.rb,
lib/zabbix_manager/http_transport.rb,
lib/zabbix_manager/classes/actions.rb,
lib/zabbix_manager/classes/proxies.rb,
lib/zabbix_manager/classes/screens.rb,
lib/zabbix_manager/classes/scripts.rb,
lib/zabbix_manager/basic/basic_func.rb,
lib/zabbix_manager/basic/basic_init.rb,
lib/zabbix_manager/classes/problems.rb,
lib/zabbix_manager/classes/triggers.rb,
lib/zabbix_manager/basic/basic_alias.rb,
lib/zabbix_manager/basic/basic_logic.rb,
lib/zabbix_manager/classes/httptests.rb,
lib/zabbix_manager/classes/templates.rb,
lib/zabbix_manager/classes/valuemaps.rb,
lib/zabbix_manager/classes/hostgroups.rb,
lib/zabbix_manager/classes/mediatypes.rb,
lib/zabbix_manager/classes/usergroups.rb,
lib/zabbix_manager/classes/usermacros.rb,
lib/zabbix_manager/classes/maintenance.rb,
lib/zabbix_manager/classes/applications.rb,
lib/zabbix_manager/classes/configurations.rb,
lib/zabbix_manager/classes/hostinterfaces.rb

Defined Under Namespace

Modules: LogSanitizer Classes: Actions, ApiError, Applications, Basic, Client, Configurations, Conflict, Drules, Events, Graphs, HostGroups, HostInterfaces, Hosts, HttpTests, HttpTransport, Invalid, Items, Maintenance, Mediatypes, Monitoring, Problems, Proxies, ResultUnknown, Roles, Screens, Scripts, Server, Templates, TransportError, Triggers, Usergroups, Usermacros, Users, ValueMaps

Constant Summary collapse

VERSION =
"5.1.6"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

初始化管理器并创建唯一共享客户端。

Parameters:

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


88
89
90
# File 'lib/zabbix_manager.rb', line 88

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

Instance Attribute Details

#clientZabbixManager::Client (readonly)



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

def client
  @client
end

Class Method Details

.connect(options = {}) ⇒ ZabbixManager

使用页面或服务配置创建管理器实例。

Parameters:

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

Returns:



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

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

.currentZabbixManager

返回进程内默认管理器实例。

Returns:



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

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

Instance Method Details

#actionsZabbixManager::Actions

返回动作模块并复用同一客户端。



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

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

#applicationsZabbixManager::Applications

返回应用模块并复用同一客户端。



100
101
102
# File 'lib/zabbix_manager.rb', line 100

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

#closeObject

关闭持久 HTTP 连接但不改变远端凭据。



80
81
82
# File 'lib/zabbix_manager.rb', line 80

def close
  @client.close
end

#configurationsZabbixManager::Configurations

返回配置导入导出模块并复用同一客户端。



106
107
108
# File 'lib/zabbix_manager.rb', line 106

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

#drulesZabbixManager::Drules

返回网络发现规则模块并复用同一客户端。



238
239
240
# File 'lib/zabbix_manager.rb', line 238

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

#eventsZabbixManager::Events

返回事件模块并复用同一客户端。



112
113
114
# File 'lib/zabbix_manager.rb', line 112

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

#graphsZabbixManager::Graphs

返回图形模块并复用同一客户端。



118
119
120
# File 'lib/zabbix_manager.rb', line 118

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

#hostgroupsZabbixManager::HostGroups

返回主机群组模块并复用同一客户端。



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

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

#hostinterfacesZabbixManager::HostInterfaces

返回主机接口 API 模块,并复用同一客户端会话。



130
131
132
# File 'lib/zabbix_manager.rb', line 130

def hostinterfaces
  @hostinterfaces ||= HostInterfaces.new(@client)
end

#hostsZabbixManager::Hosts

返回主机模块并复用同一客户端。



136
137
138
# File 'lib/zabbix_manager.rb', line 136

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

#httptestsZabbixManager::HttpTests

返回 Web 场景模块并复用同一客户端。



142
143
144
# File 'lib/zabbix_manager.rb', line 142

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

#itemsZabbixManager::Items

返回监控项模块并复用同一客户端。



148
149
150
# File 'lib/zabbix_manager.rb', line 148

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

#logoutBoolean

注销用户名会话并关闭连接。

Returns:

  • (Boolean)


75
76
77
# File 'lib/zabbix_manager.rb', line 75

def logout
  @client.logout
end

#maintenanceZabbixManager::Maintenance

返回维护模块并复用同一客户端。



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

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

#mediatypesZabbixManager::Mediatypes

返回媒介类型模块并复用同一客户端。



160
161
162
# File 'lib/zabbix_manager.rb', line 160

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

#monitoringObject

返回设备、接口和线路监控的幂等业务编排模块。



243
244
245
# File 'lib/zabbix_manager.rb', line 243

def monitoring
  @monitoring ||= Monitoring.new(self)
end

#problemsZabbixManager::Problems

返回问题模块并复用同一客户端。



166
167
168
# File 'lib/zabbix_manager.rb', line 166

def problems
  @problems ||= Problems.new(@client)
end

#proxiesZabbixManager::Proxies

返回代理模块并复用同一客户端。



172
173
174
# File 'lib/zabbix_manager.rb', line 172

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

#query(data) ⇒ Hash

直接执行调用方指定的 Zabbix API 方法。

Parameters:

  • data (Hash)

Returns:

  • (Hash)


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

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

#rolesZabbixManager::Roles

返回角色模块并复用同一客户端。



178
179
180
# File 'lib/zabbix_manager.rb', line 178

def roles
  @roles ||= Roles.new(@client)
end

#screensZabbixManager::Screens

返回聚合图模块并复用同一客户端。



184
185
186
# File 'lib/zabbix_manager.rb', line 184

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

#scriptsZabbixManager::Scripts

返回脚本模块并复用同一客户端。



190
191
192
# File 'lib/zabbix_manager.rb', line 190

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

#serverZabbixManager::Server

返回服务端信息模块并复用同一客户端。



196
197
198
# File 'lib/zabbix_manager.rb', line 196

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

#templatesZabbixManager::Templates

返回模板模块并复用同一客户端。



202
203
204
# File 'lib/zabbix_manager.rb', line 202

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

#triggersZabbixManager::Triggers

返回触发器模块并复用同一客户端。



208
209
210
# File 'lib/zabbix_manager.rb', line 208

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

#usergroupsZabbixManager::Usergroups

返回用户群组模块并复用同一客户端。



214
215
216
# File 'lib/zabbix_manager.rb', line 214

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

#usermacrosZabbixManager::Usermacros

返回用户宏模块并复用同一客户端。



220
221
222
# File 'lib/zabbix_manager.rb', line 220

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

#usersZabbixManager::Users

返回用户模块并复用同一客户端。



226
227
228
# File 'lib/zabbix_manager.rb', line 226

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

#valuemapsZabbixManager::ValueMaps

返回值映射模块并复用同一客户端。



232
233
234
# File 'lib/zabbix_manager.rb', line 232

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