sensu-plugins-redis 0.0.2 → 0.0.3

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
  SHA1:
3
- metadata.gz: 32e5c3b536d5903b94d2d4f20880d67a5baed405
4
- data.tar.gz: ce2ba35f85dc291f8a26992ab6e68bcfd6864573
3
+ metadata.gz: b86c4c687669e698f1b1fd1143f4c3dd30b90352
4
+ data.tar.gz: df753f922e6efb4f4ec3501a053906d96f42372a
5
5
  SHA512:
6
- metadata.gz: 865a57fb238f069f531f86724c02c0163f883801f98bf7336a1daeac5d3a745e5b08cc5894a43d6956fd47e87945616431b0b4184576d8d4577c1de607bf5ec6
7
- data.tar.gz: 788992bc157fd2ef03d9c7e1d1e0cc4ae5699782ebc765d2140361b617e3a5ff3c6e6c1c584ee7eb8a79745ace28f34b7c2ddfcf55792440fb46ae7f20fc7105
6
+ metadata.gz: abc98b872ea33506440b2c31bd22bf3c12a406373d454a5ee1efe5a748fce27679f8a31dbb7b34407f593a993348bb48ac7358688799a24f10e77afc9c20e57e
7
+ data.tar.gz: 566424ee356be127987497ed65de0f85fd01a394bd6d812a37061e39935f75b21c7a1cb1642f4298a88d741a516ccfb8f5b0f3729934c1340446ed2fde428900
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
5
5
 
6
6
  ## Unreleased][unreleased]
7
7
 
8
+ ## [0.0.2 - 2015-07-05]
9
+ ### Added
10
+ - Add check for existance of Redis keys
11
+
12
+ ### Fixed
13
+ - Fixed the gemspec to properly install the plugins to the embedded sensu bin dir
14
+
8
15
  ## 0.0.1 - 2015-05-31
9
16
 
10
17
  ### Added
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Checks number of keys matching a keys command are above the provided
4
+ # warn/critical levels
5
+ # ===
6
+ #
7
+ # Depends on redis gem
8
+ # gem install redis
9
+ #
10
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
11
+ # for details.
12
+
13
+ require 'sensu-plugin/check/cli'
14
+ require 'redis'
15
+
16
+ class RedisKeysCheck < Sensu::Plugin::Check::CLI
17
+ option :host,
18
+ short: '-h HOST',
19
+ long: '--host HOST',
20
+ description: 'Redis Host to connect to',
21
+ required: false,
22
+ default: '127.0.0.1'
23
+
24
+ option :port,
25
+ short: '-p PORT',
26
+ long: '--port PORT',
27
+ description: 'Redis Port to connect to',
28
+ proc: proc(&:to_i),
29
+ required: false,
30
+ default: 6379
31
+
32
+ option :database,
33
+ short: '-n DATABASE',
34
+ long: '--dbnumber DATABASE',
35
+ description: 'Redis database number to connect to',
36
+ proc: proc(&:to_i),
37
+ required: false,
38
+ default: 0
39
+
40
+ option :password,
41
+ short: '-P PASSWORD',
42
+ long: '--password PASSWORD',
43
+ description: 'Redis Password to connect with'
44
+
45
+ option :warn,
46
+ short: '-w COUNT',
47
+ long: '--warning COUNT',
48
+ description: 'COUNT warning threshold for number of matching keys',
49
+ proc: proc(&:to_i),
50
+ required: true
51
+
52
+ option :crit,
53
+ short: '-c COUNT',
54
+ long: '--critical COUNT',
55
+ description: 'COUNT critical threshold for number of matching keys',
56
+ proc: proc(&:to_i),
57
+ required: true
58
+
59
+ option :pattern,
60
+ long: '--pattern PATTERN',
61
+ description: 'Argument passed into keys command. Defaults to *',
62
+ required: false,
63
+ default: '*'
64
+
65
+ def run
66
+ options = { host: config[:host], port: config[:port], db: config[:database] }
67
+ options[:password] = config[:password] if config[:password]
68
+ redis = Redis.new(options)
69
+
70
+ length = redis.keys(config[:pattern]).size
71
+
72
+ if length < config[:crit]
73
+ critical "'keys #{config[:pattern]}' returned #{length} keys, which is below the warning limit of #{config[:crit]}"
74
+ elsif length < config[:warn]
75
+ warning "'keys #{config[:pattern]}' returned #{length} keys, which is below the critical limit of #{config[:warn]}"
76
+ else
77
+ ok "Redis list #{config[:pattern]} length is above thresholds"
78
+ end
79
+ rescue
80
+ unknown "Could not connect to Redis server on #{config[:host]}:#{config[:port]}"
81
+ end
82
+ end
@@ -2,7 +2,7 @@ module SensuPluginsRedis
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- PATCH = 2
5
+ PATCH = 3
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-redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
@@ -30,7 +30,7 @@ cert_chain:
30
30
  8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
31
31
  HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
32
32
  -----END CERTIFICATE-----
33
- date: 2015-06-04 00:00:00.000000000 Z
33
+ date: 2015-07-06 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: sensu-plugin
@@ -78,14 +78,14 @@ dependencies:
78
78
  name: rubocop
79
79
  requirement: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - "~>"
81
+ - - '='
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0.30'
84
84
  type: :development
85
85
  prerelease: false
86
86
  version_requirements: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - "~>"
88
+ - - '='
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0.30'
91
91
  - !ruby/object:Gem::Dependency
@@ -188,7 +188,15 @@ dependencies:
188
188
  version: '0.10'
189
189
  description: Sensu plugins for redis
190
190
  email: "<sensu-users@googlegroups.com>"
191
- executables: []
191
+ executables:
192
+ - metrics-redis-llen.rb
193
+ - metrics-redis-graphite.rb
194
+ - check-redis-slave-status.rb
195
+ - check-redis-ping.rb
196
+ - check-redis-memory.rb
197
+ - check-redis-list-length.rb
198
+ - check-redis-keys.rb
199
+ - check-redis-info.rb
192
200
  extensions: []
193
201
  extra_rdoc_files: []
194
202
  files:
@@ -196,6 +204,7 @@ files:
196
204
  - LICENSE
197
205
  - README.md
198
206
  - bin/check-redis-info.rb
207
+ - bin/check-redis-keys.rb
199
208
  - bin/check-redis-list-length.rb
200
209
  - bin/check-redis-memory.rb
201
210
  - bin/check-redis-ping.rb
metadata.gz.sig CHANGED
Binary file