sensu-plugins-memory-checks 0.0.9 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- N2QxZGQ2Yjc5NjRhMTg5YjAyOTMyMjUxZTdhMTAwMzJjYTk0Yzg4NA==
4
+ NDVjYTBmZGMwMDMzMDZiNDQwNTM5NTMyYzcwZDQxMjk4MmI1N2RkNg==
5
5
  data.tar.gz: !binary |-
6
- ZmQ2M2IzMzQ0MWUzMzJlOWJhMDYxNjhjODdjODdlYjYxMjVjMTYxMg==
6
+ MjVkNjVjMTQ0M2YyNzQwYjcyYTZhYjkyNjEzZWU2NmQxMDkwNmNjNw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ODljMjc0MGI0MTA4Y2IyNGZkNDZmMjE4Zjk0Y2EyODczMTEyODI3YzlkYWI2
10
- NmNlN2E4ZWQwZDRkNjI0NGQ5NGM3MWUyM2Y4ZTA3YzYyYmNkODZjMzQ4ZjRi
11
- MGMxMTI3ODQxNTgyNjdjNjAwYjcwZmE2OTY1OGE1ZWYxYjUyMzc=
9
+ MjFmMjU1OGQxYjI0OGYxZDg4NjM3NjgwYWQ0ODQ1MGRlNjU0OGNlMWRlMzVm
10
+ Y2M1MmY3MTk2NjNhY2RlNDQzN2U1M2ZlNGM1ZjFmZDE2ZDIyZTFkNjdjYTJk
11
+ NDRmNGI2MzczYzhhOGEzZjkxMGExYjA5ZmFhNDA2YWNlYjI4YWM=
12
12
  data.tar.gz: !binary |-
13
- YTE4YmMwYzY0MzExZDg2NDJmOWYwNzUzMGE1MTliYjAxNTkwZjk0YTRkODQ4
14
- NzAxMmQ2YTA5YzQ5OGMzMjc3ODZkZGIzNzg2ZTVlOTI1OTMwNjUzODU2YTcx
15
- ZWZlZWMyODliMjc0ZGQ4MTI4ZTUxZjI0YTRkNjgwMjBkYWU1MTk=
13
+ MDljNjVhMmNlNTZjMGY2MGVhZDVhZTdjMDc5ZTc5YWRmMjIzNTlkM2ZhNTQ0
14
+ ZGMzNzFkNzAzNTEyZWM0NjhkYzdiMGMxYjkwM2U3ZWE5YjRjNWViMTBmYzBh
15
+ NTJhNWY4YmZjNTk4ZGIzNjUzZjZjMGIxN2IzNzcxYmNlYzVkNTI=
@@ -3,7 +3,21 @@ This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
4
  This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
5
 
6
- ## [Unreleased][unreleased]
6
+ ## [Unreleased]
7
+
8
+ ## [1.0.2] - 2016-04-12
9
+ ### Fixed
10
+ - `check-memory.sh`: Update for Ubuntu 16.04 `free` output
11
+
12
+ ## [1.0.1] - 2016-03-07
13
+ ### Fixed
14
+ - `check-memory-percent.sh` returned "MEM UNKNOWN" when less than 1% of memory was free
15
+
16
+ ## [1.0.0] - 2016-03-06
17
+ ### Changed
18
+ - removed `vmstat` from a runtime dependency to remove gcc dependency.
19
+ - added documentation about how you would install the required runtime dependencies if you are using `bin/check-ram.rb`.
20
+ - added some checking to `bin/check-ram.rb` to be handled appropriately if you do not install the required dependencies.
7
21
 
8
22
  ## [0.0.9] - 2016-02-05
9
23
  ### Added
@@ -54,7 +68,10 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
54
68
  ### Added
55
69
  - initial release
56
70
 
57
- [unreleased]: https://github.com/sensu-plugins/sensu-plugins-memory-checks/compare/0.0.9...HEAD
71
+ [unreleased]: https://github.com/sensu-plugins/sensu-plugins-memory-checks/compare/1.0.2...HEAD
72
+ [1.0.2]: https://github.com/sensu-plugins/sensu-plugins-memory-checks/compare/1.0.1...1.0.2
73
+ [1.0.1]: https://github.com/sensu-plugins/sensu-plugins-memory-checks/compare/1.0.0...1.0.1
74
+ [1.0.0]: https://github.com/sensu-plugins/sensu-plugins-memory-checks/compare/0.0.9...1.0.0
58
75
  [0.0.9]: https://github.com/sensu-plugins/sensu-plugins-memory-checks/compare/0.0.8...0.0.9
59
76
  [0.0.8]: https://github.com/sensu-plugins/sensu-plugins-memory-checks/compare/0.0.7...0.0.8
60
77
  [0.0.7]: https://github.com/sensu-plugins/sensu-plugins-memory-checks/compare/0.0.6...0.0.7
data/README.md CHANGED
@@ -27,4 +27,10 @@
27
27
 
28
28
  [Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
29
29
 
30
+ ### `bin/check-ram.rb`
31
+
32
+ Ruby does not have a good native way without the use of C extensions to grab information on memory usage (outside of running shell commands and parsing out). Because of this `check-ram.rb` uses a gem called `vmstat` which has a somewhat annoying dependency on a gcc to compile the C extensions. In order to not force people to install gcc if they are not using `check-ram.rb` we do not install it by default, and is up to the user to make sure that they install it. This requires two steps and can vary based on your distribution and ruby set up:
33
+ - Install `gcc`. If you are on a debian based system it is located in the `build-essential` package.
34
+ - Install `vmstat` gem into the path that sensu gems are expected to run from: this is typically.
35
+
30
36
  ## Notes
@@ -3,8 +3,6 @@
3
3
  # Evaluate free system memory from Linux based systems based on percentage
4
4
  # This was forked from Sensu Community Plugins
5
5
  #
6
- # Requires: bc
7
- #
8
6
  # Date: 2007-11-12
9
7
  # Author: Thomas Borger - ESG
10
8
  # Date: 2012-04-02
@@ -13,6 +11,8 @@
13
11
  # Modified: Mario Harvey - Zumetrics
14
12
  # Date: 2015-01-10
15
13
  # Modified Ollie Armstrong <ollie@armstrong.io>
14
+ # Date: 2016-02-15
15
+ # Modified: J. Brandt Buckley <brandt.buckley@sendgrid.com>
16
16
 
17
17
  # get arguments
18
18
 
@@ -55,7 +55,7 @@ if [ $? -ne 0 ];
55
55
  FreeMem=$(free -m | grep Mem | awk '{ print $7 }')
56
56
  fi
57
57
  #Get percentage of free memory
58
- FreePer=$(echo "scale=3; $FreeMem / $TotalMem * 100" | bc -l| cut -d "." -f1)
58
+ FreePer=$(awk -v total="$TotalMem" -v free="$FreeMem" 'BEGIN { printf("%-10f\n", (free / total) * 100) }' | cut -d. -f1)
59
59
  #Get actual memory usage percentage by subtracting free memory percentage from 100
60
60
  UsedPer=$((100-$FreePer))
61
61
 
@@ -41,21 +41,10 @@ fi
41
41
  WARN=${WARN:=0}
42
42
  CRIT=${CRIT:=0}
43
43
 
44
- # validate fedora > 20 and rhel > 7.0 and centos > 7.0
45
- if [[ -f /etc/redhat-version && `egrep "2[0-9]{1}" /etc/redhat-release` ]]; then
46
- redhat_version=1
47
- elif [[ -f /etc/redhat-version && `egrep "7\.[0-9]{1}" /etc/redhat-version` ]]; then
48
- redhat_version=1
49
- elif [[ -f /etc/redhat-release && `egrep "7\.[0-9]{1}" /etc/redhat-release` ]]; then
50
- redhat_version=1
51
- else
52
- redhat_version=0
53
- fi
54
-
55
- if [ -f /etc/redhat-release ] && [ $redhat_version = '1' ] ; then
56
- FREE_MEMORY=`free -m | grep Mem | awk '{ print $7 }'`
57
- else
58
- FREE_MEMORY=`free -m | grep buffers/cache | awk '{ print $4 }'`
44
+ set -o pipefail
45
+ FREE_MEMORY=$(free -m | grep buffers/cache | awk '{ print $4 }')
46
+ if [ $? -ne 0 ]; then
47
+ FREE_MEMORY=$(free -m | grep Mem | awk '{ print $7 }')
59
48
  fi
60
49
 
61
50
  if [ "$FREE_MEMORY" = "" ]; then
@@ -14,10 +14,14 @@
14
14
  # DEPENDENCIES:
15
15
  # gem: sensu-plugin
16
16
  # gem: vmstat
17
+ # compiler: gcc
17
18
  #
18
19
  # USAGE:
19
20
  # check-ram.rb --help
20
21
  #
22
+ # EXTRA INSTALL INSTRUCTIONS:
23
+ # You must install gcc. This is needed to compile the vmstat gem
24
+ # which you must put in a path that sensu can reach.
21
25
  # NOTES:
22
26
  # The default behavior is to check % of RAM free. This can easily
23
27
  # be overwritten via args please see `check-ram.rb --help` for details
@@ -64,6 +68,13 @@ class CheckRAM < Sensu::Plugin::Check::CLI
64
68
  default: 5
65
69
 
66
70
  def run
71
+ begin
72
+ require 'vmstat'
73
+ rescue LoadError => e
74
+ raise unless e.message =~ /vmstat/
75
+ unknown "Error unable to load vmstat gem: #{e}"
76
+ end
77
+
67
78
  # calculating free and used ram based on: https://github.com/threez/ruby-vmstat/issues/4 to emulate free -m
68
79
  mem = Vmstat.snapshot.memory
69
80
  free_ram = mem.inactive_bytes + mem.free_bytes
@@ -1,8 +1,8 @@
1
1
  module SensuPluginsMemoryChecks
2
2
  module Version
3
- MAJOR = 0
3
+ MAJOR = 1
4
4
  MINOR = 0
5
- PATCH = 9
5
+ PATCH = 2
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,45 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-memory-checks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - !binary |-
12
- LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURuakNDQW9hZ0F3SUJB
13
- Z0lCQVRBTkJna3Foa2lHOXcwQkFRVUZBREJLTVJVd0V3WURWUVFEREF4elpX
14
- NXoKZFMxd2JIVm5hVzR4SFRBYkJnb0praWFKay9Jc1pBRVpGZzF6Wlc1emRT
15
- MXdiSFZuYVc1ek1SSXdFQVlLQ1pJbQppWlB5TEdRQkdSWUNhVzh3SGhjTk1U
16
- WXdNakEwTWpNeU1qRTNXaGNOTVRjd01qQXpNak15TWpFM1dqQktNUlV3CkV3
17
- WURWUVFEREF4elpXNXpkUzF3YkhWbmFXNHhIVEFiQmdvSmtpYUprL0lzWkFF
18
- WkZnMXpaVzV6ZFMxd2JIVm4KYVc1ek1SSXdFQVlLQ1pJbWlaUHlMR1FCR1JZ
19
- Q2FXOHdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCRHdBdwpnZ0VLQW9J
20
- QkFRQy9VUzNmdEkyUmQrOWQzS3JIQUw0bERsOGxhN2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lbgphZmg1bHVUQkExaTFjcUJHNEFNSjBmTFdHeU9xSmFYOFA5WnN4
38
- RERXUEVCbk5TaVd2WGIrSUttSkFWTzF1VzRrClFOODNielZXU1d1bFk4Qlk2
39
- a1grSVFNd1lhelpBbEIvMTNkN2E4VTBoN0NyYjM2Sm5TUGF0aHVSemU0cUtY
40
- RlEKM2YzVFVaV3d2UmZ0Y1N1K3Z0Y0JSa00wCi0tLS0tRU5EIENFUlRJRklD
41
- QVRFLS0tLS0K
42
- date: 2016-02-06 00:00:00.000000000 Z
10
+ cert_chain: []
11
+ date: 2016-04-13 00:00:00.000000000 Z
43
12
  dependencies:
44
13
  - !ruby/object:Gem::Dependency
45
14
  name: sensu-plugin
@@ -55,20 +24,6 @@ dependencies:
55
24
  - - ~>
56
25
  - !ruby/object:Gem::Version
57
26
  version: '1.2'
58
- - !ruby/object:Gem::Dependency
59
- name: vmstat
60
- requirement: !ruby/object:Gem::Requirement
61
- requirements:
62
- - - '='
63
- - !ruby/object:Gem::Version
64
- version: 2.1.0
65
- type: :runtime
66
- prerelease: false
67
- version_requirements: !ruby/object:Gem::Requirement
68
- requirements:
69
- - - '='
70
- - !ruby/object:Gem::Version
71
- version: 2.1.0
72
27
  - !ruby/object:Gem::Dependency
73
28
  name: bundler
74
29
  requirement: !ruby/object:Gem::Requirement
@@ -181,6 +136,20 @@ dependencies:
181
136
  - - ~>
182
137
  - !ruby/object:Gem::Version
183
138
  version: '3.4'
139
+ - !ruby/object:Gem::Dependency
140
+ name: vmstat
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ~>
144
+ - !ruby/object:Gem::Version
145
+ version: 2.1.0
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ~>
151
+ - !ruby/object:Gem::Version
152
+ version: 2.1.0
184
153
  - !ruby/object:Gem::Dependency
185
154
  name: yard
186
155
  requirement: !ruby/object:Gem::Requirement
@@ -1,3 +0,0 @@
1
- '���,�ǡ_���ٗ�8���>0�6���x��!��{/���?o_����*3��Ʃ��O$�hv*�od^`��
2
- /��X;�R�2�Y�E"���<g~��~?-Żb>TC��s�,C�/�Ѐ��/���P���/[�zx^�#4���X�J�bg|�i��E
3
- n�@�-��xl�;�xP{rZ��h$��b�ih3�l���\�M�]2�6�p ��]�O dȿx���ÖR�]WZ�
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
@@ -1,2 +0,0 @@
1
- ?��n��^�c���
2
- ���a@Q�6�J15GCUa<��1a�L�˛:�iA��j����X�u��3CkM�"ם��Ƴ��W�L�#���>��rr�)1v��4�9��l(Z��H���|�}��g���b�[��H���YI*e��&���tT�¥*Y!���6��W�ׂs�`�ΐD8j�+�0E�c����͛8�nl���՜T����p