zabbixapi_mgx 7.2.0 → 7.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/zabbixapi/classes/hosts.rb +26 -0
- data/lib/zabbixapi/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8400ec8b9feffbff0c26eb85bfe5fb2b8ffd3dc67b458d4ed99613b584e8eb8b
|
4
|
+
data.tar.gz: d3a8749581e72691d7bfda082f3dd34f2d7d7e07380dfe0b968f69ed90a8c31c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b303704506861a4d8dadcaafb6ec0b5c8b477350e90f6b421f6f81813efb8ed7c5f11a12092b1bd4b9709e4493719786635d1efe41a721db0a0d30afc6f670c2
|
7
|
+
data.tar.gz: 3a0f4388545a81392d1411a2c9b94962c59c329bd1362b3720077fb217c644a97be3cacc75d652ae16e60030ef28d80c45562974e77357290ba3072ac07eee69
|
@@ -75,5 +75,31 @@ class ZabbixApi
|
|
75
75
|
hostid = get_id(host: data[:host])
|
76
76
|
hostid ? update(data.merge(hostid: hostid)) : create(data)
|
77
77
|
end
|
78
|
+
|
79
|
+
# Update Host object using API
|
80
|
+
#
|
81
|
+
# @param data [Hash] Should include object's id field name (identify) and id value
|
82
|
+
# @param force [Boolean] Whether to force an object update even if provided data matches Zabbix
|
83
|
+
# @raise [ApiError] Error returned when there is a problem with the Zabbix API call.
|
84
|
+
# @raise [HttpError] Error raised when HTTP status from Zabbix Server response is not a 200 OK.
|
85
|
+
# @return [Integer] The object id if a single object is created
|
86
|
+
# @return [Boolean] True/False if multiple objects are created
|
87
|
+
def update(data, force = false)
|
88
|
+
log "[DEBUG] Call update with parameters: #{data.inspect}"
|
89
|
+
dump = {}
|
90
|
+
dump_by_id(key.to_sym => data[key.to_sym]).each do |item|
|
91
|
+
dump = symbolize_keys(item) if item[key].to_i == data[key.to_sym].to_i
|
92
|
+
end
|
93
|
+
if hash_equals?(dump, data) && !force
|
94
|
+
log "[DEBUG] Equal keys #{dump} and #{data}, skip update"
|
95
|
+
data[key.to_sym].to_i
|
96
|
+
else
|
97
|
+
data[:groups] = data.delete(:hostgroups)
|
98
|
+
data_update = [data]
|
99
|
+
result = @client.api_request(method: "#{method_name}.update", params: data_update)
|
100
|
+
parse_keys result
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
78
104
|
end
|
79
105
|
end
|
data/lib/zabbixapi/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zabbixapi_mgx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.2.
|
4
|
+
version: 7.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vasiliev D.V.
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2025-
|
12
|
+
date: 2025-02-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: http
|