zabbix-api-simple 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/bin/zapishell.rb +1 -1
- data/lib/zabbix/api/client.rb +12 -9
- data/lib/zabbix/api/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: 35647dac01d85faed96daeacd718c183ffb90ee374f97e93a1b8108408def350
|
4
|
+
data.tar.gz: 6ad7fc1f2fa168f35fce665da63d156a163e81705c42a33059081b96adb72e15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 187014b38f74a272f2f90a7fae4dfe2a17bb772f842a2f12001bfca4eba135e0f4edebfa5f361a3e131361597d1181f7cee402e09bb525f6ea038fc52e6f816b
|
7
|
+
data.tar.gz: 94a0eae1c0d62056128f6c2a55eee1418c5e516ff475fda580a941a8ba9c0e0a5da4402db3eb6c1cc0f365d1782305765ed666749d81328b968bc0d636353f54
|
data/README.md
CHANGED
@@ -55,7 +55,7 @@ opts = Optimist::options do
|
|
55
55
|
opt :hostname, "Host name to search for", type: :string, required: true
|
56
56
|
end
|
57
57
|
|
58
|
-
api = Zabbix::Api::Client.new(opts[:url])
|
58
|
+
api = Zabbix::Api::Client.new(url: opts[:url])
|
59
59
|
|
60
60
|
api.login(user: opts[:user],pass:opts[:pass])
|
61
61
|
|
data/bin/zapishell.rb
CHANGED
data/lib/zabbix/api/client.rb
CHANGED
@@ -87,6 +87,17 @@ module Zabbix
|
|
87
87
|
OpenStruct.new(post(method: 'user.logout', params: [], auth: @token).body)
|
88
88
|
end
|
89
89
|
|
90
|
+
def call(name, *args, &block)
|
91
|
+
res = post(method: "#{name}", params: args.first, id: '1', auth: @token).body
|
92
|
+
raise res['error'].awesome_inspect(plain: true) if res.has_key?('error')
|
93
|
+
if res.has_key?('result') and res['result'].class == Array
|
94
|
+
res = res['result'].collect{|each| OpenStruct.new(each)}
|
95
|
+
else
|
96
|
+
res = OpenStruct.new(res)
|
97
|
+
end
|
98
|
+
return res
|
99
|
+
end
|
100
|
+
|
90
101
|
|
91
102
|
def method_missing(name, *args, &block)
|
92
103
|
if @@zabbix_objects.include?(name)
|
@@ -97,15 +108,7 @@ module Zabbix
|
|
97
108
|
newcli.zabobject = name
|
98
109
|
return newcli
|
99
110
|
elsif @zabobject
|
100
|
-
|
101
|
-
res = post(method: "#{object}.#{name}", params: args.first, id: '1', auth: @token).body
|
102
|
-
raise res['error'].awesome_inspect(plain: true) if res.has_key?('error')
|
103
|
-
if res.has_key?('result') and res['result'].class == Array
|
104
|
-
res = res['result'].collect{|each| OpenStruct.new(each)}
|
105
|
-
else
|
106
|
-
res = OpenStruct.new(res)
|
107
|
-
end
|
108
|
-
return res
|
111
|
+
return call("#{@zabobject}.#{name}",args.first)
|
109
112
|
else
|
110
113
|
raise "Unknown zabbix object given: #{name}"
|
111
114
|
end
|
data/lib/zabbix/api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zabbix-api-simple
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Parker
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|