sensu-plugins-memory-checks 3.0.3 → 3.1.1

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: 5f690ce16be4963eb209c4301139f46697da8709
4
- data.tar.gz: e231936896b20a46c5488d0d0536824dd16a4b4a
3
+ metadata.gz: db85b632d9bdb38bc83d3c7b3083bd49592a1a14
4
+ data.tar.gz: 7fa43c23d1fa44bbd6c052c917e7824f96a1fd32
5
5
  SHA512:
6
- metadata.gz: 5290ac02abd1cb7839a107e7b61bfb1693980bff74c4ff313d47bba5aa176c6ef3ff14ecac4bf767cf1e1a0cc51a68ed0764019669fd0f60a768b82e6eae2dac
7
- data.tar.gz: b0cd272dd1ba55d148afce41a2ba386c92ad435115c3dfd7e56aab619f1abfed0638340ba5eea70f9f97d819f7575675e79ba2d284d74d71c6491955bf187e0d
6
+ metadata.gz: 6396c87b11b9137b7929a8eb6e4527566801fec573795f6e61bf21e5ccfefb5cecdb889b8eac56473e385eabbdaf6014152c25fad6d645cc33ef171487fc5a13
7
+ data.tar.gz: ead6a65b68768c5b0f7740d27eccc43ecedca200af99e56013551510ef762abfd66234cdc3ce7fc6664f15bb0e87aca0e3a4ed9fa5a9d5935422b16e7add1553
@@ -5,6 +5,15 @@ This CHANGELOG follows the located [here](https://github.com/sensu-plugins/commu
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [3.1.1] - 2017-10-25
9
+ ### Fixed
10
+ - check-memory-percent.sh: compare variable `$os` rather than the string 'os' (@lcc207)
11
+
12
+ ## [3.1.0] - 2017-10-20
13
+ ### Added
14
+ - check-memory-percent.sh: added osx support (@jjdiazgarcia)
15
+ - check-memory-percent.sh: make if statement syntax consistent with the script (@majormoses)
16
+
8
17
  ## [3.0.3] - 2017-09-23
9
18
  ### Fixed
10
19
  - metrics-memory-percent.rb, metrics-memory.rb: change 'usedWOBuffersCaches' and 'freeWOBuffersCaches' calculation to use MemAvailable in /proc/meminfo when available. (@jpoizat)
@@ -121,7 +130,9 @@ This CHANGELOG follows the located [here](https://github.com/sensu-plugins/commu
121
130
  ### Added
122
131
  - initial release
123
132
 
124
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-memory-checks/compare/3.0.1...HEAD
133
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-memory-checks/compare/3.1.0...HEAD
134
+ [3.1.1]: https://github.com/sensu-plugins/sensu-plugins-memory-checks/compare/3.1.0...3.1.1
135
+ [3.1.0]: https://github.com/sensu-plugins/sensu-plugins-memory-checks/compare/3.0.1...3.1.0
125
136
  [3.0.2]: https://github.com/sensu-plugins/sensu-plugins-memory-checks/compare/3.0.1...3.0.2
126
137
  [3.0.1]: https://github.com/sensu-plugins/sensu-plugins-memory-checks/compare/https://github.com/sensu-plugins/sensu-plugins-memory-checks/compare/3.0.0...3.0.1
127
138
  [3.0.0]: https://github.com/sensu-plugins/sensu-plugins-memory-checks/compare/2.1.0...3.0.0
@@ -48,15 +48,23 @@ fi
48
48
  WARN=${WARN:=80}
49
49
  CRIT=${CRIT:=90}
50
50
 
51
- #Get total memory available on machine
52
- TotalMem=$(free -m | grep Mem | awk '{ print $2 }')
53
- #Determine amount of free memory on the machine
54
- set -o pipefail
55
- FreeMem=$(free -m | grep buffers/cache | awk '{ print $4 }')
56
- if [ $? -ne 0 ];
57
- then
58
- FreeMem=$(free -m | grep Mem | awk '{ print $7 }')
51
+ os=$(uname)
52
+ if [ $os = "Darwin" ]; then
53
+ #Get total memory available on machine
54
+ TotalMem=$(sysctl -a | grep '^hw\.m' | cut -d" " -f2)
55
+ #Determine amount of free memory on the machine
56
+ FreeMem=$(vm_stat | grep "Pages free" | tr -d '[:space:]' | cut -d: -f2 | cut -d. -f1)
57
+ elif [ $os = "Linux" ]; then
58
+ #Get total memory available on machine
59
+ TotalMem=$(free -m | grep Mem | awk '{ print $2 }')
60
+ #Determine amount of free memory on the machine
61
+ set -o pipefail
62
+ FreeMem=$(free -m | grep buffers/cache | awk '{ print $4 }')
63
+ if [ $? -ne 0 ]; then
64
+ FreeMem=$(free -m | grep Mem | awk '{ print $7 }')
65
+ fi
59
66
  fi
67
+
60
68
  #Get percentage of free memory
61
69
  FreePer=$(awk -v total="$TotalMem" -v free="$FreeMem" 'BEGIN { printf("%-10f\n", (free / total) * 100) }' | cut -d. -f1)
62
70
  #Get actual memory usage percentage by subtracting free memory percentage from 100
@@ -1,8 +1,8 @@
1
1
  module SensuPluginsMemoryChecks
2
2
  module Version
3
3
  MAJOR = 3
4
- MINOR = 0
5
- PATCH = 3
4
+ MINOR = 1
5
+ PATCH = 1
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.3
4
+ version: 3.1.1
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-09-23 00:00:00.000000000 Z
11
+ date: 2017-10-26 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.6.13
225
+ rubygems_version: 2.6.14
226
226
  signing_key:
227
227
  specification_version: 4
228
228
  summary: Sensu plugins for checking memory