sensu-plugins-redis 2.3.2 → 2.4.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4773786d2e50182212d94a597744aaaf6656a459e9a789f9cd63f8df5dc7a22c
4
- data.tar.gz: 6f0411bfbb6e3d3476ee118fad86f23d0b724a9b219a2dafe30f18c9f6d071bc
3
+ metadata.gz: 21ee163d20baee0f248d8085a48d8511f2dc4e2799458167f50c81d796183e1c
4
+ data.tar.gz: 7238e21603f96a50a0ef9b7f22090cf4b9a2b0f7783fd2a493ac2f8756dcab53
5
5
  SHA512:
6
- metadata.gz: f3e545904b31cbfed1ac6808d15d8d06c36641a589ee0131bfc9e8a0d9f27b45e62c9f1ff126294bde4e9ec4fe5482b20deb651e365322c2c5d0670decfb5864
7
- data.tar.gz: 61a682455fff935ee060fb1deffd5c5ec8ad31591e4f516197dc38b4aeb4dafa66c965ef53bbf68d325a26e6bf6d9257eca3c37b8f5b78c1a2d59179e039e143
6
+ metadata.gz: b901997098d32faac012e28ff3cac03e3d124c857c54cd063020c5b41f7d54cd8ec6b02d03990002e3a2cbca07271a1f1b924aa395774ff78499e1e018c39b84
7
+ data.tar.gz: 507e5d1e1c6e3947faba2d7be759778b7b1281e37ab8787957fad2d4ad3ba6cbaf900ffcbfcc7979bf9e0c56a7fe08586e34b0e2fd7b739a5cb1ad744846d6ac
data/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [2.4.0] - 2018-03-14
10
+ ### Added
11
+ - check-redis-connections-available.rb: checks the number of connections available (@nishiki)
12
+
9
13
  ## [2.3.2] - 2017-12-21
10
14
  ### Fixed
11
15
  - locked `development_dependency` of `mixlib-shellout` on to fix ruby 2.1 support (@majormoses)
@@ -131,7 +135,8 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
131
135
  ### Added
132
136
  - initial release
133
137
 
134
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-redis/compare/2.3.2...HEAD
138
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-redis/compare/2.4.0...HEAD
139
+ [2.4.0]: https://github.com/sensu-plugins/sensu-plugins-redis/compare/2.3.2...2.4.0
135
140
  [2.3.2]: https://github.com/sensu-plugins/sensu-plugins-redis/compare/2.3.1...2.3.2
136
141
  [2.3.1]: https://github.com/sensu-plugins/sensu-plugins-redis/compare/2.3.0...2.3.1
137
142
  [2.3.0]: https://github.com/sensu-plugins/sensu-plugins-redis/compare/2.2.2...2.3.0
data/README.md CHANGED
@@ -16,6 +16,7 @@
16
16
  * bin/check-redis-memory-percentage.rb
17
17
  * bin/check-redis-ping.rb
18
18
  * bin/check-redis-slave-status.rb
19
+ * bin/check-redis-connections-available.rb
19
20
  * bin/metrics-redis-graphite.rb
20
21
  * bin/metrics-redis-llen.rb
21
22
 
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # check-redis-connection.rb
4
+ #
5
+ # DESCRIPTION:
6
+ # This plugin checks the number of connections available on redis
7
+ #
8
+ # OUTPUT:
9
+ # plain text
10
+ #
11
+ # PLATFORMS:
12
+ # Linux
13
+ #
14
+ # DEPENDENCIES:
15
+ # gem: sensu-plugin
16
+ #
17
+ # USAGE:
18
+ # check-redis-connections-available.rb -c COUNT -w COUNT -h HOST
19
+ #
20
+ # LICENSE:
21
+ # Copyright Adrien Waksberg <adrien.waksberg@doctolib.fr>
22
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
23
+ # for details.
24
+ #
25
+
26
+ require 'sensu-plugin/check/cli'
27
+ require 'redis'
28
+ require_relative '../lib/redis_client_options'
29
+
30
+ class RedisConnectionsAvailable < Sensu::Plugin::Check::CLI
31
+ include RedisClientOptions
32
+
33
+ option :critical,
34
+ short: '-c COUNT',
35
+ long: '--critical COUNT',
36
+ description: 'COUNT critical threshold for number of connections available',
37
+ proc: proc(&:to_i),
38
+ required: true
39
+
40
+ option :warning,
41
+ short: '-w COUNT',
42
+ long: '--warning COUNT',
43
+ description: 'COUNT warning threshold for number of connections available',
44
+ proc: proc(&:to_i),
45
+ required: true
46
+
47
+ def run
48
+ redis = Redis.new(default_redis_options)
49
+ maxclients = redis.config('get', 'maxclients').last.to_i
50
+ clients = redis.info.fetch('connected_clients').to_i
51
+ conn_available = maxclients - clients
52
+
53
+ if conn_available <= config[:critical]
54
+ critical "Only #{conn_available} connections left available (#{clients}/#{maxclients})"
55
+ elsif conn_available <= config[:warning]
56
+ warning "Only #{conn_available} connections left available (#{clients}/#{maxclients})"
57
+ else
58
+ ok "There are #{conn_available} connections available (#{clients}/#{maxclients})"
59
+ end
60
+
61
+ rescue
62
+ send(config[:conn_failure_status], "Could not connect to Redis server on #{redis_endpoint}")
63
+ end
64
+ end
@@ -1,8 +1,8 @@
1
1
  module SensuPluginsRedis
2
2
  module Version
3
3
  MAJOR = 2
4
- MINOR = 3
5
- PATCH = 2
4
+ MINOR = 4
5
+ PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.2
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-21 00:00:00.000000000 Z
11
+ date: 2018-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin
@@ -254,6 +254,7 @@ executables:
254
254
  - metrics-redis-llen.rb
255
255
  - check-redis-info.rb
256
256
  - check-redis-list-length.rb
257
+ - check-redis-connections-available.rb
257
258
  - check-redis-memory-percentage.rb
258
259
  - check-redis-slave-status.rb
259
260
  - check-redis-keys.rb
@@ -263,6 +264,7 @@ files:
263
264
  - CHANGELOG.md
264
265
  - LICENSE
265
266
  - README.md
267
+ - bin/check-redis-connections-available.rb
266
268
  - bin/check-redis-info.rb
267
269
  - bin/check-redis-keys.rb
268
270
  - bin/check-redis-list-length.rb
@@ -301,7 +303,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
301
303
  version: '0'
302
304
  requirements: []
303
305
  rubyforge_project:
304
- rubygems_version: 2.7.3
306
+ rubygems_version: 2.7.6
305
307
  signing_key:
306
308
  specification_version: 4
307
309
  summary: Sensu plugins for working with redis