sensu-plugins-redis 1.4.0 → 2.0.0

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: bd85ed962f2d4ad9b17984f5b347567b501323f8
4
- data.tar.gz: fc2352c0eeea0effc4af1c8701206372e5655202
3
+ metadata.gz: d84e480941378fc37dc6238221103244e6927953
4
+ data.tar.gz: 8dac21557a6056203718cf360a52f7f6e662ca0d
5
5
  SHA512:
6
- metadata.gz: d69a0960c67f8bb9e168d1c737d53bb3be169fdd83e641a8b4cf7a4b36d2f22a4286c9d47073da2090edf2640deee823d4856b3cd0863e1684b4e60ff3c11441
7
- data.tar.gz: 43226f41e13daa2b72f6d9c9e2c34740e707cd56530e41688d60afa21888bd953674b786d1234cebdd4f273ad28dff38b7ba9865b3a60af411087824ff0cdf54
6
+ metadata.gz: 8978a9254a29e9d3b035a0269a4452048ff20c6ea6c7b3406c647a33c3069636906402b94cfc6290b3ce433647c14e9c769c15038568782217117c0f9f9b95d9
7
+ data.tar.gz: 97a0e270d28c6f0b319e213e6e63843a4c9fb2a15527aecc954867b86ef84e64137c05a6bc6f154f51189e4d0c281481335809ab0a6f2369b226b76810d7433e
data/CHANGELOG.md CHANGED
@@ -5,6 +5,17 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [2.0.0] - 2017-07-23
9
+ ### Breaking Changes
10
+ - Standardised exit status for Redis connection failures/timeouts to Unknown, with the exception of 'check-redis-ping' which will exit Critical (@Evesy)
11
+ - check-redis-memory-percentage.rb, check-redis-memory.rb: removed redundant `crit_conn` (@Evesy)
12
+
13
+ ### Added
14
+ - Config option to override the default exit status on Redis connection failures/timeouts
15
+
16
+ ### Added
17
+ - ruby 2.4 testing on travis (@majormoses)
18
+
8
19
  ## [1.4.0] - 2017-06-24
9
20
  ### Added
10
21
  - check-redis-list-length.rb support more datatypes to check (@nevins-b)
@@ -79,7 +90,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
79
90
  ### Added
80
91
  - initial release
81
92
 
82
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-redis/compare/1.4.0...HEAD
93
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-redis/compare/2.0.0...HEAD
94
+ [2.0.0]: https://github.com/sensu-plugins/sensu-plugins-redis/compare/1.4.0...2.0.0
83
95
  [1.4.0]: https://github.com/sensu-plugins/sensu-plugins-redis/compare/1.3.1...1.4.0
84
96
  [1.3.1]: https://github.com/sensu-plugins/sensu-plugins-redis/compare/1.3.0...1.3.1
85
97
  [1.3.0]: https://github.com/sensu-plugins/sensu-plugins-redis/compare/1.2.2...1.3.0
@@ -60,6 +60,12 @@ class RedisSlaveCheck < Sensu::Plugin::Check::CLI
60
60
  required: false,
61
61
  default: 'master'
62
62
 
63
+ option :conn_failure_status,
64
+ long: '--conn-failure-status EXIT_STATUS',
65
+ description: 'Returns the following exit status for Redis connection failures',
66
+ default: 'unknown',
67
+ in: %w(unknown warning critical)
68
+
63
69
  def run
64
70
  options = if config[:socket]
65
71
  { path: socket }
@@ -76,7 +82,6 @@ class RedisSlaveCheck < Sensu::Plugin::Check::CLI
76
82
  critical "Redis #{config[:redis_info_key]} is #{redis.info.fetch(config[:redis_info_key].to_s)}!"
77
83
  end
78
84
  rescue
79
- message "Could not connect to Redis server on #{config[:host]}:#{config[:port]}"
80
- exit 1
85
+ send(config[:conn_failure_status], "Could not connect to Redis server on #{config[:host]}:#{config[:port]}")
81
86
  end
82
87
  end
@@ -68,6 +68,12 @@ class RedisKeysCheck < Sensu::Plugin::Check::CLI
68
68
  required: false,
69
69
  default: '*'
70
70
 
71
+ option :conn_failure_status,
72
+ long: '--conn-failure-status EXIT_STATUS',
73
+ description: 'Returns the following exit status for Redis connection failures',
74
+ default: 'unknown',
75
+ in: %w(unknown warning critical)
76
+
71
77
  def run
72
78
  options = if config[:socket]
73
79
  { path: socket }
@@ -89,6 +95,6 @@ class RedisKeysCheck < Sensu::Plugin::Check::CLI
89
95
  ok "Redis list #{config[:pattern]} length is above thresholds"
90
96
  end
91
97
  rescue
92
- unknown "Could not connect to Redis server on #{config[:host]}:#{config[:port]}"
98
+ send(config[:conn_failure_status], "Could not connect to Redis server on #{config[:host]}:#{config[:port]}")
93
99
  end
94
100
  end
@@ -69,6 +69,12 @@ class RedisListLengthCheck < Sensu::Plugin::Check::CLI
69
69
  description: 'Redis list KEY to check',
70
70
  required: true
71
71
 
72
+ option :conn_failure_status,
73
+ long: '--conn-failure-status EXIT_STATUS',
74
+ description: 'Returns the following exit status for Redis connection failures',
75
+ default: 'unknown',
76
+ in: %w(unknown warning critical)
77
+
72
78
  def run
73
79
  options = if config[:socket]
74
80
  { path: socket }
@@ -97,6 +103,6 @@ class RedisListLengthCheck < Sensu::Plugin::Check::CLI
97
103
  ok "Redis list #{config[:key]} length (#{length}) is below thresholds"
98
104
  end
99
105
  rescue
100
- unknown "Could not connect to Redis server on #{config[:host]}:#{config[:port]}"
106
+ send(config[:conn_failure_status], "Could not connect to Redis server on #{config[:host]}:#{config[:port]}")
101
107
  end
102
108
  end
@@ -70,11 +70,11 @@ class RedisChecks < Sensu::Plugin::Check::CLI
70
70
  proc: proc(&:to_i),
71
71
  required: true
72
72
 
73
- option :crit_conn,
74
- long: '--crit-conn-failure',
75
- boolean: true,
76
- description: 'Critical instead of warning on connection failure',
77
- default: false
73
+ option :conn_failure_status,
74
+ long: '--conn-failure-status EXIT_STATUS',
75
+ description: 'Returns the following exit status for Redis connection failures',
76
+ default: 'unknown',
77
+ in: %w(unknown warning critical)
78
78
 
79
79
  def system_memory
80
80
  `awk '/MemTotal/{print$2}' /proc/meminfo`.to_f * 1024
@@ -109,11 +109,6 @@ class RedisChecks < Sensu::Plugin::Check::CLI
109
109
  ok "Redis memory usage: #{used_memory}% is below defined limits"
110
110
  end
111
111
  rescue
112
- message = "Could not connect to Redis server on #{config[:host]}:#{config[:port]}"
113
- if config[:crit_conn]
114
- critical message
115
- else
116
- warning message
117
- end
112
+ send(config[:conn_failure_status], "Could not connect to Redis server on #{config[:host]}:#{config[:port]}")
118
113
  end
119
114
  end
@@ -52,11 +52,11 @@ class RedisChecks < Sensu::Plugin::Check::CLI
52
52
  proc: proc(&:to_i),
53
53
  required: true
54
54
 
55
- option :crit_conn,
56
- long: '--crit-conn-failure',
57
- boolean: true,
58
- description: 'Critical instead of warning on connection failure',
59
- default: false
55
+ option :conn_failure_status,
56
+ long: '--conn-failure-status EXIT_STATUS',
57
+ description: 'Returns the following exit status for Redis connection failures',
58
+ default: 'unknown',
59
+ in: %w(unknown warning critical)
60
60
 
61
61
  def run
62
62
  options = if config[:socket]
@@ -79,11 +79,6 @@ class RedisChecks < Sensu::Plugin::Check::CLI
79
79
  ok "Redis memory usage: #{used_memory}KB is below defined limits"
80
80
  end
81
81
  rescue
82
- message = "Could not connect to Redis server on #{config[:host]}:#{config[:port]}"
83
- if config[:crit_conn]
84
- critical message
85
- else
86
- warning message
87
- end
82
+ send(config[:conn_failure_status], "Could not connect to Redis server on #{config[:host]}:#{config[:port]}")
88
83
  end
89
84
  end
@@ -57,6 +57,12 @@ class RedisPing < Sensu::Plugin::Check::CLI
57
57
  long: '--password PASSWORD',
58
58
  description: 'Redis Password to connect with'
59
59
 
60
+ option :conn_failure_status,
61
+ long: '--conn-failure-status EXIT_STATUS',
62
+ description: 'Returns the following exit status for Redis connection failures',
63
+ default: 'critical',
64
+ in: %w(unknown warning critical)
65
+
60
66
  def redis_options
61
67
  if config[:socket]
62
68
  {
@@ -78,9 +84,7 @@ class RedisPing < Sensu::Plugin::Check::CLI
78
84
  else
79
85
  critical 'Redis did not respond to the ping command'
80
86
  end
81
-
82
87
  rescue
83
- message "Could not connect to Redis server on #{config[:host]}:#{config[:port]}"
84
- exit 1
88
+ send(config[:conn_failure_status], "Could not connect to Redis server on #{config[:host]}:#{config[:port]}")
85
89
  end
86
90
  end
@@ -32,6 +32,12 @@ class RedisSlaveCheck < Sensu::Plugin::Check::CLI
32
32
  long: '--password PASSWORD',
33
33
  description: 'Redis Password to connect with'
34
34
 
35
+ option :conn_failure_status,
36
+ long: '--conn-failure-status EXIT_STATUS',
37
+ description: 'Returns the following exit status for Redis connection failures',
38
+ default: 'unknown',
39
+ in: %w(unknown warning critical)
40
+
35
41
  def run
36
42
  options = if config[:socket]
37
43
  { path: socket }
@@ -52,11 +58,9 @@ class RedisSlaveCheck < Sensu::Plugin::Check::CLI
52
58
  msg += " It has been down for #{redis.info.fetch('master_link_down_since_seconds')}."
53
59
  critical msg
54
60
  end
55
-
56
61
  rescue KeyError
57
62
  critical "Redis server on #{config[:host]}:#{config[:port]} is not master and does not have master_link_status"
58
-
59
63
  rescue
60
- critical "Could not connect to Redis server on #{config[:host]}:#{config[:port]}"
64
+ send(config[:conn_failure_status], "Could not connect to Redis server on #{config[:host]}:#{config[:port]}")
61
65
  end
62
66
  end
@@ -97,6 +97,12 @@ class Redis2Graphite < Sensu::Plugin::Metric::CLI::Graphite
97
97
  long: '--skipkeys KEYS',
98
98
  default: nil
99
99
 
100
+ option :conn_failure_status,
101
+ long: '--conn-failure-status EXIT_STATUS',
102
+ description: 'Returns the following exit status for Redis connection failures',
103
+ default: 'unknown',
104
+ in: %w(unknown warning critical)
105
+
100
106
  def run
101
107
  options = {
102
108
  timeout: config[:timeout],
@@ -142,5 +148,7 @@ class Redis2Graphite < Sensu::Plugin::Metric::CLI::Graphite
142
148
  end
143
149
 
144
150
  ok
151
+ rescue
152
+ send(config[:conn_failure_status], "Could not connect to Redis server on #{config[:host]}:#{config[:port]}")
145
153
  end
146
154
  end
@@ -47,6 +47,12 @@ class RedisListLengthMetric < Sensu::Plugin::Metric::CLI::Graphite
47
47
  description: 'Redis list KEY to check',
48
48
  required: true
49
49
 
50
+ option :conn_failure_status,
51
+ long: '--conn-failure-status EXIT_STATUS',
52
+ description: 'Returns the following exit status for Redis connection failures',
53
+ default: 'unknown',
54
+ in: %w(unknown warning critical)
55
+
50
56
  def run
51
57
  options = if config[:socket]
52
58
  { path: socket }
@@ -59,5 +65,7 @@ class RedisListLengthMetric < Sensu::Plugin::Metric::CLI::Graphite
59
65
 
60
66
  output "#{config[:scheme]}.#{config[:key]}.items", redis.llen(config[:key])
61
67
  ok
68
+ rescue
69
+ send(config[:conn_failure_status], "Could not connect to Redis server on #{config[:host]}:#{config[:port]}")
62
70
  end
63
71
  end
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsRedis
2
2
  module Version
3
- MAJOR = 1
4
- MINOR = 4
3
+ MAJOR = 2
4
+ MINOR = 0
5
5
  PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
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: 1.4.0
4
+ version: 2.0.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-06-24 00:00:00.000000000 Z
11
+ date: 2017-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin