elesai 0.10.11 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/elesai/action/check.rb +47 -22
- data/lib/elesai/cli.rb +1 -1
- data/lib/elesai/megacli/megacli.rb +1 -1
- data/lib/elesai/version.rb +1 -1
- metadata +2 -2
data/lib/elesai/action/check.rb
CHANGED
@@ -9,7 +9,7 @@ module Elesai; module Action
|
|
9
9
|
include Senedsa
|
10
10
|
|
11
11
|
def initialize(arguments,options)
|
12
|
-
@options = options.merge!({ :monitor => :nagios, :mode => :active })
|
12
|
+
@options = options.merge!({ :monitor => :nagios, :mode => :active, :diskcachepolicy => nil })
|
13
13
|
@arguments = []
|
14
14
|
@lsi = nil
|
15
15
|
|
@@ -17,11 +17,13 @@ module Elesai; module Action
|
|
17
17
|
opts.banner = "Usage: #{ID} [options] check [check_options]"
|
18
18
|
opts.separator ""
|
19
19
|
opts.separator "Check Options"
|
20
|
-
opts.on('
|
21
|
-
opts.on('
|
22
|
-
opts.on('-
|
23
|
-
opts.on('-
|
24
|
-
opts.on('-
|
20
|
+
opts.on('--hotspare MIN', Integer, "Minimum number of hotspares") { |o| @options[:hotspare] = o }
|
21
|
+
opts.on('--diskcachepolicy DISKCACHEPOLICY', String, "Disk cache policy/Disk Write Cache checks") { |o| @options[:diskcachepolicy] = o }
|
22
|
+
opts.on('-M', '--monitor [nagios]', [:nagios], "Monitoring system") { |o| @options[:monitor] = o }
|
23
|
+
opts.on('-m', '--mode [active|passive]', [:active, :passive], "Monitoring mode") { |o| @options[:mode] = o }
|
24
|
+
opts.on('-H', '--nsca_hostname HOSTNAME', String, "NSCA hostname to send passive checks") { |o| @options[:nsca_hostame] = o }
|
25
|
+
opts.on('-c', '--config CONFIG', String, "Path to Senedsa (send_nsca) configuration" ) { |o| @options[:senedsa_config] = o }
|
26
|
+
opts.on('-S', '--svc_descr SVC_DESR', String, "Nagios service description") { |o| @options[:svc_descr] = o }
|
25
27
|
opts.order!(arguments)
|
26
28
|
|
27
29
|
options_valid?
|
@@ -34,6 +36,8 @@ module Elesai; module Action
|
|
34
36
|
plugin_output = ""
|
35
37
|
plugin_status = ""
|
36
38
|
|
39
|
+
hotspare = 0
|
40
|
+
|
37
41
|
@lsi.physicaldrives.each do |id,physicaldrive|
|
38
42
|
drive_plugin_string = "[PD:#{physicaldrive._id}:#{physicaldrive[:size]}:#{physicaldrive[:mediatype]}:#{physicaldrive[:pdtype]}]"
|
39
43
|
unless physicaldrive[:firmwarestate].state == :online or physicaldrive[:firmwarestate].state == :hotspare
|
@@ -49,15 +53,25 @@ module Elesai; module Action
|
|
49
53
|
plugin_output += " #{drive_plugin_string}:PredictiveFailure:#{physicaldrive[:predictivefailurecount]}"
|
50
54
|
plugin_status = :warning if plugin_status.empty?
|
51
55
|
end
|
56
|
+
hotspare += 1 if physicaldrive[:firmwarestate].state == :hotspare
|
57
|
+
end
|
58
|
+
|
59
|
+
if hotspare < @options[:hotspare].to_i
|
60
|
+
plugin_status = :warning unless plugin_status == :critical
|
61
|
+
plugin_output += " hotspare low watermark (require #{@options[:hotspare]}, have #{hotspare})"
|
52
62
|
end
|
53
63
|
|
54
64
|
@lsi.virtualdrives.each do |vd|
|
55
65
|
vd_plugin_string = "[VD:#{vd._id}]"
|
66
|
+
if @options[:diskcachepolicy] and vd[:diskcachepolicy] != @options[:diskcachepolicy]
|
67
|
+
plugin_output += " #{vd_plugin_string}:diskcachepolicy is not #{@options[:diskcachepolicy]}"
|
68
|
+
plugin_status = :warning
|
69
|
+
end
|
56
70
|
case vd[:state]
|
57
71
|
when :offline, :failed
|
58
72
|
plugin_output += " #{vd_plugin_string}:#{vd[:state]}"
|
59
73
|
plugin_status = :critical
|
60
|
-
when :
|
74
|
+
when :partially_degraded, :degraded
|
61
75
|
plugin_output += " #{vd_plugin_string}:#{vd[:state]}"
|
62
76
|
plugin_status = :warning if plugin_status != :critical
|
63
77
|
when :optimal
|
@@ -66,6 +80,10 @@ module Elesai; module Action
|
|
66
80
|
plugin_status = :unknown
|
67
81
|
plugin_output += " #{vd_plugin_string}:#{vd[:state]}"
|
68
82
|
end
|
83
|
+
unless vd[:currentcachepolicy] =~ /^WriteBack/ and @lsi.bbus[0][:firmwarestatus][:learncycleactive] != 'Yes'
|
84
|
+
plugin_status = :warning
|
85
|
+
plugin_output += " #{vd_plugin_string}:(not in writeback mode)"
|
86
|
+
end
|
69
87
|
end
|
70
88
|
|
71
89
|
@lsi.bbus.each do |bbu|
|
@@ -87,21 +105,23 @@ module Elesai; module Action
|
|
87
105
|
end
|
88
106
|
|
89
107
|
if bbu[:batterytype] == 'iBBU'
|
90
|
-
if bbu[:
|
91
|
-
plugin_output += "
|
108
|
+
if bbu[:batterystate] != 'Operational'
|
109
|
+
plugin_output += " [BBU:#{bbu._id}:batterystate:#{bbu[:batterystate]}]"
|
110
|
+
plugin_status = :warning
|
92
111
|
else
|
93
|
-
|
94
|
-
plugin_output += " [BBU
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
plugin_output += " [BBU:absolutestateofcharge:#{bbu[:gasgaugestatus][:absolutestateofcharge]}]"
|
100
|
-
plugin_status = :warning if plugin_status == ""
|
112
|
+
if bbu[:firmwarestatus][:learncycleactive] == 'Yes'
|
113
|
+
plugin_output += " learn cycle enabled: [BBU:absolutestateofcharge:#{bbu[:gasgaugestatus][:absolutestateofcharge]}]"
|
114
|
+
else
|
115
|
+
unless bbu[:firmwarestatus][:voltage] == 'OK'
|
116
|
+
plugin_output += " [BBU:#{bbu._id}:voltage:#{bbu[:firmwarestatus][:voltage]}]"
|
117
|
+
plugin_status = :warning if plugin_status == ''
|
101
118
|
end
|
102
|
-
|
103
|
-
|
104
|
-
|
119
|
+
remainingcapacity = bbu[:capacityinfo][:remainingcapacity].number
|
120
|
+
designcapacity = bbu[:designinfo][:designcapacity].number
|
121
|
+
bbupercent = (remainingcapacity.to_f / designcapacity.to_f) * 100
|
122
|
+
if bbupercent < 70
|
123
|
+
plugin_output += " [BBU: #{bbupercent.to_i} percent of original capacity remaining]"
|
124
|
+
plugin_status = :warning if plugin_status == ''
|
105
125
|
end
|
106
126
|
end
|
107
127
|
end
|
@@ -109,8 +129,13 @@ module Elesai; module Action
|
|
109
129
|
end
|
110
130
|
|
111
131
|
if plugin_output.empty? and plugin_status.empty?
|
112
|
-
@lsi.adapters.
|
113
|
-
|
132
|
+
if @lsi.adapters.empty?
|
133
|
+
plugin_status = :warning
|
134
|
+
plugin_output = 'no adapters found'
|
135
|
+
else
|
136
|
+
@lsi.adapters.each do |adapter|
|
137
|
+
plugin_output += " [#{adapter._id}: #{adapter[:versions][:productname].gsub(/\s+/,'_')} OK]"
|
138
|
+
end
|
114
139
|
end
|
115
140
|
end
|
116
141
|
plugin_status = :ok if plugin_status.empty?
|
data/lib/elesai/cli.rb
CHANGED
@@ -64,7 +64,7 @@ module Elesai
|
|
64
64
|
opts.on('-V', '--version', "Display #{ID} version") { output_message VERSION, 0 }
|
65
65
|
opts.on_tail('--help', "Show this message") { @options[:HELP] = true }
|
66
66
|
|
67
|
-
opts.order!(@arguments)
|
67
|
+
opts.order!(@arguments) unless @whoami == :check_lsi
|
68
68
|
output_message opts, 0 if (@arguments.size == 0 and @whoami != :check_lsi) or @options[:HELP]
|
69
69
|
|
70
70
|
@action = @whoami == :check_lsi ? :check : @arguments.shift.to_sym
|
@@ -163,7 +163,7 @@ module Elesai; module Megacli
|
|
163
163
|
v = v.scan(/[A-Z]/).join
|
164
164
|
when :inquirydata
|
165
165
|
v = v.gsub(/\s+/,' ')
|
166
|
-
when :
|
166
|
+
when :relativestateofcharge, :absolutestateofcharge, :remainingcapacity, :designcapacity # :remainingcapacityalarm is treated a plain string
|
167
167
|
m = /(?<number>[0-9\.]+)\s+(?<unit>[A-Za-z%]+)/.match(v)
|
168
168
|
v = LSI::BBU::NumberUnit.new(m[:number].to_f,m[:unit])
|
169
169
|
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.11.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:
|
12
|
+
date: 2014-05-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: workflow
|