sensu-plugins-redis 1.0.0 → 1.1.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
  SHA1:
3
- metadata.gz: aa3bd14d4f7f74d7842cb8ca44241f6217867416
4
- data.tar.gz: 5ee2a06904e3f5ccf6f01db4bf5205214b23c235
3
+ metadata.gz: a5514a6bf6db1a6db25ae3699836258965a0b31d
4
+ data.tar.gz: 23f1fe01b595342fa603ce131138216efe43a527
5
5
  SHA512:
6
- metadata.gz: cbc5faa4a10e9f375998eafe17cebef06cfc39f6a4ddeed41a46e7e3b176bf0c27b27b0164536b65305a869204fff63e05b4af1a7936355f2a836e1d1fe79267
7
- data.tar.gz: 5f3874b81d9e6157e457fd5461cb3a8b1b1e6996eab1718ebb0d43c65e483ae9d77bd2654c419dad8f9ad98410e77f69dacaaf8b63c6812e6b28e59728e6a82e
6
+ metadata.gz: 0a364aa40846435b5777a5ebe752f0fd07a7d381c14e8ba2865e91daaf7fcb7ce08d2f9b8adec6483d5fca6814cd43de12c5701b5df03e588206298dd340dfd5
7
+ data.tar.gz: d9279e57b50c03558f4a58eeda2a35af94f833421f67847e8abcaee24d732569db0fe57738f77a41968b51b0b65ca1c87f876147730cc06c24c13ec680031d9b
data/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).
4
4
  This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
5
 
6
6
  ## [Unreleased]
7
+ ## [1.1.0] - 2017-05-02
8
+ ### Added
9
+ - metrics-redis-graphite: add commandstats metrics (@PhilGuay)
10
+ ### Changed
11
+ - check-redis-memory-percentage use maxmemory property if available (@andyroyle)
12
+ - check-redis-memory-percentage fix float conversion bug (@andyroyle)
13
+ - check-redis-slave-status: do not throw error if server is master (@stevenviola)
7
14
 
8
15
  ## [1.0.0] - 2016-05-23
9
16
  ### Added
@@ -41,7 +48,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
41
48
  ### Added
42
49
  - initial release
43
50
 
44
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-redis/compare/1.0.0...HEAD
51
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-redis/compare/1.1.0...HEAD
52
+ [1.1.0]: https://github.com/sensu-plugins/sensu-plugins-redis/compare/1.0.0...1.1.0
45
53
  [1.0.0]: https://github.com/sensu-plugins/sensu-plugins-redis/compare/0.1.0...1.0.0
46
54
  [0.1.0]: https://github.com/sensu-plugins/sensu-plugins-redis/compare/0.0.4...0.1.0
47
55
  [0.0.4]: https://github.com/sensu-plugins/sensu-plugins-redis/compare/0.0.3...0.0.4
@@ -70,13 +70,18 @@ class RedisChecks < Sensu::Plugin::Check::CLI
70
70
  description: 'Critical instead of warning on connection failure',
71
71
  default: false
72
72
 
73
+ def system_memory
74
+ `awk '/MemTotal/{print$2}' /proc/meminfo`.to_f * 1024
75
+ end
76
+
73
77
  def run
74
78
  options = { host: config[:host], port: config[:port] }
75
79
  options[:password] = config[:password] if config[:password]
76
80
  redis = Redis.new(options)
77
81
 
78
- memory_in_use = redis.info.fetch('used_memory').to_f.div(1024) # used memory in KB (KiloBytes)
79
- total_memory = `awk '/MemTotal/{print$2}' /proc/meminfo`.to_f # total memory of system in KB
82
+ redis_info = redis.info
83
+ memory_in_use = redis_info.fetch('used_memory').to_f.div(1024).to_f # used memory in KB (KiloBytes)
84
+ total_memory = redis_info.fetch('maxmemory', system_memory).to_f.div(1024).to_f # max memory (if specified) in KB
80
85
 
81
86
  used_memory = ((memory_in_use / total_memory) * 100).round(2)
82
87
  warn_memory = config[:warn_mem]
@@ -31,7 +31,9 @@ class RedisSlaveCheck < Sensu::Plugin::Check::CLI
31
31
  options[:password] = config[:password] if config[:password]
32
32
  redis = Redis.new(options)
33
33
 
34
- if redis.info.fetch('master_link_status') == 'up'
34
+ if redis.info.fetch('role') == 'master'
35
+ ok 'This redis server is master'
36
+ elsif redis.info.fetch('master_link_status') == 'up'
35
37
  ok 'The redis master links status is up!'
36
38
  else
37
39
  msg = ''
@@ -41,7 +43,7 @@ class RedisSlaveCheck < Sensu::Plugin::Check::CLI
41
43
  end
42
44
 
43
45
  rescue KeyError
44
- critical "Redis server on #{config[:host]}:#{config[:port]} is master"
46
+ critical "Redis server on #{config[:host]}:#{config[:port]} is not master and does not have master_link_status"
45
47
 
46
48
  rescue
47
49
  critical "Could not connect to Redis server on #{config[:host]}:#{config[:port]}"
@@ -86,6 +86,13 @@ class Redis2Graphite < Sensu::Plugin::Metric::CLI::Graphite
86
86
  end
87
87
  end
88
88
 
89
+ # Loop thru commandstats entries for perf metrics
90
+ redis.info('commandstats').each do |k, v|
91
+ %w(['calls', 'usec_per_call', 'usec']).each do |x|
92
+ output "#{config[:scheme]}.commandstats.#{k}.#{x}", v[x]
93
+ end
94
+ end
95
+
89
96
  ok
90
97
  end
91
98
  end
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsRedis
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 0
4
+ MINOR = 1
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.0.0
4
+ version: 1.1.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: 2016-05-24 00:00:00.000000000 Z
11
+ date: 2017-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin
@@ -224,9 +224,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
224
224
  version: '0'
225
225
  requirements: []
226
226
  rubyforge_project:
227
- rubygems_version: 2.5.1
227
+ rubygems_version: 2.4.5
228
228
  signing_key:
229
229
  specification_version: 4
230
230
  summary: Sensu plugins for working with redis
231
231
  test_files: []
232
- has_rdoc: