zabcon 0.0.366 → 0.0.370

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- REVISION=366
1
+ REVISION=370
@@ -18,8 +18,8 @@
18
18
 
19
19
  ##########################################
20
20
  # Subversion information
21
- # $Id: zabbix_server.rb 325 2011-09-26 08:57:00Z nelsonab $
22
- # $Revision: 325 $
21
+ # $Id: zabbix_server.rb 370 2011-12-22 05:51:45Z nelsonab $
22
+ # $Revision: 370 $
23
23
  ##########################################
24
24
 
25
25
  require 'yaml'
@@ -90,6 +90,12 @@ class ZabbixServer
90
90
  raise ConnectionProblem.new(error_msg.join(", ")) if !error_msg.empty?
91
91
 
92
92
  @connection = ZabbixServer_overload.new(@server_url,env["debug"])
93
+ if env["proxy_server"]
94
+ puts "proxy server"
95
+ p env["proxy_server"],env["proxy_port"],env["proxy_user"],env["proxy_password"]
96
+ @connection.set_proxy(env["proxy_server"],env["proxy_port"],
97
+ env["proxy_user"],env["proxy_password"])
98
+ end
93
99
  @connection.login(@username,@password)
94
100
  @connected=true
95
101
  GlobalVars.instance["auth"]=@connection.auth
@@ -17,8 +17,8 @@
17
17
 
18
18
  ##########################################
19
19
  # Subversion information
20
- # $Id: zabcon_commands.rb 364 2011-12-22 04:21:13Z nelsonab $
21
- # $Revision: 364 $
20
+ # $Id: zabcon_commands.rb 370 2011-12-22 05:51:45Z nelsonab $
21
+ # $Revision: 370 $
22
22
  ##########################################
23
23
 
24
24
  require "zbxapi/zdebug"
@@ -79,6 +79,17 @@ ZabconCommand.add_command "login" do
79
79
  #end
80
80
  end
81
81
 
82
+ ZabconCommand.add_command "set proxy" do
83
+ set_method do |params|
84
+ env["proxy_server"]=params[0]
85
+ env["proxy_port"]=params[1] || env["proxy_port"] || 3128
86
+ env["proxy_user"]=params[2]
87
+ env["proxy_password"]=params[3]
88
+ end
89
+ set_help_tag :set_proxy
90
+ tokenizer(SimpleTokenizer.options(:remove_whitespace))
91
+ end
92
+
82
93
  ZabconCommand.add_command "logout" do
83
94
  set_method do
84
95
  server.logout
@@ -20,8 +20,8 @@
20
20
 
21
21
  ##########################################
22
22
  # Subversion information
23
- # $Id: zabcon_core.rb 365 2011-12-22 04:26:54Z nelsonab $
24
- # $Revision: 365 $
23
+ # $Id: zabcon_core.rb 370 2011-12-22 05:51:45Z nelsonab $
24
+ # $Revision: 370 $
25
25
  ##########################################
26
26
 
27
27
  #require 'libs/utility_items'
@@ -235,30 +235,18 @@ class ZabconCore
235
235
  ZbxAPI_ParameterError, Command::LoginRequired => e
236
236
  puts e.message
237
237
  retry
238
- #rescue Command::NonFatalError => e
239
- # puts e.message
240
- # retry
241
- #rescue Command::ParameterError => e
242
- # puts e.message
243
- # retry
244
- #rescue ZabbixServer::ConnectionProblem => e
245
- # puts e.message
246
- # retry
247
238
  rescue ParseError => e #catch the base exception class
248
239
  e.show_message
249
240
  retry if e.retry?
250
- #rescue ZbxAPI_ExceptionVersion => e
251
- # puts e
252
- # retry # We will allow for graceful recover from Version exceptions
253
- #rescue ZbxAPI_ExceptionBadAuth => e
254
- # puts e.message
255
- # retry
256
241
  rescue ZbxAPI_ExceptionLoginPermission
257
242
  puts "No login permissions"
258
243
  retry
259
244
  rescue ZbxAPI_ExceptionPermissionError
260
245
  puts "You do not have permission to perform that operation"
261
246
  retry
247
+ rescue ZbxAPI_ExceptionBadServerUrl
248
+ puts "A Zabbix server was not found at that url"
249
+ retry
262
250
  rescue ZbxAPI_GeneralError => e
263
251
  puts "An error was received from the Zabbix server"
264
252
  if e.message.class==Hash
@@ -34,3 +34,6 @@
34
34
  *** 12/21/11 nelsonab
35
35
  * Fixed Bug #89
36
36
  * Fixed Bug #88
37
+
38
+ *** 12/22/11 nelsonab
39
+ * Added proxy server support
@@ -2,6 +2,14 @@ server=http://localhost
2
2
  username=Admin
3
3
  password=zabbix
4
4
 
5
+ #Use the following to enable proxy server support
6
+ #Only "proxy_server" is required to enable proxy support
7
+ #default values are shown
8
+ #proxy_server=
9
+ #proxy_port=3128
10
+ #proxy_user=
11
+ #proxy_password=
12
+
5
13
  # The following is a list of user editable config file options, the following
6
14
  # values are the defaults. These can be changed as needed.
7
15
 
data/zabcon.rb CHANGED
@@ -20,8 +20,8 @@
20
20
 
21
21
  ##########################################
22
22
  # Subversion information
23
- # $Id: zabcon.rb 361 2011-12-19 00:21:52Z richlv $
24
- # $Revision: 361 $
23
+ # $Id: zabcon.rb 370 2011-12-22 05:51:45Z nelsonab $
24
+ # $Revision: 370 $
25
25
  ##########################################
26
26
 
27
27
  #setup our search path or libraries
@@ -42,7 +42,7 @@ DEPENDENCIES={
42
42
  "parseconfig"=>true,
43
43
  "json"=>true,
44
44
  "highline"=>true,
45
- "zbxapi"=>Gem::Version.new("0.1.352")
45
+ "zbxapi"=>Gem::Version.new("0.1.369")
46
46
  }
47
47
 
48
48
 
@@ -175,6 +175,10 @@ class ZabconApp
175
175
  env["server"]=nil
176
176
  env["username"]=nil
177
177
  env["password"]=nil
178
+ env["proxy_server"]=nil
179
+ env["proxy_port"]=3128
180
+ env["proxy_user"]=nil
181
+ env["proxy_password"]=nil
178
182
  env["lines"]=24
179
183
  env["language"]="english"
180
184
  env["logged_in"]=false
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zabcon
3
3
  version: !ruby/object:Gem::Version
4
- hash: 707
4
+ hash: 763
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 366
10
- version: 0.0.366
9
+ - 370
10
+ version: 0.0.370
11
11
  platform: ruby
12
12
  authors:
13
13
  - A. Nelson
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: .
16
16
  cert_chain: []
17
17
 
18
- date: 2011-12-21 00:00:00 -05:00
18
+ date: 2011-12-22 00:00:00 -05:00
19
19
  default_executable: zabcon
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency