sensu-plugins-redis 1.1.1 → 1.2.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: 5195c6ea4420767061e4314611ea21bfaaf37189
4
- data.tar.gz: dc975e051350813362e45815cce15b1f7c0d5547
3
+ metadata.gz: 32aaab200fa89a0df1f2e96d0f25049835aec207
4
+ data.tar.gz: 1fd27f8c0897e82bf96d9d41d63ce8804a542995
5
5
  SHA512:
6
- metadata.gz: 57ec46388939b4a6b3f063061ede7a7413298f5649d8417b40f44b25ee755eead329ac033169fe8299307f047e0f522bf051b748aa5d81065ea7d0d2622a67d6
7
- data.tar.gz: 0e2b1cfe37676223cddae9cff26b348dbd2d65712375d8e8dd0e650cacee910944b8e4d2d1255c0c43593195a1e24d9c84a641dfaf3cdb009d3c1183933d46e7
6
+ metadata.gz: 28eebc5ad7bccc2cf71ad5f8bd75fc510f4a75c961a51247b24652e60ee7d07f22a8cd266db4757c8f7f0db324145084d36fd423a2534f927b30e9788c9195da
7
+ data.tar.gz: dbbe5fc58e0c466c296d5e6be4f0c9fdc20497087a92971c75efbadd9dabadbb1f55605ac6fd6854682d70df87e59a66c18f34e53cfe87d0aad541d442fb308b
data/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ 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.2.0] - 2017-05-09
8
+ ### Changed
9
+ - check-redis-memory-percentage: Handle case where maxmemory is 0 (@stevenviola)
10
+
7
11
  ## [1.1.1] - 2017-05-05
8
12
  ### Fixed
9
13
  - updated gemspec to avoid deprecation warnings in redis client for Fixnum
@@ -52,7 +56,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
52
56
  ### Added
53
57
  - initial release
54
58
 
55
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-redis/compare/1.1.0...HEAD
59
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-redis/compare/1.2.0...HEAD
60
+ [1.2.0]: https://github.com/sensu-plugins/sensu-plugins-redis/compare/1.1.0...1.2.0
56
61
  [1.1.0]: https://github.com/sensu-plugins/sensu-plugins-redis/compare/1.0.0...1.1.0
57
62
  [1.0.0]: https://github.com/sensu-plugins/sensu-plugins-redis/compare/0.1.0...1.0.0
58
63
  [0.1.0]: https://github.com/sensu-plugins/sensu-plugins-redis/compare/0.0.4...0.1.0
@@ -80,8 +80,12 @@ class RedisChecks < Sensu::Plugin::Check::CLI
80
80
  redis = Redis.new(options)
81
81
 
82
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
83
+ max_memory = redis_info.fetch('maxmemory', 0).to_i
84
+ if max_memory == 0
85
+ max_memory = redis_info.fetch('total_system_memory', system_memory).to_i
86
+ end
87
+ memory_in_use = redis_info.fetch('used_memory').to_i.fdiv(1024) # used memory in KB (KiloBytes)
88
+ total_memory = max_memory.fdiv(1024) # max memory (if specified) in KB
85
89
 
86
90
  used_memory = ((memory_in_use / total_memory) * 100).round(2)
87
91
  warn_memory = config[:warn_mem]
@@ -1,8 +1,8 @@
1
1
  module SensuPluginsRedis
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 1
5
- PATCH = 1
4
+ MINOR = 2
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: 1.1.1
4
+ version: 1.2.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-05-06 00:00:00.000000000 Z
11
+ date: 2017-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin