zbxapi 0.1.386 → 0.1.397
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.
- data/api_classes/item.rb +9 -0
- data/zbxapi.rb +12 -10
- data/zbxapi/revision.rb +1 -1
- metadata +2 -2
data/api_classes/item.rb
CHANGED
|
@@ -67,6 +67,15 @@ class ZbxAPI_Item < ZbxAPI_Sub
|
|
|
67
67
|
return obj['result']
|
|
68
68
|
end
|
|
69
69
|
|
|
70
|
+
def update(options)
|
|
71
|
+
debug(8,:var=>options)
|
|
72
|
+
checkauth
|
|
73
|
+
checkversion(1,1)
|
|
74
|
+
|
|
75
|
+
obj=do_request(json_obj('item.update', options))
|
|
76
|
+
return obj['result']
|
|
77
|
+
end
|
|
78
|
+
|
|
70
79
|
# Alias function for code written against 1.0 API
|
|
71
80
|
def add(options)
|
|
72
81
|
puts "WARNING API Function Item.add is deprecated and will be removed in the future without further warning"
|
data/zbxapi.rb
CHANGED
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
#--
|
|
20
20
|
##########################################
|
|
21
21
|
# Subversion information
|
|
22
|
-
# $Id: zbxapi.rb
|
|
23
|
-
# $Revision:
|
|
22
|
+
# $Id: zbxapi.rb 397 2012-05-21 17:20:37Z nelsonab $
|
|
23
|
+
# $Revision: 397 $
|
|
24
24
|
##########################################
|
|
25
25
|
#++
|
|
26
26
|
|
|
@@ -46,6 +46,7 @@ require 'json'
|
|
|
46
46
|
require 'pp'
|
|
47
47
|
|
|
48
48
|
require "api_classes/application"
|
|
49
|
+
require "api_classes/graph"
|
|
49
50
|
require "api_classes/history"
|
|
50
51
|
require "api_classes/host"
|
|
51
52
|
require "api_classes/host_group"
|
|
@@ -75,7 +76,7 @@ class ZabbixAPI
|
|
|
75
76
|
#subordinate class
|
|
76
77
|
attr_accessor :user # [User#new]
|
|
77
78
|
#subordinate class
|
|
78
|
-
attr_accessor :usergroup, :host, :item, :hostgroup, :application, :trigger, :sysmap, :history, :proxy
|
|
79
|
+
attr_accessor :usergroup, :host, :item, :hostgroup, :application, :trigger, :sysmap, :history, :proxy, :graph
|
|
79
80
|
@id=0
|
|
80
81
|
@auth=''
|
|
81
82
|
@url=nil
|
|
@@ -110,8 +111,9 @@ class ZabbixAPI
|
|
|
110
111
|
@trigger = ZbxAPI_Trigger.new(self)
|
|
111
112
|
@sysmap = ZbxAPI_Sysmap.new(self)
|
|
112
113
|
@history = ZbxAPI_History.new(self)
|
|
114
|
+
@graph = ZbxAPI_Graph.new(self)
|
|
113
115
|
@id=0
|
|
114
|
-
@
|
|
116
|
+
@http_proxy=nil
|
|
115
117
|
|
|
116
118
|
debug(6,:msg=>"protocol: #{@url.scheme}, host: #{@url.host}")
|
|
117
119
|
debug(6,:msg=>"port: #{@url.port}, path: #{@url.path}")
|
|
@@ -119,7 +121,7 @@ class ZabbixAPI
|
|
|
119
121
|
end
|
|
120
122
|
|
|
121
123
|
def set_proxy(address,port,user=nil,password=nil)
|
|
122
|
-
@
|
|
124
|
+
@http_proxy={:address=>address, :port=>port,
|
|
123
125
|
:user=>user, :password=>password}
|
|
124
126
|
end
|
|
125
127
|
|
|
@@ -186,7 +188,7 @@ class ZabbixAPI
|
|
|
186
188
|
@auth=result['result']
|
|
187
189
|
|
|
188
190
|
#setup the version variables
|
|
189
|
-
@major,@minor=do_request(json_obj('
|
|
191
|
+
@major,@minor=do_request(json_obj('apiinfo.version',{}))['result'].split('.')
|
|
190
192
|
@major=@major.to_i
|
|
191
193
|
@minor=@minor.to_i
|
|
192
194
|
rescue ZbxAPI_ExceptionLoginPermission => e
|
|
@@ -273,9 +275,9 @@ class ZabbixAPI
|
|
|
273
275
|
end
|
|
274
276
|
|
|
275
277
|
def get_http_obj
|
|
276
|
-
if @
|
|
277
|
-
http = Net::HTTP::Proxy(@
|
|
278
|
-
@
|
|
278
|
+
if @http_proxy
|
|
279
|
+
http = Net::HTTP::Proxy(@http_proxy[:address],@http_proxy[:port],
|
|
280
|
+
@http_proxy[:user],@http_proxy[:password]).new(@url.host,@url.port)
|
|
279
281
|
else
|
|
280
282
|
http = Net::HTTP.new(@url.host, @url.port)
|
|
281
283
|
end
|
|
@@ -333,7 +335,7 @@ class ZabbixAPI
|
|
|
333
335
|
redirects+=1
|
|
334
336
|
retry if redirects<=5
|
|
335
337
|
raise ZbxAPI_GeneralError, "Too many redirects"
|
|
336
|
-
rescue NoMethodError
|
|
338
|
+
rescue NoMethodError => e
|
|
337
339
|
raise ZbxAPI_GeneralError.new("Unable to connect to #{@url.host} : \"#{e}\"", :retry=>false)
|
|
338
340
|
end
|
|
339
341
|
end
|
data/zbxapi/revision.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: zbxapi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.397
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- A. Nelson
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2012-
|
|
12
|
+
date: 2012-05-21 00:00:00 -04:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|