sensu-plugins-oracle 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 80bd1e06aff16e62bea837f8bb3a8e44672d1ddb
4
- data.tar.gz: 4548f9762ff46236e75d199022210033026e069c
3
+ metadata.gz: d7338524ee2ae194aea43ef87ef3bbf1c53dc122
4
+ data.tar.gz: d514efcb96e4ea00bf62d06db8a9404be6d837b3
5
5
  SHA512:
6
- metadata.gz: bd1042cb02c2138bab8e784aac2053cb396472cf8e33cfc9b76eeef294bed1a07506c7dd31d810a527e2c3b76ebb39b950c834bb3a70ff3ec60c05e3e73f71d4
7
- data.tar.gz: 4e1023c1841f6709fdd1d4ad916c0c55e51729443ce8e69bf2c76b67a3580b02452739f5087042af0ca435c62c5b43dffa860d17e9aa7a8dadfc9a310efcd92e
6
+ metadata.gz: 75f3e2fe2b49b5fb13063d3dd24193f975862ab4b1c68b1488e3e5c44bf62dcc50fc35fdc10dbd0283285753f2b5fea3966cdf01b5b66af321c7058475b333a5
7
+ data.tar.gz: 3f6153e5a25035f301ca0a943ee0acfafc1a6542dc927f6bd9e724ab8513069da556c2d84ae9072f7b66bc3220daba2f2d538e98b203ea06ad26b93a6d5ee36d
@@ -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
- if results[:warning].size > 0
166
- method = :warning
167
- messages << nil
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 << 'CRITICAL'
176
- messages << results[:critical].compact.sort.join("\n\n")
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
- return :critical, show(config[:show]) if config[:critical] && calc.evaluate(config[:critical], value: value)
82
- return :warning, show(config[:show]) if config[:warning] && calc.evaluate(config[:warning], value: value)
83
- return :ok, show(config[:show])
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
@@ -2,7 +2,7 @@ module SensuPluginsOracle
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- PATCH = 1
5
+ PATCH = 2
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-oracle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors