zabbix_manager 5.1.3 → 5.1.5
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 +66 -104
- 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 +18 -49
- data/lib/zabbix_manager/classes/hostgroups.rb +3 -9
- data/lib/zabbix_manager/classes/hostinterfaces.rb +7 -15
- data/lib/zabbix_manager/classes/hosts.rb +62 -77
- data/lib/zabbix_manager/classes/httptests.rb +8 -24
- data/lib/zabbix_manager/classes/items.rb +19 -78
- 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 +15 -49
- 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 +66 -69
- data/lib/zabbix_manager/version.rb +1 -2
- data/lib/zabbix_manager.rb +33 -46
- metadata +3 -3
@@ -2,35 +2,19 @@
|
|
2
2
|
|
3
3
|
class ZabbixManager
|
4
4
|
class ValueMaps < Basic
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# @return [String]
|
5
|
+
# 用于通过 Zabbix API 与 ValueMaps 交互的方法名称
|
8
6
|
def method_name
|
9
7
|
"valuemap"
|
10
8
|
end
|
11
9
|
|
12
|
-
#
|
13
|
-
#
|
14
|
-
# @return [String]
|
15
|
-
def key
|
16
|
-
"valuemapid"
|
17
|
-
end
|
18
|
-
|
19
|
-
# The id field name used for identifying specific ValueMap objects via Zabbix API
|
20
|
-
#
|
21
|
-
# @return [String]
|
10
|
+
# 用于通过 Zabbix API 识别特定 ValueMap 对象的 id 字段名称
|
22
11
|
def identify
|
23
12
|
"name"
|
24
13
|
end
|
25
14
|
|
26
|
-
#
|
27
|
-
#
|
28
|
-
# @param data [Hash] Needs to include valuemapids [List] to properly identify ValueMaps via Zabbix API
|
29
|
-
# @raise [ZbxError] Error returned when there is a problem with the Zabbix API call.
|
30
|
-
# @raise [HttpError] Error raised when HTTP status from Zabbix Server response is not a 200 OK.
|
31
|
-
# @return [Integer, TrueClass, FalseClass] Zabbix object id
|
15
|
+
# 通过 Zabbix API 获取或创建 ValueMap 对象
|
32
16
|
def get_or_create(data)
|
33
|
-
log "[DEBUG]
|
17
|
+
log "[DEBUG] 调用 get_or_create 方法,参数: #{data.inspect}"
|
34
18
|
|
35
19
|
if (id = get_id(valuemapids: data[:valuemapids]))
|
36
20
|
id
|
@@ -39,12 +23,7 @@ class ZabbixManager
|
|
39
23
|
end
|
40
24
|
end
|
41
25
|
|
42
|
-
#
|
43
|
-
#
|
44
|
-
# @param data [Hash] Needs to include valuemapids to properly identify ValueMaps via Zabbix API
|
45
|
-
# @raise [ZbxError] Error returned when there is a problem with the Zabbix API call.
|
46
|
-
# @raise [HttpError] Error raised when HTTP status from Zabbix Server response is not a 200 OK.
|
47
|
-
# @return [Integer, TrueClass, FalseClass] Zabbix object id
|
26
|
+
# 通过 Zabbix API 创建或更新 Item 对象
|
48
27
|
def create_or_update(data)
|
49
28
|
valuemapid = get_id(name: data[:name])
|
50
29
|
valuemapid ? update(data.merge(valuemapids: [:valuemapid])) : create(data)
|
@@ -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?(/^[4-7]\.\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,83 @@ 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
|
+
---------------------------------------------------------------
|
156
|
+
Server answer API error: #{JSON.pretty_unparse(result["error"])}
|
157
|
+
on request: #{pretty_body(body)}
|
158
|
+
---------------------------------------------------------------
|
159
|
+
|
160
|
+
MOJO
|
161
|
+
|
162
|
+
# 抛出自定义异常 ZbxError,并传递错误消息和完整的响应结果
|
163
|
+
raise ZbxError.new(msg, result)
|
165
164
|
else
|
165
|
+
# 如果没有错误信息,则返回响应结果中的 "result" 部分
|
166
166
|
result["result"]
|
167
167
|
end
|
168
168
|
end
|
169
169
|
|
170
|
-
#
|
171
|
-
# @note 将 ruby 数据结构美化成 json 字符串后打印输出
|
172
|
-
# @param body [String]
|
173
|
-
# @return [Hash, String]
|
170
|
+
# 将 Ruby 数据结构美化成 JSON 字符串后打印输出的方法
|
174
171
|
def pretty_body(body)
|
172
|
+
# 解析 JSON 字符串
|
175
173
|
data = JSON.parse(body)
|
176
174
|
|
177
|
-
#
|
175
|
+
# 如果参数中包含密码字段,则将密码字段的值替换为 "***"
|
178
176
|
if data["params"].is_a?(Hash) && data["params"].key?("password")
|
179
177
|
data["params"]["password"] = "***"
|
180
178
|
end
|
181
179
|
|
180
|
+
# 将美化后的数据转换为 JSON 字符串并返回
|
182
181
|
JSON.pretty_unparse(data)
|
183
182
|
end
|
184
183
|
|
185
|
-
#
|
186
|
-
# @note 通用的 api 调用发起方法
|
187
|
-
# @param body [Hash]
|
188
|
-
# @return [Hash, String]
|
184
|
+
# 通用的 API 调用发起方法
|
189
185
|
def api_request(body)
|
186
|
+
# 调用之前定义的 json_payload 方法,将请求信息转换为 JSON 字符串
|
190
187
|
_request json_payload(body)
|
191
188
|
end
|
192
189
|
end
|
data/lib/zabbix_manager.rb
CHANGED
@@ -3,178 +3,165 @@
|
|
3
3
|
require "zabbix_manager/version"
|
4
4
|
require "zabbix_manager/client"
|
5
5
|
|
6
|
-
#
|
6
|
+
# 动态加载基础类
|
7
7
|
Dir.glob(File.join(__dir__, "zabbix_manager/basic", "**", "*.rb")).sort.each do |basic_class|
|
8
8
|
require basic_class
|
9
9
|
end
|
10
10
|
|
11
|
-
#
|
11
|
+
# 动态加载扩展类
|
12
12
|
Dir.glob(File.join(__dir__, "zabbix_manager/classes", "**", "*.rb")).sort.each do |extend_class|
|
13
13
|
require extend_class
|
14
14
|
end
|
15
15
|
|
16
16
|
class ZabbixManager
|
17
|
-
# @return [ZabbixManager::Client]
|
18
17
|
attr_reader :client
|
19
18
|
|
20
|
-
#
|
21
|
-
#
|
22
|
-
# @param options [Hash]
|
23
|
-
# @return [ZabbixManager]
|
19
|
+
# 初始化一个新的 ZabbixManager 对象
|
24
20
|
def self.connect(options = {})
|
25
21
|
new(options)
|
26
22
|
end
|
27
23
|
|
28
|
-
#
|
29
|
-
# @return [ZabbixManager]
|
24
|
+
# 获取当前 ZabbixManager 对象
|
30
25
|
def self.current
|
31
|
-
@current ||=
|
26
|
+
@current ||= new
|
32
27
|
end
|
33
28
|
|
34
|
-
#
|
35
|
-
# @note 通用的查询方法,自行提供 method 和 params
|
36
|
-
# @param data [Hash]
|
37
|
-
# @return [Hash, String]
|
29
|
+
# 直接使用自定义查询执行 API 请求
|
38
30
|
def query(data)
|
39
31
|
@client.api_request(method: data[:method], params: data[:params])
|
40
32
|
end
|
41
33
|
|
42
|
-
#
|
43
|
-
# @note TODO
|
44
|
-
# @return [Boolean]
|
34
|
+
# 注销当前身份验证令牌
|
45
35
|
def logout
|
46
36
|
@client.logout
|
47
37
|
end
|
48
38
|
|
49
|
-
#
|
50
|
-
# @note 实例化 ZabbixManager 对象,Client.new 进行参数检查
|
51
|
-
# @param options [Hash]
|
52
|
-
# @return [ZabbixManager::Client]
|
39
|
+
# 初始化一个新的 ZabbixManager 对象
|
53
40
|
def initialize(options = {})
|
54
41
|
@client = Client.new(options)
|
55
42
|
end
|
56
43
|
|
57
|
-
#
|
44
|
+
# 返回 ZabbixManager::Actions 对象
|
58
45
|
def actions
|
59
46
|
@actions ||= Actions.new(@client)
|
60
47
|
end
|
61
48
|
|
62
|
-
#
|
49
|
+
# 返回 ZabbixManager::Applications 对象
|
63
50
|
def applications
|
64
51
|
@applications ||= Applications.new(@client)
|
65
52
|
end
|
66
53
|
|
67
|
-
#
|
54
|
+
# 返回 ZabbixManager::Configurations 对象
|
68
55
|
def configurations
|
69
56
|
@configurations ||= Configurations.new(@client)
|
70
57
|
end
|
71
58
|
|
72
|
-
#
|
59
|
+
# 返回 ZabbixManager::Events 对象
|
73
60
|
def events
|
74
61
|
@events ||= Events.new(@client)
|
75
62
|
end
|
76
63
|
|
77
|
-
#
|
64
|
+
# 返回 ZabbixManager::Graphs 对象
|
78
65
|
def graphs
|
79
66
|
@graphs ||= Graphs.new(@client)
|
80
67
|
end
|
81
68
|
|
82
|
-
#
|
69
|
+
# 返回 ZabbixManager::HostGroups 对象
|
83
70
|
def hostgroups
|
84
71
|
@hostgroups ||= HostGroups.new(@client)
|
85
72
|
end
|
86
73
|
|
87
|
-
#
|
74
|
+
# 返回 ZabbixManager::HostInterfaces 对象
|
88
75
|
def hostinterfaces
|
89
76
|
@hostinterfaces ||= HostInterfaces.new(@client)
|
90
77
|
end
|
91
78
|
|
92
|
-
#
|
79
|
+
# 返回 ZabbixManager::Hosts 对象
|
93
80
|
def hosts
|
94
81
|
@hosts ||= Hosts.new(@client)
|
95
82
|
end
|
96
83
|
|
97
|
-
#
|
84
|
+
# 返回 ZabbixManager::HttpTests 对象
|
98
85
|
def httptests
|
99
86
|
@httptests ||= HttpTests.new(@client)
|
100
87
|
end
|
101
88
|
|
102
|
-
#
|
89
|
+
# 返回 ZabbixManager::Items 对象
|
103
90
|
def items
|
104
91
|
@items ||= Items.new(@client)
|
105
92
|
end
|
106
93
|
|
107
|
-
#
|
94
|
+
# 返回 ZabbixManager::Maintenance 对象
|
108
95
|
def maintenance
|
109
96
|
@maintenance ||= Maintenance.new(@client)
|
110
97
|
end
|
111
98
|
|
112
|
-
#
|
99
|
+
# 返回 ZabbixManager::Mediatypes 对象
|
113
100
|
def mediatypes
|
114
101
|
@mediatypes ||= Mediatypes.new(@client)
|
115
102
|
end
|
116
103
|
|
117
|
-
#
|
104
|
+
# 返回 ZabbixManager::Problems 对象
|
118
105
|
def problems
|
119
106
|
@problems ||= Problems.new(@client)
|
120
107
|
end
|
121
108
|
|
122
|
-
#
|
109
|
+
# 返回 ZabbixManager::Proxies 对象
|
123
110
|
def proxies
|
124
111
|
@proxies ||= Proxies.new(@client)
|
125
112
|
end
|
126
113
|
|
127
|
-
#
|
114
|
+
# 返回 ZabbixManager::Roles 对象
|
128
115
|
def roles
|
129
116
|
@roles ||= Roles.new(@client)
|
130
117
|
end
|
131
118
|
|
132
|
-
#
|
119
|
+
# 返回 ZabbixManager::Screens 对象
|
133
120
|
def screens
|
134
121
|
@screens ||= Screens.new(@client)
|
135
122
|
end
|
136
123
|
|
137
|
-
#
|
124
|
+
# 返回 ZabbixManager::Scripts 对象
|
138
125
|
def scripts
|
139
126
|
@scripts ||= Scripts.new(@client)
|
140
127
|
end
|
141
128
|
|
142
|
-
#
|
129
|
+
# 返回 ZabbixManager::Server 对象
|
143
130
|
def server
|
144
131
|
@server ||= Server.new(@client)
|
145
132
|
end
|
146
133
|
|
147
|
-
#
|
134
|
+
# 返回 ZabbixManager::Templates 对象
|
148
135
|
def templates
|
149
136
|
@templates ||= Templates.new(@client)
|
150
137
|
end
|
151
138
|
|
152
|
-
#
|
139
|
+
# 返回 ZabbixManager::Triggers 对象
|
153
140
|
def triggers
|
154
141
|
@triggers ||= Triggers.new(@client)
|
155
142
|
end
|
156
143
|
|
157
|
-
#
|
144
|
+
# 返回 ZabbixManager::Usergroups 对象
|
158
145
|
def usergroups
|
159
146
|
@usergroups ||= Usergroups.new(@client)
|
160
147
|
end
|
161
148
|
|
162
|
-
#
|
149
|
+
# 返回 ZabbixManager::Usermacros 对象
|
163
150
|
def usermacros
|
164
151
|
@usermacros ||= Usermacros.new(@client)
|
165
152
|
end
|
166
153
|
|
167
|
-
#
|
154
|
+
# 返回 ZabbixManager::Users 对象
|
168
155
|
def users
|
169
156
|
@users ||= Users.new(@client)
|
170
157
|
end
|
171
158
|
|
172
|
-
#
|
159
|
+
# 返回 ZabbixManager::ValueMaps 对象
|
173
160
|
def valuemaps
|
174
161
|
@valuemaps ||= ValueMaps.new(@client)
|
175
162
|
end
|
176
163
|
|
177
|
-
#
|
164
|
+
# 返回 ZabbixManager::Drules 对象
|
178
165
|
def drules
|
179
166
|
@drules ||= Drules.new(@client)
|
180
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.5
|
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-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
- !ruby/object:Gem::Version
|
121
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
|