zabcon 0.0.357 → 0.0.366

Sign up to get free protection for your applications and to get access to all the features.
data/libs/command_tree.rb CHANGED
@@ -19,8 +19,8 @@
19
19
  #--
20
20
  ##########################################
21
21
  # Subversion information
22
- # $Id: command_tree.rb 347 2011-11-23 06:59:47Z nelsonab $
23
- # $Revision: 347 $
22
+ # $Id: command_tree.rb 365 2011-12-22 04:26:54Z nelsonab $
23
+ # $Revision: 365 $
24
24
  ##########################################
25
25
  #++
26
26
 
@@ -439,7 +439,7 @@ class Command
439
439
  end
440
440
 
441
441
  def call_tokenizer(parameters)
442
- debug(6,:msg=>"parameters",:var=>"\"#{parameters.to_s}\"")
442
+ debug(6,:msg=>"parameters",:var=>"\"#{parameters.inspect}\"")
443
443
  debug(7,:msg=>"Using tokenizer", :var=>@tokenizer.to_s)
444
444
  tokenized_parameters=@tokenizer.new(parameters)
445
445
  tokenized_parameters=@tokenizer_method.call(tokenized_parameters) if @tokenizer_method
@@ -448,7 +448,7 @@ class Command
448
448
  end
449
449
 
450
450
  def call_arg_processor(parameters)
451
- debug(6,:msg=>"parameters",:var=>"\"#{parameters.to_s}\"")
451
+ debug(6,:msg=>"parameters",:var=>"\"#{parameters.inspect}\"")
452
452
  check_parameters(parameters)
453
453
  @arguments=Arguments.new(parameters, @flags)
454
454
  debug(6,:var=>@arguments)
@@ -480,7 +480,7 @@ class Command
480
480
 
481
481
  puts @depreciated if !@depreciated.nil?
482
482
  if !@flags.nil? && @flags[:login_required] && !server.connected?
483
- raise LoginRequired.new("\"#{@command_name}\" requires an active login")
483
+ raise LoginRequired.new("\"#{@path.join(" ")}\" requires an active login")
484
484
  end
485
485
 
486
486
  @response.data=@cmd_method.call(parameters)
data/libs/help.xml CHANGED
@@ -21,8 +21,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
21
 
22
22
  ##########################################
23
23
  Subversion information
24
- $Id: help.xml 281 2011-04-06 18:10:16Z nelsonab $
25
- $Revision: 281 $
24
+ $Id: help.xml 361 2011-12-19 00:21:52Z richlv $
25
+ $Revision: 361 $
26
26
  ##########################################
27
27
 
28
28
  Zabcon help file
@@ -166,7 +166,7 @@ Add Item
166
166
  syntax: add item type=active hostid=num description="some text" key="item.key"
167
167
 
168
168
  valid parameters:
169
- hostid, snmpv3_securitylevel, snmp_community, publickey, delta, history,
169
+ hostid, snmpv3_securitylevel, snmp_community, publickey, delta, history,
170
170
  key, snmp_oid, delay_flex, multiplier, delay, mtime, username, authtype,
171
171
  data_type, ipmi_sensor,snmpv3_authpassphrase, prevorgvalue, units, trends,
172
172
  snmp_port, formula, type, params, logtimefmt, snmpv3_securityname,
@@ -242,7 +242,7 @@ syntax: delete user id=num
242
242
 
243
243
  <item command="delete_item">
244
244
  Delete Item
245
- syntax: delete item itemid=num
245
+ syntax: delete item itemid=num
246
246
  itemid must be a number
247
247
  </item>
248
248
 
data/libs/input.rb CHANGED
@@ -18,8 +18,8 @@
18
18
 
19
19
  ##########################################
20
20
  # Subversion information
21
- # $Id: input.rb 272 2011-01-06 21:04:22Z nelsonab $
22
- # $Revision: 272 $
21
+ # $Id: input.rb 361 2011-12-19 00:21:52Z richlv $
22
+ # $Revision: 361 $
23
23
  ##########################################
24
24
 
25
25
  require 'readline'
data/libs/lexer.rb CHANGED
@@ -19,8 +19,8 @@
19
19
  #--
20
20
  ##########################################
21
21
  # Subversion information
22
- # $Id: lexer.rb 345 2011-11-23 04:28:53Z nelsonab $
23
- # $Revision: 345 $
22
+ # $Id: lexer.rb 361 2011-12-19 00:21:52Z richlv $
23
+ # $Revision: 361 $
24
24
  ##########################################
25
25
  #++
26
26
 
data/libs/printer.rb CHANGED
@@ -19,8 +19,8 @@
19
19
 
20
20
  ##########################################
21
21
  # Subversion information
22
- # $Id: printer.rb 332 2011-09-30 07:24:38Z nelsonab $
23
- # $Revision: 332 $
22
+ # $Id: printer.rb 361 2011-12-19 00:21:52Z richlv $
23
+ # $Revision: 361 $
24
24
  ##########################################
25
25
 
26
26
  require 'zbxapi/zdebug'
@@ -348,7 +348,7 @@ class OutputPrinter
348
348
  else
349
349
  cols_to_show=cols.empty? ? nil : cols[:show]
350
350
  end
351
-
351
+
352
352
  puts dataset.message if dataset.message
353
353
 
354
354
  # p dataset[:result].class
data/libs/revision.rb CHANGED
@@ -1 +1 @@
1
- REVISION=357
1
+ REVISION=366
@@ -17,8 +17,8 @@
17
17
 
18
18
  ##########################################
19
19
  # Subversion information
20
- # $Id: utility_items.rb 325 2011-09-26 08:57:00Z nelsonab $
21
- # $Revision: 325 $
20
+ # $Id: utility_items.rb 361 2011-12-19 00:21:52Z richlv $
21
+ # $Revision: 361 $
22
22
  ##########################################
23
23
 
24
24
  require "zbxapi/zdebug"
@@ -22,6 +22,7 @@
22
22
  # $Revision: 325 $
23
23
  ##########################################
24
24
 
25
+ require 'yaml'
25
26
  require 'zbxapi'
26
27
  require 'zbxapi/zdebug'
27
28
  require 'libs/zabcon_globals'
@@ -101,6 +102,8 @@ class ZabbixServer
101
102
  File.open(path,"w") do |f|
102
103
  f.write({"auth"=>@connection.auth}.to_yaml)
103
104
  end
105
+ #Enforce that the auth cache file isn't world readable
106
+ File.chmod(0600,path)
104
107
  end
105
108
 
106
109
  end
@@ -17,8 +17,8 @@
17
17
 
18
18
  ##########################################
19
19
  # Subversion information
20
- # $Id: zabcon_commands.rb 350 2011-11-23 09:46:46Z nelsonab $
21
- # $Revision: 350 $
20
+ # $Id: zabcon_commands.rb 364 2011-12-22 04:21:13Z nelsonab $
21
+ # $Revision: 364 $
22
22
  ##########################################
23
23
 
24
24
  require "zbxapi/zdebug"
@@ -267,10 +267,14 @@ ZabconCommand.add_command "raw api" do
267
267
  params.delete_at(0)
268
268
  args={}
269
269
  if !params.empty?
270
- args=ExpressionTokenizerHash.new(params.join(" ")).parse
270
+ params.each { |param|
271
+ if param.is_a?(Hash)
272
+ args.merge!(param)
273
+ else
274
+ raise Command::ParameterError.new("Unexpected parameter \"#{param}\"")
275
+ end
276
+ }
271
277
  end
272
- #api_func=params[:method]
273
- #params=params[:params]
274
278
  server.connection.raw_api(api_func, args)
275
279
  end
276
280
 
data/libs/zabcon_core.rb CHANGED
@@ -20,8 +20,8 @@
20
20
 
21
21
  ##########################################
22
22
  # Subversion information
23
- # $Id: zabcon_core.rb 350 2011-11-23 09:46:46Z nelsonab $
24
- # $Revision: 350 $
23
+ # $Id: zabcon_core.rb 365 2011-12-22 04:26:54Z nelsonab $
24
+ # $Revision: 365 $
25
25
  ##########################################
26
26
 
27
27
  #require 'libs/utility_items'
@@ -29,6 +29,7 @@ require 'libs/revision'
29
29
  require 'parseconfig'
30
30
  require 'ostruct'
31
31
  require 'rexml/document'
32
+ require 'yaml'
32
33
  require 'libs/zabbix_server'
33
34
  require 'libs/printer'
34
35
  require 'zbxapi/zdebug'
@@ -185,6 +186,7 @@ class ZabconCore
185
186
  end
186
187
 
187
188
  return if load_path.nil? || load_path.empty?
189
+ env["load_count"]||=0
188
190
 
189
191
  load_path.each { |f|
190
192
  env["load_count"]+=1
@@ -227,27 +229,30 @@ class ZabconCore
227
229
 
228
230
  end # while
229
231
  end #end catch
230
- rescue CommandList::InvalidCommand => e
231
- puts e.message
232
- retry
233
- rescue Command::NonFatalError => e
234
- puts e.message
235
- retry
236
- rescue Command::ParameterError => e
237
- puts e.message
238
- retry
239
- rescue ZabbixServer::ConnectionProblem => e
232
+ rescue CommandList::InvalidCommand, Command::NonFatalError,
233
+ Command::ParameterError, ZabbixServer::ConnectionProblem,
234
+ ZbxAPI_ExceptionVersion, ZbxAPI_ExceptionBadAuth,
235
+ ZbxAPI_ParameterError, Command::LoginRequired => e
240
236
  puts e.message
241
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
242
247
  rescue ParseError => e #catch the base exception class
243
248
  e.show_message
244
249
  retry if e.retry?
245
- rescue ZbxAPI_ExceptionVersion => e
246
- puts e
247
- retry # We will allow for graceful recover from Version exceptions
248
- rescue ZbxAPI_ExceptionBadAuth => e
249
- puts e.message
250
- 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
251
256
  rescue ZbxAPI_ExceptionLoginPermission
252
257
  puts "No login permissions"
253
258
  retry
data/revision_information CHANGED
@@ -27,3 +27,10 @@
27
27
  which is determined by the config file option "session_file". When starting
28
28
  this file is interrogated if an auth key is found, Zabcon will try to use it.
29
29
  If the auth key does not work it continues with the normal startup sequence.
30
+ * Configured auth cache file to have permissions of 0600
31
+ * Fixed crash with ZBXAPI_ParameterError
32
+ * Fixed command line override for auth
33
+
34
+ *** 12/21/11 nelsonab
35
+ * Fixed Bug #89
36
+ * Fixed Bug #88
data/zabcon.conf.default CHANGED
@@ -1,5 +1,5 @@
1
1
  server=http://localhost
2
- username=admin
2
+ username=Admin
3
3
  password=zabbix
4
4
 
5
5
  # The following is a list of user editable config file options, the following
@@ -61,9 +61,9 @@ password=zabbix
61
61
  #show_load=all
62
62
 
63
63
  #dir1=custom_commands
64
- #If custom_commands is a directory in /usr/local/zabcon all files i that
64
+ #If custom_commands is a directory in /usr/local/zabcon all files in that
65
65
  #directory, except (dot) files, will be loaded because the base search
66
- #path is /usr/loca/zabcon
66
+ #path is /usr/local/zabcon
67
67
 
68
68
  #dir2=~/zabcon_commands
69
69
  #file1=~/my_zabcon_commands.rb
data/zabcon.rb CHANGED
@@ -20,8 +20,8 @@
20
20
 
21
21
  ##########################################
22
22
  # Subversion information
23
- # $Id: zabcon.rb 325 2011-09-26 08:57:00Z nelsonab $
24
- # $Revision: 325 $
23
+ # $Id: zabcon.rb 361 2011-12-19 00:21:52Z richlv $
24
+ # $Revision: 361 $
25
25
  ##########################################
26
26
 
27
27
  #setup our search path or libraries
@@ -148,10 +148,10 @@ class ZabconApp
148
148
  @cmd_opts.debug=level
149
149
  end
150
150
  opts.on("-s","--session PATH","Path to the file to store session information.") do |session|
151
- @cmd.session_file=session
151
+ @cmd_opts.session_file=session
152
152
  end
153
153
  opts.on("--no-session","Disable checking of the session file on startup") do
154
- @cmd.session_file=""
154
+ @cmd_opts.session_file=""
155
155
  end
156
156
  opts.on("-e", "--[no-]echo", "Enable startup echo. Default is on ","for interactive") do |echo|
157
157
  @cmd_opts.echo=echo
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: 725
4
+ hash: 707
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 357
10
- version: 0.0.357
9
+ - 366
10
+ version: 0.0.366
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-18 00:00:00 -05:00
18
+ date: 2011-12-21 00:00:00 -05:00
19
19
  default_executable: zabcon
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency