sensu-plugins-oracle 0.3.1 → 0.3.2
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.
- checksums.yaml +4 -4
- data/bin/check-oracle-query.rb +5 -15
- data/lib/sensu-plugins-oracle/session.rb +7 -4
- data/lib/sensu-plugins-oracle/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7338524ee2ae194aea43ef87ef3bbf1c53dc122
|
4
|
+
data.tar.gz: d514efcb96e4ea00bf62d06db8a9404be6d837b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75f3e2fe2b49b5fb13063d3dd24193f975862ab4b1c68b1488e3e5c44bf62dcc50fc35fdc10dbd0283285753f2b5fea3966cdf01b5b66af321c7058475b333a5
|
7
|
+
data.tar.gz: 3f6153e5a25035f301ca0a943ee0acfafc1a6542dc927f6bd9e724ab8513069da556c2d84ae9072f7b66bc3220daba2f2d538e98b203ea06ad26b93a6d5ee36d
|
data/bin/check-oracle-query.rb
CHANGED
@@ -126,7 +126,6 @@ class CheckOracleQuery < Sensu::Plugin::Check::CLI
|
|
126
126
|
def handle_connections_from_file
|
127
127
|
sessions = ::SensuPluginsOracle::Session.parse_from_file(config[:file])
|
128
128
|
|
129
|
-
sessions_total = sessions.size
|
130
129
|
results = Hash.new { |h, key| h[key] = [] }
|
131
130
|
|
132
131
|
thread_group = ThreadGroup.new
|
@@ -151,9 +150,6 @@ class CheckOracleQuery < Sensu::Plugin::Check::CLI
|
|
151
150
|
thread_group.list.map(&:join)
|
152
151
|
|
153
152
|
# return summary plus warning and critical messages
|
154
|
-
sessions_ok = results[:ok].size
|
155
|
-
|
156
|
-
# default values
|
157
153
|
method = :ok
|
158
154
|
header = ["Total: #{sessions.size}"]
|
159
155
|
header << "Ok: #{results[:ok].size}" if results[:ok].size > 0
|
@@ -162,18 +158,12 @@ class CheckOracleQuery < Sensu::Plugin::Check::CLI
|
|
162
158
|
|
163
159
|
messages = [header.join(', ')]
|
164
160
|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
messages << 'WARNING'
|
169
|
-
messages << results[:warning].compact.sort.join("\n\n")
|
170
|
-
end
|
171
|
-
|
172
|
-
if results[:critical].size > 0
|
173
|
-
method = :critical
|
161
|
+
[:warning, :critical].each do |type|
|
162
|
+
if results[type].size > 0
|
163
|
+
method = type
|
174
164
|
messages << nil
|
175
|
-
messages <<
|
176
|
-
messages << results[
|
165
|
+
messages << type.to_s.capitalize
|
166
|
+
messages << results[type].compact.sort.join("\n\n")
|
177
167
|
end
|
178
168
|
|
179
169
|
send(method, messages.join("\n"))
|
@@ -61,7 +61,7 @@ module SensuPluginsOracle
|
|
61
61
|
cursor = @connection.exec(query_string)
|
62
62
|
|
63
63
|
@rows = []
|
64
|
-
while row = cursor.fetch
|
64
|
+
while (row = cursor.fetch)
|
65
65
|
@rows << row
|
66
66
|
end
|
67
67
|
cursor.close
|
@@ -78,9 +78,12 @@ module SensuPluginsOracle
|
|
78
78
|
value = @rows[0][0].to_f if @rows[0] && !config[:tuples]
|
79
79
|
|
80
80
|
calc = Dentaku::Calculator.new
|
81
|
-
|
82
|
-
|
83
|
-
|
81
|
+
|
82
|
+
method = :ok
|
83
|
+
method = :warning if config[:warning] && calc.evaluate(config[:warning], value: value)
|
84
|
+
method = :critical if config[:critical] && calc.evaluate(config[:critical], value: value)
|
85
|
+
|
86
|
+
return method, show(config[:show])
|
84
87
|
end
|
85
88
|
|
86
89
|
private
|