elesai 0.5.4 → 0.5.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/elesai/cli.rb +4 -3
- data/lib/elesai/megacli.rb +4 -6
- data/lib/elesai/version.rb +1 -1
- metadata +2 -1
data/lib/elesai/cli.rb
CHANGED
@@ -80,6 +80,7 @@ module Elesai
|
|
80
80
|
output_message opts, 0 if @arguments.size == 0 or @global_options[:HELP]
|
81
81
|
|
82
82
|
@action = ARGV.shift.to_sym
|
83
|
+
raise OptionParser::InvalidArgument, "invalid action #@action" if actions[@action].nil?
|
83
84
|
actions[@action].order!
|
84
85
|
end
|
85
86
|
|
@@ -101,8 +102,8 @@ module Elesai
|
|
101
102
|
def options_valid?
|
102
103
|
case @action
|
103
104
|
when :check
|
104
|
-
raise OptionParser::MissingArgument, "NSCA hostname (-H) must be specified" if @action_options[:nsca_hostname].nil?
|
105
|
-
raise OptionParser::MissingArgument, "service description (-S) must be specified" if @action_options[:svc_descr].nil?
|
105
|
+
raise OptionParser::MissingArgument, "NSCA hostname (-H) must be specified" if @action_options[:nsca_hostname].nil? and @action_options[:mode] == 'passive'
|
106
|
+
raise OptionParser::MissingArgument, "service description (-S) must be specified" if @action_options[:svc_descr].nil? and @action_options[:mode] == 'passive'
|
106
107
|
end
|
107
108
|
end
|
108
109
|
|
@@ -166,7 +167,7 @@ module Elesai
|
|
166
167
|
end
|
167
168
|
end
|
168
169
|
|
169
|
-
plugin_output = "no RAID
|
170
|
+
plugin_output = "no LSI RAID errors found" if plugin_output.empty? and plugin_status.empty?
|
170
171
|
plugin_status = :ok if plugin_status.empty?
|
171
172
|
|
172
173
|
case @action_options[:monitor]
|
data/lib/elesai/megacli.rb
CHANGED
@@ -11,7 +11,7 @@ module Elesai
|
|
11
11
|
VIRTUALDRIVE_RE = /^Virtual\s+Drive:\s+\d+\s+\((?<key>Target\s+Id):\s+(?<value>\d+)\)/
|
12
12
|
SPAN_RE = /^Span:\s+(?<value>\d+)/
|
13
13
|
PHYSICALDRIVE_RE = /^(?<key>Enclosure\s+Device\s+ID):\s+(?<value>\d+)/
|
14
|
-
ATTRIBUTE_RE = /^(?<key>[A-Za-z0-9()\s#]+):(?<value>.*)/
|
14
|
+
ATTRIBUTE_RE = /^(?<key>[A-Za-z0-9()\s#']+):(?<value>.*)/
|
15
15
|
EXIT_RE = /^Exit Code: /
|
16
16
|
|
17
17
|
### Context
|
@@ -253,16 +253,14 @@ module Elesai
|
|
253
253
|
|
254
254
|
@lsi = lsi
|
255
255
|
@log = Elesai::Logger.instance.log
|
256
|
+
output = nil
|
256
257
|
|
257
258
|
if STDIN.tty?
|
258
259
|
if opts[:fake].start_with? '-'
|
259
260
|
megacli = opts[:megacli].nil? ? "Megacli" : opts[:megacli]
|
260
261
|
command = "#{megacli} #{opts[:fake]} -nolog"
|
261
|
-
output = Open3.
|
262
|
-
|
263
|
-
raise RuntimeError, stderr.gets.chomp unless wait_thr.value.exitstatus == 0
|
264
|
-
stdout.gets
|
265
|
-
end
|
262
|
+
output, stderr_str, status = Open3.capture3(command)
|
263
|
+
raise RuntimeError, stderr_str unless status.exitstatus == 0
|
266
264
|
else
|
267
265
|
output = File.read(opts[:fake])
|
268
266
|
end
|
data/lib/elesai/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elesai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -106,3 +106,4 @@ signing_key:
|
|
106
106
|
specification_version: 3
|
107
107
|
summary: Wrapper for LSI's MegaCli utility
|
108
108
|
test_files: []
|
109
|
+
has_rdoc:
|