zbxapi 0.1.352 → 0.1.369

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/zbxapi.rb +15 -8
  2. data/zbxapi/revision.rb +1 -1
  3. metadata +25 -9
data/zbxapi.rb CHANGED
@@ -19,8 +19,8 @@
19
19
  #--
20
20
  ##########################################
21
21
  # Subversion information
22
- # $Id: zbxapi.rb 344 2011-11-18 01:44:36Z nelsonab $
23
- # $Revision: 344 $
22
+ # $Id: zbxapi.rb 369 2011-12-22 05:17:06Z nelsonab $
23
+ # $Revision: 369 $
24
24
  ##########################################
25
25
  #++
26
26
 
@@ -43,6 +43,7 @@ require 'uri'
43
43
  require 'net/https'
44
44
  require 'rubygems'
45
45
  require 'json'
46
+ require 'pp'
46
47
 
47
48
  require "api_classes/application"
48
49
  require "api_classes/history"
@@ -109,12 +110,18 @@ class ZabbixAPI
109
110
  @sysmap = ZbxAPI_Sysmap.new(self)
110
111
  @history = ZbxAPI_History.new(self)
111
112
  @id=0
113
+ @proxy=nil
112
114
 
113
115
  debug(6,:msg=>"protocol: #{@url.scheme}, host: #{@url.host}")
114
116
  debug(6,:msg=>"port: #{@url.port}, path: #{@url.path}")
115
117
  debug(6,:msg=>"query: #{@url.query}, fragment: #{@url.fragment}")
116
118
  end
117
119
 
120
+ def set_proxy(address,port,user=nil,password=nil)
121
+ @proxy={:address=>address, :port=>port,
122
+ :user=>user, :password=>password}
123
+ end
124
+
118
125
  def self.get_version
119
126
  "#{ZBXAPI_VERSION}.#{ZBXAPI_REVISION}"
120
127
  end
@@ -195,7 +202,6 @@ class ZabbixAPI
195
202
  rescue Errno::ECONNREFUSED
196
203
  raise ZbxAPI_ExceptionBadServerUrl
197
204
  end
198
-
199
205
  end
200
206
 
201
207
  def logout
@@ -267,15 +273,16 @@ class ZabbixAPI
267
273
  #truncate_length determines how many characters at maximum should be displayed while debugging before
268
274
  #truncation should occur.
269
275
  def do_request(json_obj,truncate_length=5000)
270
- #puts json_obj
271
276
  redirects=0
272
277
  begin # This is here for redirects
273
- http = Net::HTTP.new(@url.host, @url.port)
278
+ if @proxy
279
+ http = Net::HTTP::Proxy(@proxy[:address],@proxy[:port],
280
+ @proxy[:user],@proxy[:password]).new(@url.host,@url.port)
281
+ else
282
+ http = Net::HTTP.new(@url.host, @url.port)
283
+ end
274
284
  http.use_ssl=true if @url.class==URI::HTTPS
275
285
  response = nil
276
- # http.set_debug_output($stderr) #Uncomment to see low level HTTP debug
277
- # http.use_ssl = @url.scheme=='https' ? true : false
278
- # http.start do |http|
279
286
  headers={'Content-Type'=>'application/json-rpc',
280
287
  'User-Agent'=>'Zbx Ruby CLI'}
281
288
  debug(4,:msg=>"Sending: #{json_obj}")
@@ -4,4 +4,4 @@
4
4
  #the rakefile was run
5
5
 
6
6
  ZBXAPI_VERSION="0.1"
7
- ZBXAPI_REVISION="352"
7
+ ZBXAPI_REVISION="369"
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zbxapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.352
4
+ hash: 761
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 369
10
+ version: 0.1.369
5
11
  platform: ruby
6
12
  authors:
7
13
  - A. Nelson
@@ -9,19 +15,23 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2011-11-25 00:00:00 -05:00
18
+ date: 2011-12-22 00:00:00 -05:00
13
19
  default_executable:
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: json
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
20
26
  requirements:
21
27
  - - ">="
22
28
  - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
23
32
  version: "0"
24
- version:
33
+ type: :runtime
34
+ version_requirements: *id001
25
35
  description: Provides a straight forward interface to manipulate Zabbix servers using the Zabbix API.
26
36
  email: nelsonab@red-tux.net
27
37
  executables: []
@@ -58,21 +68,27 @@ rdoc_options: []
58
68
  require_paths:
59
69
  - .
60
70
  required_ruby_version: !ruby/object:Gem::Requirement
71
+ none: false
61
72
  requirements:
62
73
  - - ">="
63
74
  - !ruby/object:Gem::Version
75
+ hash: 3
76
+ segments:
77
+ - 0
64
78
  version: "0"
65
- version:
66
79
  required_rubygems_version: !ruby/object:Gem::Requirement
80
+ none: false
67
81
  requirements:
68
82
  - - ">="
69
83
  - !ruby/object:Gem::Version
84
+ hash: 3
85
+ segments:
86
+ - 0
70
87
  version: "0"
71
- version:
72
88
  requirements:
73
89
  - Requires json
74
90
  rubyforge_project: zbxapi
75
- rubygems_version: 1.3.5
91
+ rubygems_version: 1.3.7
76
92
  signing_key:
77
93
  specification_version: 3
78
94
  summary: Ruby wrapper to the Zabbix API