zabbix_manager 5.1.2.pre.alpha2 → 5.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/zabbix_manager/basic/basic_alias.rb +3 -20
- data/lib/zabbix_manager/basic/basic_func.rb +24 -46
- data/lib/zabbix_manager/basic/basic_init.rb +8 -24
- data/lib/zabbix_manager/basic/basic_logic.rb +67 -105
- data/lib/zabbix_manager/classes/actions.rb +11 -21
- data/lib/zabbix_manager/classes/applications.rb +5 -19
- data/lib/zabbix_manager/classes/configurations.rb +5 -19
- data/lib/zabbix_manager/classes/drules.rb +6 -22
- data/lib/zabbix_manager/classes/errors.rb +19 -9
- data/lib/zabbix_manager/classes/events.rb +2 -6
- data/lib/zabbix_manager/classes/graphs.rb +16 -47
- data/lib/zabbix_manager/classes/hostgroups.rb +3 -9
- data/lib/zabbix_manager/classes/hostinterfaces.rb +12 -9
- data/lib/zabbix_manager/classes/hosts.rb +57 -55
- data/lib/zabbix_manager/classes/httptests.rb +7 -23
- data/lib/zabbix_manager/classes/items.rb +12 -68
- data/lib/zabbix_manager/classes/maintenance.rb +2 -6
- data/lib/zabbix_manager/classes/mediatypes.rb +20 -52
- data/lib/zabbix_manager/classes/problems.rb +38 -66
- data/lib/zabbix_manager/classes/proxies.rb +7 -26
- data/lib/zabbix_manager/classes/roles.rb +18 -57
- data/lib/zabbix_manager/classes/screens.rb +7 -21
- data/lib/zabbix_manager/classes/scripts.rb +7 -10
- data/lib/zabbix_manager/classes/server.rb +1 -6
- data/lib/zabbix_manager/classes/templates.rb +15 -49
- data/lib/zabbix_manager/classes/triggers.rb +16 -52
- data/lib/zabbix_manager/classes/unusable.rb +2 -1
- data/lib/zabbix_manager/classes/usergroups.rb +6 -28
- data/lib/zabbix_manager/classes/usermacros.rb +19 -113
- data/lib/zabbix_manager/classes/users.rb +7 -34
- data/lib/zabbix_manager/classes/valuemaps.rb +5 -26
- data/lib/zabbix_manager/client.rb +65 -69
- data/lib/zabbix_manager/version.rb +1 -2
- data/lib/zabbix_manager.rb +41 -84
- metadata +5 -5
@@ -4,46 +4,34 @@ require "net/http"
|
|
4
4
|
require "json"
|
5
5
|
require "openssl"
|
6
6
|
|
7
|
-
# @author: WENWU YAN
|
8
|
-
# @email: 968828@gmail.com
|
9
|
-
# @date: 2023/3/25下午4:47
|
10
7
|
class ZabbixManager
|
11
8
|
class Client
|
12
|
-
#
|
13
|
-
# @return [Hash]
|
9
|
+
# 用于读取配置选项
|
14
10
|
attr_reader :options
|
15
11
|
|
16
|
-
#
|
12
|
+
# 生成一个随机的请求标识符
|
17
13
|
def id
|
18
|
-
@id ||= rand
|
14
|
+
@id ||= rand 100_00
|
19
15
|
end
|
20
16
|
|
21
|
-
#
|
22
|
-
# @note 获取 zabbix api 版本
|
23
|
-
# @return [String, Hash]
|
17
|
+
# 获取 Zabbix API 版本
|
24
18
|
def api_version
|
25
19
|
api_request(method: "apiinfo.version", params: {})
|
26
20
|
end
|
27
21
|
|
28
|
-
#
|
29
|
-
# @note 是否启用 debug 模式
|
30
|
-
# @return [boolean]
|
22
|
+
# 是否启用 debug 模式
|
31
23
|
def debug?
|
32
24
|
!@options || @options[:debug]
|
33
25
|
end
|
34
26
|
|
35
|
-
#
|
36
|
-
# @note debug 打印信息
|
37
|
-
# @param message [String]
|
27
|
+
# Debug 打印信息
|
38
28
|
def log(message)
|
39
29
|
puts message if debug?
|
40
30
|
end
|
41
31
|
|
42
|
-
#
|
43
|
-
# @note 用户鉴权,登录成功即可获取令牌
|
44
|
-
# @raise [ZbxError] Error returned when there is a problem with the Zabbix API call.
|
45
|
-
# @return [Hash, String]
|
32
|
+
# 用户鉴权方法,登录成功即可获取令牌
|
46
33
|
def auth
|
34
|
+
# 发起 "user.login" 方法的 API 请求, 并传递用户信息(用户名和密码)作为参数
|
47
35
|
api_request(
|
48
36
|
method: "user.login",
|
49
37
|
params: {
|
@@ -53,25 +41,17 @@ class ZabbixManager
|
|
53
41
|
)
|
54
42
|
end
|
55
43
|
|
56
|
-
#
|
57
|
-
# @see 实例化 HTTP 客户端,同时进行用户权限签证
|
58
|
-
# @param options [Hash]
|
59
|
-
# @option opts [String] :url The url of zabbix
|
60
|
-
# @example 'http://zabbix.com/api_jsonrpc.php'
|
61
|
-
# @see 'https://www.zabbix.com/documentation/current/en/manual/api/reference'
|
62
|
-
# @option opts [String] :user A user for api auth.(required)
|
63
|
-
# @option opts [String] :password A password for api auth.(required)
|
64
|
-
# @option opts [String] :http_user A user for basic auth.(optional)
|
65
|
-
# @option opts [String] :http_password A password for basic auth.(optional)
|
66
|
-
# @option opts [Integer] :timeout Set timeout for requests in seconds.(default: 60)
|
67
|
-
# @raise [ZbxError] Error raised when api_version not support.
|
68
|
-
# @return [ZabbixManager::Client]
|
44
|
+
# HTTP 客户端初始化方法,同时进行用户权限签证
|
69
45
|
def initialize(options = {})
|
46
|
+
# 设置实例变量 @options 以便在整个类中访问
|
70
47
|
@options = options
|
71
|
-
raise ZabbixManager::ZbxError, "Missing required argument: :url" unless @options.key?(:url)
|
72
|
-
raise ZabbixManager::ZbxError, "Missing required argument: :user" unless @options.key?(:user)
|
73
|
-
raise ZabbixManager::ZbxError, "Missing required argument: :password" unless @options.key?(:password)
|
74
48
|
|
49
|
+
# 检查必要的配置属性是否存在
|
50
|
+
raise ZbxError, "必须正确提供 :url 属性" unless @options.key?(:url)
|
51
|
+
raise ZbxError, "必须正确提供 :user 属性" unless @options.key?(:user)
|
52
|
+
raise ZbxError, "必须正确提供 :password 属性" unless @options.key?(:password)
|
53
|
+
|
54
|
+
# 配置代理信息
|
75
55
|
if !ENV["http_proxy"].nil? && options[:no_proxy] != true
|
76
56
|
@proxy_uri = URI.parse(ENV["http_proxy"])
|
77
57
|
@proxy_host = @proxy_uri.host
|
@@ -79,24 +59,24 @@ class ZabbixManager
|
|
79
59
|
@proxy_user, @proxy_pass = @proxy_uri.userinfo&.split(/:/) if @proxy_uri.userinfo
|
80
60
|
end
|
81
61
|
|
82
|
-
|
83
|
-
|
62
|
+
# 检查 Zabbix API 版本是否受支持
|
63
|
+
unless api_version.match?(/^(234567)\.\d+\.\d+$/)
|
64
|
+
message = "Zabbix API版本:#{api_version} 不受此版本的 zabbix_manager 支持"
|
84
65
|
if @options[:ignore_version]
|
85
66
|
log "[WARNING] #{message}"
|
86
67
|
else
|
87
|
-
raise
|
68
|
+
raise ZbxError, message
|
88
69
|
end
|
89
70
|
end
|
90
71
|
|
72
|
+
# 进行用户鉴权,获取令牌
|
91
73
|
@auth_hash = auth
|
92
74
|
log "[DEBUG] Auth token: #{@auth_hash}"
|
93
75
|
end
|
94
76
|
|
95
|
-
#
|
96
|
-
# @note 将 ruby 数据结构转换为 json 字符串,除用户登录和获取API版本外均添加令牌
|
97
|
-
# @param body [Hash]
|
98
|
-
# @return [String]
|
77
|
+
# 定义一个方法,用于将 Ruby 数据结构转换为 JSON 字符串,并根据条件添加令牌
|
99
78
|
def json_payload(body)
|
79
|
+
# 构建基本的 JSON 负载,包括方法名、参数、请求 ID 和 JSON-RPC 版本
|
100
80
|
payload = {
|
101
81
|
method: body[:method],
|
102
82
|
params: body[:params],
|
@@ -104,24 +84,22 @@ class ZabbixManager
|
|
104
84
|
jsonrpc: "2.0"
|
105
85
|
}
|
106
86
|
|
87
|
+
# 检查请求方法是否是 "apiinfo.version" 或 "user.login",如果不是,则添加令牌信息
|
107
88
|
payload[:auth] = @auth_hash unless body[:method] == "apiinfo.version" || body[:method] == "user.login"
|
108
89
|
|
90
|
+
# 将构建好的负载转换为 JSON 字符串并返回
|
109
91
|
JSON(payload)
|
110
92
|
end
|
111
93
|
|
112
|
-
# HTTP
|
113
|
-
# @note 实例化 Net::HTTP 对象,并发起 api 请求
|
114
|
-
# @param body [String]
|
115
|
-
# @raise [ZbxError] Error returned when there is a problem with the Zabbix API call.
|
116
|
-
# @raise [HttpError] Error raised when HTTP status from Zabbix Server response is not a 200 OK.
|
117
|
-
# @return [String]
|
94
|
+
# 实例化 Net::HTTP 对象,并发起 API 请求的方法
|
118
95
|
def http_request(body)
|
119
96
|
uri = URI.parse(@options[:url])
|
120
97
|
|
121
|
-
#
|
98
|
+
# 设置超时时间,默认为 60 秒
|
122
99
|
timeout = @options[:timeout].nil? ? 60 : @options[:timeout]
|
123
100
|
log "[DEBUG] Timeout for request set to #{timeout} seconds"
|
124
101
|
|
102
|
+
# 创建 Net::HTTP 对象,支持代理设置
|
125
103
|
http =
|
126
104
|
if @proxy_uri
|
127
105
|
Net::HTTP.Proxy(@proxy_host, @proxy_port, @proxy_user, @proxy_pass).new(uri.host, uri.port)
|
@@ -129,64 +107,82 @@ class ZabbixManager
|
|
129
107
|
Net::HTTP.new(uri.host, uri.port)
|
130
108
|
end
|
131
109
|
|
110
|
+
# 配置 HTTPS 请求
|
132
111
|
if uri.scheme == "https"
|
133
112
|
http.use_ssl = true
|
134
113
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
135
114
|
end
|
136
115
|
|
116
|
+
# 配置请求超时时间
|
137
117
|
http.open_timeout = timeout
|
138
118
|
http.read_timeout = timeout
|
139
119
|
|
120
|
+
# 创建 POST 请求
|
140
121
|
request = Net::HTTP::Post.new(uri.request_uri)
|
141
|
-
|
122
|
+
|
123
|
+
# 添加基本身份验证信息(如果提供了用户名和密码)
|
124
|
+
request.basic_auth(@options[:http_user], @options[:http_password]) if @options[:http_user]
|
125
|
+
|
126
|
+
# 设置请求头的 Content-Type 为 application/json-rpc
|
142
127
|
request.add_field("Content-Type", "application/json-rpc")
|
128
|
+
|
129
|
+
# 设置请求体为传入的 JSON 字符串
|
143
130
|
request.body = body
|
144
131
|
log "[DEBUG] HTTP request params: #{pretty_body(request.body)}"
|
145
132
|
|
133
|
+
# 发起请求并获取响应
|
146
134
|
response = http.request(request)
|
135
|
+
|
136
|
+
# 检查响应状态码,如果不是 200,则抛出 HttpError 异常
|
147
137
|
raise HttpError.new("HTTP Error: #{response.code} on #{@options[:url]}", response) unless response.code == "200"
|
148
138
|
|
149
139
|
log "[DEBUG] HTTP response answer: #{pretty_body(response.body)}"
|
140
|
+
|
141
|
+
# 返回响应体
|
150
142
|
response.body
|
151
143
|
end
|
152
144
|
|
153
|
-
#
|
154
|
-
# @note 发起 api 调用并对响应结果进行解析,如接口报错则抛出异常
|
155
|
-
# @@note 返回的数据为基于字符串索引,需要自行适配为符号索引
|
156
|
-
# @param body [String]
|
157
|
-
# @raise [ZbxError] Error returned when there is a problem with the Zabbix API call.
|
158
|
-
# @return [Hash, String]
|
145
|
+
# 对 API 响应结果进行解析的方法
|
159
146
|
def _request(body)
|
147
|
+
# 发起 HTTP 请求并解析 JSON 格式的响应
|
160
148
|
result = JSON.parse(http_request(body))
|
149
|
+
|
150
|
+
# 如果响应结果中包含错误信息,则抛出 ZbxError 异常
|
161
151
|
if result["error"]
|
162
|
-
|
163
|
-
|
164
|
-
|
152
|
+
# 构建错误消息,包括服务器返回的错误信息和请求的详细信息
|
153
|
+
msg = <<~MOJO
|
154
|
+
---------------------------------------------------------------
|
155
|
+
Server answer API error: #{JSON.pretty_unparse(result["error"])}
|
156
|
+
on request: #{pretty_body(body)}
|
157
|
+
---------------------------------------------------------------
|
158
|
+
MOJO
|
159
|
+
|
160
|
+
# 抛出自定义异常 ZbxError,并传递错误消息和完整的响应结果
|
161
|
+
raise ZbxError.new(msg, result)
|
165
162
|
else
|
163
|
+
# 如果没有错误信息,则返回响应结果中的 "result" 部分
|
166
164
|
result["result"]
|
167
165
|
end
|
168
166
|
end
|
169
167
|
|
170
|
-
#
|
171
|
-
# @note 将 ruby 数据结构美化成 json 字符串后打印输出
|
172
|
-
# @param body [String]
|
173
|
-
# @return [Hash, String]
|
168
|
+
# 将 Ruby 数据结构美化成 JSON 字符串后打印输出的方法
|
174
169
|
def pretty_body(body)
|
170
|
+
# 解析 JSON 字符串
|
175
171
|
data = JSON.parse(body)
|
176
172
|
|
177
|
-
#
|
173
|
+
# 如果参数中包含密码字段,则将密码字段的值替换为 "***"
|
178
174
|
if data["params"].is_a?(Hash) && data["params"].key?("password")
|
179
175
|
data["params"]["password"] = "***"
|
180
176
|
end
|
181
177
|
|
178
|
+
# 将美化后的数据转换为 JSON 字符串并返回
|
182
179
|
JSON.pretty_unparse(data)
|
183
180
|
end
|
184
181
|
|
185
|
-
#
|
186
|
-
# @note 通用的 api 调用发起方法
|
187
|
-
# @param body [Hash]
|
188
|
-
# @return [Hash, String]
|
182
|
+
# 通用的 API 调用发起方法
|
189
183
|
def api_request(body)
|
184
|
+
# 调用之前定义的 json_payload 方法,将请求信息转换为 JSON 字符串
|
185
|
+
# 然后调用之前定义的 _request 方法,发起 API 请求并解析响应结果
|
190
186
|
_request json_payload(body)
|
191
187
|
end
|
192
188
|
end
|
data/lib/zabbix_manager.rb
CHANGED
@@ -3,208 +3,165 @@
|
|
3
3
|
require "zabbix_manager/version"
|
4
4
|
require "zabbix_manager/client"
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
require
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
require
|
14
|
-
|
15
|
-
|
16
|
-
require "zabbix_manager/classes/graphs"
|
17
|
-
require "zabbix_manager/classes/hostgroups"
|
18
|
-
require "zabbix_manager/classes/hosts"
|
19
|
-
require "zabbix_manager/classes/httptests"
|
20
|
-
require "zabbix_manager/classes/items"
|
21
|
-
require "zabbix_manager/classes/maintenance"
|
22
|
-
require "zabbix_manager/classes/mediatypes"
|
23
|
-
require "zabbix_manager/classes/proxies"
|
24
|
-
require "zabbix_manager/classes/problems"
|
25
|
-
require "zabbix_manager/classes/roles"
|
26
|
-
require "zabbix_manager/classes/screens"
|
27
|
-
require "zabbix_manager/classes/scripts"
|
28
|
-
require "zabbix_manager/classes/server"
|
29
|
-
require "zabbix_manager/classes/templates"
|
30
|
-
require "zabbix_manager/classes/triggers"
|
31
|
-
require "zabbix_manager/classes/unusable"
|
32
|
-
require "zabbix_manager/classes/usergroups"
|
33
|
-
require "zabbix_manager/classes/usermacros"
|
34
|
-
require "zabbix_manager/classes/users"
|
35
|
-
require "zabbix_manager/classes/valuemaps"
|
36
|
-
require "zabbix_manager/classes/drules"
|
37
|
-
|
38
|
-
# Dynamically load Ruby modules
|
39
|
-
# Dir.glob(File.join(__dir__, "zabbix_manager", "**", "*.rb")).sort.each do |module_rb|
|
40
|
-
# require module_rb
|
41
|
-
# end
|
42
|
-
|
43
|
-
# @author: WENWU YAN
|
44
|
-
# @email: 968828@gmail.com
|
45
|
-
# @date: 2023/3/25下午4:47
|
6
|
+
# 动态加载基础类
|
7
|
+
Dir.glob(File.join(__dir__, "zabbix_manager/basic", "**", "*.rb")).sort.each do |basic_class|
|
8
|
+
require basic_class
|
9
|
+
end
|
10
|
+
|
11
|
+
# 动态加载扩展类
|
12
|
+
Dir.glob(File.join(__dir__, "zabbix_manager/classes", "**", "*.rb")).sort.each do |extend_class|
|
13
|
+
require extend_class
|
14
|
+
end
|
15
|
+
|
46
16
|
class ZabbixManager
|
47
|
-
# @return [ZabbixManager::Client]
|
48
17
|
attr_reader :client
|
49
18
|
|
50
|
-
#
|
51
|
-
#
|
52
|
-
# @param options [Hash]
|
53
|
-
# @return [ZabbixManager]
|
19
|
+
# 初始化一个新的 ZabbixManager 对象
|
54
20
|
def self.connect(options = {})
|
55
21
|
new(options)
|
56
22
|
end
|
57
23
|
|
58
|
-
#
|
59
|
-
# @return [ZabbixManager]
|
24
|
+
# 获取当前 ZabbixManager 对象
|
60
25
|
def self.current
|
61
|
-
@current ||=
|
26
|
+
@current ||= new
|
62
27
|
end
|
63
28
|
|
64
|
-
#
|
65
|
-
# @note 通用的查询方法,自行提供 method 和 params
|
66
|
-
# @param data [Hash]
|
67
|
-
# @return [Hash, String]
|
29
|
+
# 直接使用自定义查询执行 API 请求
|
68
30
|
def query(data)
|
69
31
|
@client.api_request(method: data[:method], params: data[:params])
|
70
32
|
end
|
71
33
|
|
72
|
-
#
|
73
|
-
# @note TODO
|
74
|
-
# @return [Boolean]
|
34
|
+
# 注销当前身份验证令牌
|
75
35
|
def logout
|
76
36
|
@client.logout
|
77
37
|
end
|
78
38
|
|
79
|
-
#
|
80
|
-
# @note 实例化 ZabbixManager 对象,Client.new 进行参数检查
|
81
|
-
# @param options [Hash]
|
82
|
-
# @return [ZabbixManager::Client]
|
39
|
+
# 初始化一个新的 ZabbixManager 对象
|
83
40
|
def initialize(options = {})
|
84
41
|
@client = Client.new(options)
|
85
42
|
end
|
86
43
|
|
87
|
-
#
|
44
|
+
# 返回 ZabbixManager::Actions 对象
|
88
45
|
def actions
|
89
46
|
@actions ||= Actions.new(@client)
|
90
47
|
end
|
91
48
|
|
92
|
-
#
|
49
|
+
# 返回 ZabbixManager::Applications 对象
|
93
50
|
def applications
|
94
51
|
@applications ||= Applications.new(@client)
|
95
52
|
end
|
96
53
|
|
97
|
-
#
|
54
|
+
# 返回 ZabbixManager::Configurations 对象
|
98
55
|
def configurations
|
99
56
|
@configurations ||= Configurations.new(@client)
|
100
57
|
end
|
101
58
|
|
102
|
-
#
|
59
|
+
# 返回 ZabbixManager::Events 对象
|
103
60
|
def events
|
104
61
|
@events ||= Events.new(@client)
|
105
62
|
end
|
106
63
|
|
107
|
-
#
|
64
|
+
# 返回 ZabbixManager::Graphs 对象
|
108
65
|
def graphs
|
109
66
|
@graphs ||= Graphs.new(@client)
|
110
67
|
end
|
111
68
|
|
112
|
-
#
|
69
|
+
# 返回 ZabbixManager::HostGroups 对象
|
113
70
|
def hostgroups
|
114
71
|
@hostgroups ||= HostGroups.new(@client)
|
115
72
|
end
|
116
73
|
|
117
|
-
#
|
74
|
+
# 返回 ZabbixManager::HostInterfaces 对象
|
118
75
|
def hostinterfaces
|
119
76
|
@hostinterfaces ||= HostInterfaces.new(@client)
|
120
77
|
end
|
121
78
|
|
122
|
-
#
|
79
|
+
# 返回 ZabbixManager::Hosts 对象
|
123
80
|
def hosts
|
124
81
|
@hosts ||= Hosts.new(@client)
|
125
82
|
end
|
126
83
|
|
127
|
-
#
|
84
|
+
# 返回 ZabbixManager::HttpTests 对象
|
128
85
|
def httptests
|
129
86
|
@httptests ||= HttpTests.new(@client)
|
130
87
|
end
|
131
88
|
|
132
|
-
#
|
89
|
+
# 返回 ZabbixManager::Items 对象
|
133
90
|
def items
|
134
91
|
@items ||= Items.new(@client)
|
135
92
|
end
|
136
93
|
|
137
|
-
#
|
94
|
+
# 返回 ZabbixManager::Maintenance 对象
|
138
95
|
def maintenance
|
139
96
|
@maintenance ||= Maintenance.new(@client)
|
140
97
|
end
|
141
98
|
|
142
|
-
#
|
99
|
+
# 返回 ZabbixManager::Mediatypes 对象
|
143
100
|
def mediatypes
|
144
101
|
@mediatypes ||= Mediatypes.new(@client)
|
145
102
|
end
|
146
103
|
|
147
|
-
#
|
104
|
+
# 返回 ZabbixManager::Problems 对象
|
148
105
|
def problems
|
149
106
|
@problems ||= Problems.new(@client)
|
150
107
|
end
|
151
108
|
|
152
|
-
#
|
109
|
+
# 返回 ZabbixManager::Proxies 对象
|
153
110
|
def proxies
|
154
111
|
@proxies ||= Proxies.new(@client)
|
155
112
|
end
|
156
113
|
|
157
|
-
#
|
114
|
+
# 返回 ZabbixManager::Roles 对象
|
158
115
|
def roles
|
159
116
|
@roles ||= Roles.new(@client)
|
160
117
|
end
|
161
118
|
|
162
|
-
#
|
119
|
+
# 返回 ZabbixManager::Screens 对象
|
163
120
|
def screens
|
164
121
|
@screens ||= Screens.new(@client)
|
165
122
|
end
|
166
123
|
|
167
|
-
#
|
124
|
+
# 返回 ZabbixManager::Scripts 对象
|
168
125
|
def scripts
|
169
126
|
@scripts ||= Scripts.new(@client)
|
170
127
|
end
|
171
128
|
|
172
|
-
#
|
129
|
+
# 返回 ZabbixManager::Server 对象
|
173
130
|
def server
|
174
131
|
@server ||= Server.new(@client)
|
175
132
|
end
|
176
133
|
|
177
|
-
#
|
134
|
+
# 返回 ZabbixManager::Templates 对象
|
178
135
|
def templates
|
179
136
|
@templates ||= Templates.new(@client)
|
180
137
|
end
|
181
138
|
|
182
|
-
#
|
139
|
+
# 返回 ZabbixManager::Triggers 对象
|
183
140
|
def triggers
|
184
141
|
@triggers ||= Triggers.new(@client)
|
185
142
|
end
|
186
143
|
|
187
|
-
#
|
144
|
+
# 返回 ZabbixManager::Usergroups 对象
|
188
145
|
def usergroups
|
189
146
|
@usergroups ||= Usergroups.new(@client)
|
190
147
|
end
|
191
148
|
|
192
|
-
#
|
149
|
+
# 返回 ZabbixManager::Usermacros 对象
|
193
150
|
def usermacros
|
194
151
|
@usermacros ||= Usermacros.new(@client)
|
195
152
|
end
|
196
153
|
|
197
|
-
#
|
154
|
+
# 返回 ZabbixManager::Users 对象
|
198
155
|
def users
|
199
156
|
@users ||= Users.new(@client)
|
200
157
|
end
|
201
158
|
|
202
|
-
#
|
159
|
+
# 返回 ZabbixManager::ValueMaps 对象
|
203
160
|
def valuemaps
|
204
161
|
@valuemaps ||= ValueMaps.new(@client)
|
205
162
|
end
|
206
163
|
|
207
|
-
#
|
164
|
+
# 返回 ZabbixManager::Drules 对象
|
208
165
|
def drules
|
209
166
|
@drules ||= Drules.new(@client)
|
210
167
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zabbix_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.1.
|
4
|
+
version: 5.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- WENWU YAN
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -116,11 +116,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
116
116
|
version: 2.7.0
|
117
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
118
|
requirements:
|
119
|
-
- - "
|
119
|
+
- - ">="
|
120
120
|
- !ruby/object:Gem::Version
|
121
|
-
version:
|
121
|
+
version: '0'
|
122
122
|
requirements: []
|
123
|
-
rubygems_version: 3.4.
|
123
|
+
rubygems_version: 3.4.10
|
124
124
|
signing_key:
|
125
125
|
specification_version: 4
|
126
126
|
summary: Common code for Zabbix API clients
|