sensu-plugins-memory-checks 3.0.2 → 3.0.3

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: ec6d4660a7f927b54cd274e22ceef287f513d13a
4
- data.tar.gz: 9d0007c7913e819aa355062fd7fada718e972cf1
3
+ metadata.gz: 5f690ce16be4963eb209c4301139f46697da8709
4
+ data.tar.gz: e231936896b20a46c5488d0d0536824dd16a4b4a
5
5
  SHA512:
6
- metadata.gz: d150f834df549dbe372c56734e4c29e3795b67e4e04b4888bc2f8f3e7d929941ce8fefcc1efd3aaa770de60ff394cd4c3c55fb8eb1fdd0df1bdbcf14593795f0
7
- data.tar.gz: 06c7b2cb773efe88af5b9782e686788b10019e8fc2883ff42ae8a684d54f3c3250ba50b65cb6bc6d8122ff03e2f101c189235111692a5031412d7f206d77b36b
6
+ metadata.gz: 5290ac02abd1cb7839a107e7b61bfb1693980bff74c4ff313d47bba5aa176c6ef3ff14ecac4bf767cf1e1a0cc51a68ed0764019669fd0f60a768b82e6eae2dac
7
+ data.tar.gz: b0cd272dd1ba55d148afce41a2ba386c92ad435115c3dfd7e56aab619f1abfed0638340ba5eea70f9f97d819f7575675e79ba2d284d74d71c6491955bf187e0d
data/CHANGELOG.md CHANGED
@@ -1,10 +1,17 @@
1
- #Change Log
1
+ # Change Log
2
2
  This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
- This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
4
+ This CHANGELOG follows the located [here](https://github.com/sensu-plugins/community/blob/master/HOW_WE_CHANGELOG.md)
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [3.0.3] - 2017-09-23
9
+ ### Fixed
10
+ - metrics-memory-percent.rb, metrics-memory.rb: change 'usedWOBuffersCaches' and 'freeWOBuffersCaches' calculation to use MemAvailable in /proc/meminfo when available. (@jpoizat)
11
+
12
+ ### Added
13
+ - update CHANGELOG guidelines location (@majormoses)
14
+
8
15
  ## [3.0.2] - 2017-07-31
9
16
  ### Fixed
10
17
  - check-memory-percent.rb, check-memory.rb: fix shell call response when running on non en_US locale systems (@stefan-walluhn)
@@ -59,13 +59,20 @@ class MemoryGraphite < Sensu::Plugin::Metric::CLI::Graphite
59
59
  mem['swapTotal'] = line.split(/\s+/)[1].to_i * 1024 if line =~ /^SwapTotal/
60
60
  mem['swapFree'] = line.split(/\s+/)[1].to_i * 1024 if line =~ /^SwapFree/
61
61
  mem['dirty'] = line.split(/\s+/)[1].to_i * 1024 if line =~ /^Dirty/
62
+ mem['available'] = line.split(/\s+/)[1].to_i * 1024 if line =~ /^MemAvailable/
62
63
  end
63
64
 
64
65
  mem['swapUsed'] = mem['swapTotal'] - mem['swapFree']
65
66
  mem['used'] = mem['total'] - mem['free']
66
- mem['usedWOBuffersCaches'] = mem['used'] - (mem['buffers'] + mem['cached'])
67
- mem['freeWOBuffersCaches'] = mem['free'] + (mem['buffers'] + mem['cached'])
68
67
 
68
+ # if MemAvailable exist, use it to calculate "available memory"
69
+ if mem.key?('available')
70
+ mem['usedWOBuffersCaches'] = mem['total'] - mem['available']
71
+ mem['freeWOBuffersCaches'] = mem['available']
72
+ else
73
+ mem['usedWOBuffersCaches'] = mem['used'] - (mem['buffers'] + mem['cached'])
74
+ mem['freeWOBuffersCaches'] = mem['free'] + (mem['buffers'] + mem['cached'])
75
+ end
69
76
  # to prevent division by zero
70
77
  swptot = if mem['swapTotal'].zero?
71
78
  1
@@ -55,12 +55,19 @@ class MemoryGraphite < Sensu::Plugin::Metric::CLI::Graphite
55
55
  mem['swapTotal'] = line.split(/\s+/)[1].to_i * 1024 if line =~ /^SwapTotal/
56
56
  mem['swapFree'] = line.split(/\s+/)[1].to_i * 1024 if line =~ /^SwapFree/
57
57
  mem['dirty'] = line.split(/\s+/)[1].to_i * 1024 if line =~ /^Dirty/
58
+ mem['available'] = line.split(/\s+/)[1].to_i * 1024 if line =~ /^MemAvailable/
58
59
  end
59
60
 
60
61
  mem['swapUsed'] = mem['swapTotal'] - mem['swapFree']
61
62
  mem['used'] = mem['total'] - mem['free']
62
- mem['usedWOBuffersCaches'] = mem['used'] - (mem['buffers'] + mem['cached'])
63
- mem['freeWOBuffersCaches'] = mem['free'] + (mem['buffers'] + mem['cached'])
63
+ # if MemAvailable exist, use it to calculate "available memory"
64
+ if mem.key?('available')
65
+ mem['usedWOBuffersCaches'] = mem['total'] - mem['available']
66
+ mem['freeWOBuffersCaches'] = mem['available']
67
+ else
68
+ mem['usedWOBuffersCaches'] = mem['used'] - (mem['buffers'] + mem['cached'])
69
+ mem['freeWOBuffersCaches'] = mem['free'] + (mem['buffers'] + mem['cached'])
70
+ end
64
71
  mem['swapUsedPercentage'] = 100 * mem['swapUsed'] / mem['swapTotal'] if mem['swapTotal'] > 0
65
72
 
66
73
  mem
@@ -2,7 +2,7 @@ module SensuPluginsMemoryChecks
2
2
  module Version
3
3
  MAJOR = 3
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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-memory-checks
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
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-07-31 00:00:00.000000000 Z
11
+ date: 2017-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin
@@ -222,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
222
  version: '0'
223
223
  requirements: []
224
224
  rubyforge_project:
225
- rubygems_version: 2.4.5
225
+ rubygems_version: 2.6.13
226
226
  signing_key:
227
227
  specification_version: 4
228
228
  summary: Sensu plugins for checking memory