elesai 0.8.0 → 0.9.0
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/lib/elesai/cli.rb +28 -1
- data/lib/elesai/lsi.rb +14 -1
- data/lib/elesai/megacli.rb +3 -0
- data/lib/elesai/version.rb +1 -1
- metadata +2 -2
data/lib/elesai/cli.rb
CHANGED
@@ -11,7 +11,7 @@ module Elesai
|
|
11
11
|
class CLI
|
12
12
|
|
13
13
|
COMMANDS = %w(show check)
|
14
|
-
COMPONENTS = %w(virtualdrive vd physicaldrive pd)
|
14
|
+
COMPONENTS = %w(virtualdrive vd physicaldrive pd bbu)
|
15
15
|
DEFAULT_CONFIG_FILE = File.join(ENV['HOME'],"/.senedsa/config")
|
16
16
|
|
17
17
|
def initialize(arguments)
|
@@ -187,6 +187,33 @@ module Elesai
|
|
187
187
|
end
|
188
188
|
end
|
189
189
|
|
190
|
+
@lsi.bbus.each do |bbu|
|
191
|
+
[:voltage, :temperature, :learncyclestatus].each do |attr|
|
192
|
+
unless bbu[:firmwarestatus][attr] == 'OK'
|
193
|
+
plugin_output += " [BBU:#{bbu._id}:#{attr}:#{bbu[:firmwarestatus][attr]}]"
|
194
|
+
plugin_status = :warning if plugin_status == ""
|
195
|
+
end
|
196
|
+
end
|
197
|
+
[:batterypackmissing, :batteryreplacementrequired].each do |attr|
|
198
|
+
unless bbu[:firmwarestatus][attr] == 'No'
|
199
|
+
plugin_output += " [BBU:#{attr}:#{bbu[:firmwarestatus][attr]}]"
|
200
|
+
plugin_status = :warning if plugin_status == ""
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
if bbu[:batterytype] == 'iBBU'
|
205
|
+
if bbu[:gasgaugestatus][:absolutestateofcharge].number <= 50
|
206
|
+
plugin_output += " [BBU:absolutestateofcharge:#{bbu[:gasgaugestatus][:absolutestateofcharge]}]"
|
207
|
+
plugin_status = :warning if plugin_status == ""
|
208
|
+
end
|
209
|
+
|
210
|
+
if bbu[:capacityinfo][:remainingcapacity].number <= bbu[:capacityinfo][:remainingcapacityalarm].number
|
211
|
+
plugin_output += " [BBU:remainingcapacity:#{bbu[:capacityinfo][:remainingcapacityalarm]}]"
|
212
|
+
plugin_status = :warning if plugin_status == ""
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
190
217
|
plugin_output = " no LSI RAID errors found" if plugin_output.empty? and plugin_status.empty?
|
191
218
|
plugin_status = :ok if plugin_status.empty?
|
192
219
|
|
data/lib/elesai/lsi.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'ap'
|
2
|
+
|
1
3
|
module Elesai
|
2
4
|
|
3
5
|
class LSIArray
|
@@ -22,6 +24,7 @@ module Elesai
|
|
22
24
|
else
|
23
25
|
PDlist_aAll.new.parse!(self,opts)
|
24
26
|
LDPDinfo_aAll.new.parse!(self,opts)
|
27
|
+
AdpBbuCmd_aAll.new.parse!(self,opts)
|
25
28
|
end
|
26
29
|
end
|
27
30
|
|
@@ -217,6 +220,10 @@ module Elesai
|
|
217
220
|
|
218
221
|
class BBU < Hash
|
219
222
|
|
223
|
+
class NumberUnit < Struct.new(:number, :unit)
|
224
|
+
def to_s ; "%d%s" % [self.number,self.unit] end
|
225
|
+
end
|
226
|
+
|
220
227
|
class Stub < Hash
|
221
228
|
def inspect
|
222
229
|
"#{self.class}:#{self.__id__}"
|
@@ -239,12 +246,18 @@ module Elesai
|
|
239
246
|
self[:capacityinfo][:absolutestateofcharge] = '-'
|
240
247
|
end
|
241
248
|
|
249
|
+
def _id
|
250
|
+
self[:id]
|
251
|
+
end
|
252
|
+
|
242
253
|
def inspect
|
243
254
|
"#{self.class}:#{self.__id__}"
|
244
255
|
end
|
245
256
|
|
246
257
|
def to_s
|
247
|
-
|
258
|
+
self[:capacityinfo][:absolutestateofcharge] = '-' unless self[:batterytype] == "iBBU"
|
259
|
+
self[:capacityinfo][:remainingcapacity] = '-' unless self[:batterytype] == "iBBU"
|
260
|
+
"[BBU] %s %-5s %-4s %-11s %3s:%-8s %s:%s %s:%s %7s:%-4s %s" % [self[:id],self[:batterytype],self[:designinfo][:devicechemistry],self[:firmwarestatus][:chargingstatus],self[:firmwarestatus][:learncycleactive],self[:firmwarestatus][:learncyclestatus],self[:voltage].gsub(/\s/,''),self[:firmwarestatus][:voltage],self[:temperature].gsub(/\s/,''),self[:firmwarestatus][:temperature],self[:capacityinfo][:remainingcapacity],self[:capacityinfo][:absolutestateofcharge],self[:properties][:nextlearntime]]
|
248
261
|
#puts self[:firmwarestatus].keys
|
249
262
|
end
|
250
263
|
end
|
data/lib/elesai/megacli.rb
CHANGED
@@ -219,6 +219,9 @@ module Elesai
|
|
219
219
|
v = v.scan(/[A-Z]/).join
|
220
220
|
when :inquirydata
|
221
221
|
v = v.gsub(/\s+/,' ')
|
222
|
+
when :relativedtateofcharge, :absolutestateofcharge, :remainingcapacityalarm, :remainingcapacity
|
223
|
+
m = /(?<number>[0-9\.]+)\s+(?<unit>[A-Za-z%]+)/.match(v)
|
224
|
+
v = LSIArray::BBU::NumberUnit.new(m[:number].to_f,m[:unit])
|
222
225
|
end
|
223
226
|
c[k] = v
|
224
227
|
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.
|
4
|
+
version: 0.9.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09
|
12
|
+
date: 2012-11-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: workflow
|