zabbix_manager 5.0.4 → 5.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -4
- data/LICENSE.txt +1 -1
- data/README.md +76 -21
- data/lib/zabbix_manager/basic/basic_alias.rb +2 -0
- data/lib/zabbix_manager/basic/basic_extend.rb +11 -9
- data/lib/zabbix_manager/basic/basic_func.rb +9 -5
- data/lib/zabbix_manager/basic/basic_init.rb +6 -4
- data/lib/zabbix_manager/basic/basic_logic.rb +7 -5
- data/lib/zabbix_manager/classes/actions.rb +6 -4
- data/lib/zabbix_manager/classes/applications.rb +4 -2
- data/lib/zabbix_manager/classes/configurations.rb +6 -4
- data/lib/zabbix_manager/classes/drules.rb +5 -3
- data/lib/zabbix_manager/classes/errors.rb +10 -9
- data/lib/zabbix_manager/classes/events.rb +4 -3
- data/lib/zabbix_manager/classes/graphs.rb +13 -11
- data/lib/zabbix_manager/classes/hostgroups.rb +13 -11
- data/lib/zabbix_manager/classes/hosts.rb +36 -34
- data/lib/zabbix_manager/classes/httptests.rb +4 -2
- data/lib/zabbix_manager/classes/items.rb +52 -50
- data/lib/zabbix_manager/classes/maintenance.rb +4 -2
- data/lib/zabbix_manager/classes/mediatypes.rb +15 -13
- data/lib/zabbix_manager/classes/problems.rb +31 -30
- data/lib/zabbix_manager/classes/proxies.rb +9 -7
- data/lib/zabbix_manager/classes/roles.rb +19 -17
- data/lib/zabbix_manager/classes/screens.rb +6 -4
- data/lib/zabbix_manager/classes/scripts.rb +6 -4
- data/lib/zabbix_manager/classes/server.rb +3 -1
- data/lib/zabbix_manager/classes/templates.rb +18 -16
- data/lib/zabbix_manager/classes/triggers.rb +41 -37
- data/lib/zabbix_manager/classes/unusable.rb +2 -0
- data/lib/zabbix_manager/classes/usergroups.rb +11 -9
- data/lib/zabbix_manager/classes/usermacros.rb +38 -37
- data/lib/zabbix_manager/classes/users.rb +11 -9
- data/lib/zabbix_manager/classes/valuemaps.rb +5 -3
- data/lib/zabbix_manager/client.rb +40 -30
- data/lib/zabbix_manager/version.rb +3 -1
- data/lib/zabbix_manager.rb +36 -35
- data/zabbix_manager.gemspec +43 -0
- metadata +143 -19
- data/.idea/workspace.xml +0 -69
- data/.rubocop.yml +0 -13
- data/CODE_OF_CONDUCT.md +0 -84
- data/Gemfile +0 -10
- data/Rakefile +0 -8
- data/bin/console +0 -15
- data/bin/setup +0 -8
- data/zabbix_manager-5.0.1.gem +0 -0
- data/zabbix_manager-5.0.2.gem +0 -0
@@ -1,17 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class ZabbixManager
|
2
4
|
class Usermacros < Basic
|
3
5
|
# The id field name used for identifying specific User macro objects via Zabbix API
|
4
6
|
#
|
5
7
|
# @return [String]
|
6
8
|
def identify
|
7
|
-
|
9
|
+
"macro"
|
8
10
|
end
|
9
11
|
|
10
12
|
# The method name used for interacting with User macros via Zabbix API
|
11
13
|
#
|
12
14
|
# @return [String]
|
13
15
|
def method_name
|
14
|
-
|
16
|
+
"usermacro"
|
15
17
|
end
|
16
18
|
|
17
19
|
# Get User macro object id from Zabbix API based on provided data
|
@@ -27,11 +29,11 @@ class ZabbixManager
|
|
27
29
|
data = symbolize_keys(data) if data.key?(identify)
|
28
30
|
# raise an error if identify name was not supplied
|
29
31
|
name = data[identify.to_sym]
|
30
|
-
raise ManagerError
|
32
|
+
raise ManagerError, "#{identify} not supplied in call to get_id" if name.nil?
|
31
33
|
|
32
|
-
result = request(data,
|
34
|
+
result = request(data, "usermacro.get", "hostmacroid")
|
33
35
|
|
34
|
-
!result.empty? && result[0].key?(
|
36
|
+
!result.empty? && result[0].key?("hostmacroid") ? result[0]["hostmacroid"].to_i : nil
|
35
37
|
end
|
36
38
|
|
37
39
|
# Get Global macro object id from Zabbix API based on provided data
|
@@ -47,11 +49,11 @@ class ZabbixManager
|
|
47
49
|
data = symbolize_keys(data) if data.key?(identify)
|
48
50
|
# raise an error if identify name was not supplied
|
49
51
|
name = data[identify.to_sym]
|
50
|
-
raise ManagerError
|
52
|
+
raise ManagerError, "#{identify} not supplied in call to get_id_global" if name.nil?
|
51
53
|
|
52
|
-
result = request(data,
|
54
|
+
result = request(data, "usermacro.get", "globalmacroid")
|
53
55
|
|
54
|
-
!result.empty? && result[0].key?(
|
56
|
+
!result.empty? && result[0].key?("globalmacroid") ? result[0]["globalmacroid"].to_i : nil
|
55
57
|
end
|
56
58
|
|
57
59
|
# Get full/extended User macro data from Zabbix API
|
@@ -63,7 +65,7 @@ class ZabbixManager
|
|
63
65
|
def get_full_data(data)
|
64
66
|
log "[DEBUG] Call get_full_data with parameters: #{data.inspect}"
|
65
67
|
|
66
|
-
request(data,
|
68
|
+
request(data, "usermacro.get", "hostmacroid")
|
67
69
|
end
|
68
70
|
|
69
71
|
# Get full/extended Global macro data from Zabbix API
|
@@ -75,7 +77,7 @@ class ZabbixManager
|
|
75
77
|
def get_full_data_global(data)
|
76
78
|
log "[DEBUG] Call get_full_data_global with parameters: #{data.inspect}"
|
77
79
|
|
78
|
-
request(data,
|
80
|
+
request(data, "usermacro.get", "globalmacroid")
|
79
81
|
end
|
80
82
|
|
81
83
|
# Create new User macro object using Zabbix API (with defaults)
|
@@ -86,7 +88,7 @@ class ZabbixManager
|
|
86
88
|
# @return [Integer] The object id if a single object is created
|
87
89
|
# @return [Boolean] True/False if multiple objects are created
|
88
90
|
def create(data)
|
89
|
-
request(data,
|
91
|
+
request(data, "usermacro.create", "hostmacroids")
|
90
92
|
end
|
91
93
|
|
92
94
|
# Create new Global macro object using Zabbix API (with defaults)
|
@@ -97,7 +99,7 @@ class ZabbixManager
|
|
97
99
|
# @return [Integer] The object id if a single object is created
|
98
100
|
# @return [Boolean] True/False if multiple objects are created
|
99
101
|
def create_global(data)
|
100
|
-
request(data,
|
102
|
+
request(data, "usermacro.createglobal", "globalmacroids")
|
101
103
|
end
|
102
104
|
|
103
105
|
# Delete User macro object using Zabbix API
|
@@ -109,7 +111,7 @@ class ZabbixManager
|
|
109
111
|
# @return [Boolean] True/False if multiple objects are deleted
|
110
112
|
def delete(data)
|
111
113
|
data_delete = [data]
|
112
|
-
request(data_delete,
|
114
|
+
request(data_delete, "usermacro.delete", "hostmacroids")
|
113
115
|
end
|
114
116
|
|
115
117
|
# Delete Global macro object using Zabbix API
|
@@ -121,7 +123,7 @@ class ZabbixManager
|
|
121
123
|
# @return [Boolean] True/False if multiple objects are deleted
|
122
124
|
def delete_global(data)
|
123
125
|
data_delete = [data]
|
124
|
-
request(data_delete,
|
126
|
+
request(data_delete, "usermacro.deleteglobal", "globalmacroids")
|
125
127
|
end
|
126
128
|
|
127
129
|
# Update User macro object using Zabbix API
|
@@ -133,7 +135,7 @@ class ZabbixManager
|
|
133
135
|
# @return [Integer] The object id if a single object is created
|
134
136
|
# @return [Boolean] True/False if multiple objects are created
|
135
137
|
def update(data)
|
136
|
-
request(data,
|
138
|
+
request(data, "usermacro.update", "hostmacroids")
|
137
139
|
end
|
138
140
|
|
139
141
|
# Update Global macro object using Zabbix API
|
@@ -145,7 +147,7 @@ class ZabbixManager
|
|
145
147
|
# @return [Integer] The object id if a single object is created
|
146
148
|
# @return [Boolean] True/False if multiple objects are created
|
147
149
|
def update_global(data)
|
148
|
-
request(data,
|
150
|
+
request(data, "usermacro.updateglobal", "globalmacroids")
|
149
151
|
end
|
150
152
|
|
151
153
|
# Get or Create User macro object using Zabbix API
|
@@ -200,29 +202,28 @@ class ZabbixManager
|
|
200
202
|
globalmacroid ? update_global(data.merge(globalmacroid: globalmacroid)) : create_global(data)
|
201
203
|
end
|
202
204
|
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
205
|
+
private
|
206
|
+
# Custom request method to handle both User and Global macros in one
|
207
|
+
#
|
208
|
+
# @param data [Hash] Needs to include macro and hostid to properly identify Global macros via Zabbix API
|
209
|
+
# @param method [String] Zabbix API method to use for the request
|
210
|
+
# @param result_key [String] Which key to use for parsing results based on User vs Global macros
|
211
|
+
# @raise [ManagerError] Error returned when there is a problem with the Zabbix API call.
|
212
|
+
# @raise [HttpError] Error raised when HTTP status from Zabbix Server response is not a 200 OK.
|
213
|
+
# @return [Integer] Zabbix object id
|
214
|
+
def request(data, method, result_key)
|
215
|
+
# Zabbix has different result formats for gets vs updates
|
216
|
+
if method.include?(".get")
|
217
|
+
if result_key.include?("global")
|
218
|
+
@client.api_request(method: method, params: { globalmacro: true, filter: data })
|
219
|
+
else
|
220
|
+
@client.api_request(method: method, params: { filter: data })
|
221
|
+
end
|
218
222
|
else
|
219
|
-
@client.api_request(method: method, params:
|
220
|
-
end
|
221
|
-
else
|
222
|
-
result = @client.api_request(method: method, params: data)
|
223
|
+
result = @client.api_request(method: method, params: data)
|
223
224
|
|
224
|
-
|
225
|
+
result.key?(result_key) && !result[result_key].empty? ? result[result_key][0].to_i : nil
|
226
|
+
end
|
225
227
|
end
|
226
|
-
end
|
227
228
|
end
|
228
229
|
end
|
@@ -1,31 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class ZabbixManager
|
2
4
|
class Users < Basic
|
3
5
|
# The method name used for interacting with Users via Zabbix API
|
4
6
|
#
|
5
7
|
# @return [String]
|
6
8
|
def method_name
|
7
|
-
|
9
|
+
"user"
|
8
10
|
end
|
9
11
|
|
10
12
|
# The keys field name used for User objects via Zabbix API
|
11
13
|
#
|
12
14
|
# @return [String]
|
13
15
|
def keys
|
14
|
-
|
16
|
+
"userids"
|
15
17
|
end
|
16
18
|
|
17
19
|
# The key field name used for User objects via Zabbix API
|
18
20
|
#
|
19
21
|
# @return [String]
|
20
22
|
def key
|
21
|
-
|
23
|
+
"userid"
|
22
24
|
end
|
23
25
|
|
24
26
|
# The id field name used for identifying specific User objects via Zabbix API
|
25
27
|
#
|
26
28
|
# @return [String]
|
27
29
|
def identify
|
28
|
-
|
30
|
+
"alias"
|
29
31
|
end
|
30
32
|
|
31
33
|
def medias_helper(data, action)
|
@@ -34,11 +36,11 @@ class ZabbixManager
|
|
34
36
|
params: data[:userids].map do |t|
|
35
37
|
{
|
36
38
|
userid: t,
|
37
|
-
user_medias: data[:media]
|
39
|
+
user_medias: data[:media]
|
38
40
|
}
|
39
|
-
end
|
41
|
+
end
|
40
42
|
)
|
41
|
-
result ? result[
|
43
|
+
result ? result["userids"][0].to_i : nil
|
42
44
|
end
|
43
45
|
|
44
46
|
# Add media to users using Zabbix API
|
@@ -48,7 +50,7 @@ class ZabbixManager
|
|
48
50
|
# @raise [HttpError] Error raised when HTTP status from Zabbix Server response is not a 200 OK.
|
49
51
|
# @return [Integer] Zabbix object id (media)
|
50
52
|
def add_medias(data)
|
51
|
-
medias_helper(data,
|
53
|
+
medias_helper(data, "update")
|
52
54
|
end
|
53
55
|
|
54
56
|
# Update media for users using Zabbix API
|
@@ -58,7 +60,7 @@ class ZabbixManager
|
|
58
60
|
# @raise [HttpError] Error raised when HTTP status from Zabbix Server response is not a 200 OK.
|
59
61
|
# @return [Integer] Zabbix object id (user)
|
60
62
|
def update_medias(data)
|
61
|
-
medias_helper(data,
|
63
|
+
medias_helper(data, "update")
|
62
64
|
end
|
63
65
|
end
|
64
66
|
end
|
@@ -1,24 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class ZabbixManager
|
2
4
|
class ValueMaps < Basic
|
3
5
|
# The method name used for interacting with ValueMaps via Zabbix API
|
4
6
|
#
|
5
7
|
# @return [String]
|
6
8
|
def method_name
|
7
|
-
|
9
|
+
"valuemap"
|
8
10
|
end
|
9
11
|
|
10
12
|
# The key field name used for ValueMap objects via Zabbix API
|
11
13
|
#
|
12
14
|
# @return [String]
|
13
15
|
def key
|
14
|
-
|
16
|
+
"valuemapid"
|
15
17
|
end
|
16
18
|
|
17
19
|
# The id field name used for identifying specific ValueMap objects via Zabbix API
|
18
20
|
#
|
19
21
|
# @return [String]
|
20
22
|
def identify
|
21
|
-
|
23
|
+
"name"
|
22
24
|
end
|
23
25
|
|
24
26
|
# Get or Create ValueMap object using Zabbix API
|
@@ -1,6 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "net/http"
|
4
|
+
require "json"
|
5
|
+
require "openssl"
|
4
6
|
|
5
7
|
class ZabbixManager
|
6
8
|
class Client
|
@@ -10,14 +12,14 @@ class ZabbixManager
|
|
10
12
|
|
11
13
|
# @return [Integer]
|
12
14
|
def id
|
13
|
-
rand
|
15
|
+
rand 10_000
|
14
16
|
end
|
15
17
|
|
16
18
|
# Returns the API version from the Zabbix Server
|
17
19
|
#
|
18
20
|
# @return [String, Hash]
|
19
21
|
def api_version
|
20
|
-
api_request(method:
|
22
|
+
api_request(method: "apiinfo.version", params: {})
|
21
23
|
end
|
22
24
|
|
23
25
|
# Log in to the Zabbix Server and generate an auth token using the API
|
@@ -25,9 +27,9 @@ class ZabbixManager
|
|
25
27
|
# @return [Hash, String]
|
26
28
|
def auth
|
27
29
|
api_request(
|
28
|
-
method:
|
30
|
+
method: "user.login",
|
29
31
|
params: {
|
30
|
-
user:
|
32
|
+
user: @options[:user],
|
31
33
|
password: @options[:password]
|
32
34
|
}
|
33
35
|
)
|
@@ -43,7 +45,7 @@ class ZabbixManager
|
|
43
45
|
# Initializes a new Client object
|
44
46
|
#
|
45
47
|
# @param options [Hash]
|
46
|
-
# @option opts [String] :url The url of
|
48
|
+
# @option opts [String] :url The url of zabbix_manager(example: 'http://localhost/zabbix/api_jsonrpc.php')
|
47
49
|
# @option opts [String] :user
|
48
50
|
# @option opts [String] :password
|
49
51
|
# @option opts [String] :http_user A user for basic auth.(optional)
|
@@ -53,23 +55,24 @@ class ZabbixManager
|
|
53
55
|
# @return [ZabbixManager::Client]
|
54
56
|
def initialize(options = {})
|
55
57
|
@options = options
|
56
|
-
if !ENV[
|
57
|
-
@proxy_uri = URI.parse(ENV[
|
58
|
+
if !ENV["http_proxy"].nil? && options[:no_proxy] != true
|
59
|
+
@proxy_uri = URI.parse(ENV["http_proxy"])
|
58
60
|
@proxy_host = @proxy_uri.host
|
59
61
|
@proxy_port = @proxy_uri.port
|
60
62
|
@proxy_user, @proxy_pass = @proxy_uri.userinfo&.split(/:/) if @proxy_uri.userinfo
|
61
63
|
end
|
62
64
|
|
63
|
-
if api_version.match?
|
64
|
-
message = "Zabbix API version: #{api_version} is not supported by this version of
|
65
|
+
if api_version.match?(/^7\.\d+\.\d+$/)
|
66
|
+
message = "Zabbix API version: #{api_version} is not supported by this version of zabbix_manager"
|
65
67
|
if @options[:ignore_version]
|
66
68
|
puts "[WARNING] #{message}" if @options[:debug]
|
67
69
|
else
|
68
|
-
raise ZabbixManager::ManagerError
|
70
|
+
raise ZabbixManager::ManagerError, message
|
69
71
|
end
|
70
72
|
end
|
71
73
|
|
72
74
|
@auth_hash = auth
|
75
|
+
puts "[DEBUG] Auth token: #{@auth_hash}" if @options[:debug]
|
73
76
|
end
|
74
77
|
|
75
78
|
# Convert message body to JSON string for the Zabbix API
|
@@ -77,16 +80,17 @@ class ZabbixManager
|
|
77
80
|
# @param body [Hash]
|
78
81
|
# @return [String]
|
79
82
|
def message_json(body)
|
80
|
-
message
|
81
|
-
method:
|
82
|
-
params:
|
83
|
-
id:
|
84
|
-
jsonrpc:
|
83
|
+
message = {
|
84
|
+
method: body[:method],
|
85
|
+
params: body[:params],
|
86
|
+
id: id,
|
87
|
+
jsonrpc: "2.0"
|
85
88
|
}
|
86
89
|
|
87
|
-
|
90
|
+
# 除登录认证和获取版本后之外,都需要携带TOKEN查询
|
91
|
+
message[:auth] = @auth_hash unless body[:method] == "apiinfo.version" || body[:method] == "user.login"
|
88
92
|
|
89
|
-
JSON
|
93
|
+
JSON(message)
|
90
94
|
end
|
91
95
|
|
92
96
|
# @param body [String]
|
@@ -105,7 +109,7 @@ class ZabbixManager
|
|
105
109
|
Net::HTTP.new(uri.host, uri.port)
|
106
110
|
end
|
107
111
|
|
108
|
-
if uri.scheme ==
|
112
|
+
if uri.scheme == "https"
|
109
113
|
http.use_ssl = true
|
110
114
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
111
115
|
end
|
@@ -115,33 +119,39 @@ class ZabbixManager
|
|
115
119
|
|
116
120
|
request = Net::HTTP::Post.new(uri.request_uri)
|
117
121
|
request.basic_auth @options[:http_user], @options[:http_password] if @options[:http_user]
|
118
|
-
request.add_field(
|
122
|
+
request.add_field("Content-Type", "application/json-rpc")
|
119
123
|
request.body = body
|
124
|
+
puts "[DEBUG] HTTP request params: #{request.body}" if @options[:debug]
|
120
125
|
|
121
126
|
response = http.request(request)
|
127
|
+
raise HttpError.new("HTTP Error: #{response.code} on #{@options[:url]}", response) unless response.code == "200"
|
122
128
|
|
123
|
-
|
124
|
-
|
125
|
-
puts "[DEBUG] Get answer: #{response.body}" if @options[:debug]
|
129
|
+
puts "[DEBUG] HTTP response answer: #{response.body}" if @options[:debug]
|
126
130
|
response.body
|
127
131
|
end
|
128
132
|
|
129
133
|
# @param body [String]
|
130
134
|
# @return [Hash, String]
|
131
135
|
def _request(body)
|
132
|
-
puts "[DEBUG] Send request: #{body}" if @options[:debug]
|
133
136
|
result = JSON.parse(http_request(body))
|
134
137
|
# 异常信息抛出
|
135
|
-
|
138
|
+
if result["error"]
|
139
|
+
raise ManagerError.new(
|
140
|
+
"Server answer API error\n #{JSON.pretty_unparse(result["error"])}\n on request:\n #{pretty_body(body)}", result
|
141
|
+
)
|
142
|
+
end
|
136
143
|
|
137
|
-
result[
|
144
|
+
result["result"]
|
138
145
|
end
|
139
146
|
|
140
147
|
def pretty_body(body)
|
141
|
-
parsed_body
|
148
|
+
parsed_body = JSON.parse(body)
|
142
149
|
|
143
150
|
# If password is in body hide it
|
144
|
-
|
151
|
+
if parsed_body["params"].is_a?(Hash) && parsed_body["params"].key?("password")
|
152
|
+
parsed_body["params"]["password"] =
|
153
|
+
"***"
|
154
|
+
end
|
145
155
|
|
146
156
|
JSON.pretty_unparse(parsed_body)
|
147
157
|
end
|
data/lib/zabbix_manager.rb
CHANGED
@@ -1,37 +1,39 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
require
|
5
|
-
|
6
|
-
require
|
7
|
-
require
|
8
|
-
|
9
|
-
require
|
10
|
-
|
11
|
-
require
|
12
|
-
require
|
13
|
-
require
|
14
|
-
require
|
15
|
-
require
|
16
|
-
require
|
17
|
-
require
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
22
|
-
require
|
23
|
-
require
|
24
|
-
require
|
25
|
-
require
|
26
|
-
require
|
27
|
-
require
|
28
|
-
require
|
29
|
-
require
|
30
|
-
require
|
31
|
-
require
|
32
|
-
require
|
33
|
-
require
|
34
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "zabbix_manager/version"
|
4
|
+
require "zabbix_manager/client"
|
5
|
+
|
6
|
+
require "zabbix_manager/basic/basic_alias"
|
7
|
+
require "zabbix_manager/basic/basic_func"
|
8
|
+
require "zabbix_manager/basic/basic_init"
|
9
|
+
require "zabbix_manager/basic/basic_logic"
|
10
|
+
|
11
|
+
require "zabbix_manager/classes/actions"
|
12
|
+
require "zabbix_manager/classes/applications"
|
13
|
+
require "zabbix_manager/classes/configurations"
|
14
|
+
require "zabbix_manager/classes/errors"
|
15
|
+
require "zabbix_manager/classes/events"
|
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"
|
35
37
|
|
36
38
|
class ZabbixManager
|
37
39
|
# @return [ZabbixManager::Client]
|
@@ -192,4 +194,3 @@ class ZabbixManager
|
|
192
194
|
@drules ||= Drules.new(@client)
|
193
195
|
end
|
194
196
|
end
|
195
|
-
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
lib = File.expand_path("../lib", __FILE__)
|
5
|
+
|
6
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
7
|
+
|
8
|
+
require "zabbix_manager/version"
|
9
|
+
|
10
|
+
Gem::Specification.new do |spec|
|
11
|
+
spec.add_dependency "http", "~> 4.0"
|
12
|
+
spec.add_dependency "json", "~> 2.0"
|
13
|
+
spec.add_development_dependency "bundler", "~> 2.3", ">= 2.3.9"
|
14
|
+
|
15
|
+
spec.add_development_dependency "rspec", "~> 3.11"
|
16
|
+
spec.add_development_dependency "yard", "~> 0.9.27"
|
17
|
+
spec.add_development_dependency "yardstick", "~> 0.9.9"
|
18
|
+
spec.add_development_dependency "rubocop", "~> 1.25", ">= 1.25.1"
|
19
|
+
spec.add_development_dependency "rubocop-minitest", "~> 0.18.0"
|
20
|
+
spec.add_development_dependency "rubocop-performance", "~> 1.13"
|
21
|
+
spec.add_development_dependency "rubocop-rails", "~> 2.13", ">= 2.13.2"
|
22
|
+
spec.add_development_dependency "rubocop-packaging", "~> 0.5.1"
|
23
|
+
|
24
|
+
spec.name = "zabbix_manager"
|
25
|
+
spec.version = ZabbixManager::VERSION
|
26
|
+
spec.authors = ["WENWU YAN"]
|
27
|
+
spec.email = ["careline@foxmail.com"]
|
28
|
+
|
29
|
+
spec.summary = "Simple and lightweight ruby module for working with the Zabbix API, support 4.0 5.0 6.0"
|
30
|
+
spec.description = "Most codes borrowed from zabbix_manager, But changed some logic for everyday jobs."
|
31
|
+
spec.homepage = "https://github.com/snmpd/zabbix_manager"
|
32
|
+
spec.licenses = "MIT"
|
33
|
+
|
34
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
35
|
+
|
36
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
37
|
+
spec.metadata["source_code_uri"] = "https://github.com/snmpd/zabbix_manager"
|
38
|
+
spec.metadata["changelog_uri"] = "https://github.com/snmpd/zabbix_manager"
|
39
|
+
|
40
|
+
spec.files = %w[CHANGELOG.md LICENSE.txt README.md zabbix_manager.gemspec] + Dir["lib/**/*.rb"]
|
41
|
+
spec.require_paths = "lib"
|
42
|
+
spec.required_ruby_version = ">= 2.7.0"
|
43
|
+
end
|