sensu-plugins-memory-checks 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -1
- data/README.md +148 -21
- data/bin/check-memory-percent.rb +1 -0
- data/bin/check-memory.rb +1 -0
- data/bin/check-ram.rb +4 -0
- data/bin/check-swap-percent.rb +2 -0
- data/bin/check-swap.rb +1 -0
- data/bin/metrics-memory-percent.rb +2 -1
- data/bin/metrics-memory-vmstat.rb +2 -0
- data/bin/metrics-memory.rb +3 -1
- data/lib/sensu-plugins-memory-checks.rb +2 -0
- data/lib/sensu-plugins-memory-checks/version.rb +3 -1
- metadata +15 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58c05cb934dc5bcc02ed2e5d041c5a261d4dbaf4e3d20f8f2612328e6c2aeefe
|
4
|
+
data.tar.gz: f9a68273dc15551bfcdd4e9b1f611bd5d2ae96a3ed0f03cc26abd45d7b49ef4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 444ee9c818fd13079f1a8fb116cda2848743693c0b9b7b60be61e5a18cef7a098e904426ac97830d31560ccf3c17c8ff913ee884a2558f9ebb002d79a75759d5
|
7
|
+
data.tar.gz: 6180f388967ddc4936965581301b6933ed5eef40c48d8145972865db90853de83246f2d15ab156d01dd0b797b9f514963bd9d79b1c28ee5786b7bd1f3b30f8fb
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,14 @@ This CHANGELOG follows the located [here](https://github.com/sensu-plugins/commu
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [4.1.0] - 2019-12-16
|
9
|
+
### Changed
|
10
|
+
- Updated asset build target to support Centos6
|
11
|
+
- Updated rake development requirement from ~> 10.5 to ~> 13.0 .
|
12
|
+
- Updated rubocop development requirement from ~> 0.51.0 to ~> 0.77.0 .
|
13
|
+
- Updated bundler development requirement from ~> 1.7 to ~> 2.0 .
|
14
|
+
- Updated README
|
15
|
+
|
8
16
|
## [4.0.0] - 2019-04-18
|
9
17
|
### Breaking Changes
|
10
18
|
- Update minimum required ruby version to 2.3. Drop unsupported ruby versions.
|
@@ -155,7 +163,8 @@ This CHANGELOG follows the located [here](https://github.com/sensu-plugins/commu
|
|
155
163
|
### Added
|
156
164
|
- initial release
|
157
165
|
|
158
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-memory-checks/compare/4.
|
166
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-memory-checks/compare/4.1.0...HEAD
|
167
|
+
[4.1.0]: https://github.com/sensu-plugins/sensu-plugins-memory-checks/compare/4.0.0..4.1.0
|
159
168
|
[4.0.0]: https://github.com/sensu-plugins/sensu-plugins-memory-checks/compare/3.2.0..4.0.0
|
160
169
|
[3.2.0]: https://github.com/sensu-plugins/sensu-plugins-memory-checks/compare/3.1.3..3.2.0
|
161
170
|
[3.1.3]: https://github.com/sensu-plugins/sensu-plugins-memory-checks/compare/3.1.2...3.1.3
|
data/README.md
CHANGED
@@ -1,18 +1,32 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
[![Sensu Bonsai Asset](https://img.shields.io/badge/Bonsai-Download%20Me-brightgreen.svg?colorB=89C967&logo=sensu)](https://bonsai.sensu.io/assets/sensu-plugins/sensu-plugins-memory-checks)
|
3
2
|
[![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-memory-checks.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-memory-checks)
|
4
3
|
[![Gem Version](https://badge.fury.io/rb/sensu-plugins-memory-checks.svg)](http://badge.fury.io/rb/sensu-plugins-memory-checks)
|
5
4
|
[![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-memory-checks/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-memory-checks)
|
6
5
|
[![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-memory-checks/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-memory-checks)
|
7
6
|
[![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-memory-checks.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-memory-checks)
|
8
|
-
[![Sensu Bonsai Asset](https://img.shields.io/badge/Bonsai-Download%20Me-brightgreen.svg?colorB=89C967&logo=sensu)](https://bonsai.sensu.io/assets/sensu-plugins/sensu-plugins-memory-checks)
|
9
7
|
|
10
|
-
## Sensu
|
11
|
-
|
8
|
+
## Sensu Memory Check Plugin
|
9
|
+
|
10
|
+
- [Overview](#overview)
|
11
|
+
- [Files](#files)
|
12
|
+
- [Usage examples](#usage-examples)
|
13
|
+
- [Configuration](#configuration)
|
14
|
+
- [Sensu Go](#sensu-go)
|
15
|
+
- [Asset registration](#asset-registration)
|
16
|
+
- [Asset definition](#asset-definition)
|
17
|
+
- [Check definition](#check-definition)
|
18
|
+
- [Sensu Core](#sensu-core)
|
19
|
+
- [Check definition](#check-definition)
|
20
|
+
- [Installation from source](#installation-from-source)
|
21
|
+
- [Additional notes](#additional-notes)
|
22
|
+
- [Contributing](#contributing)
|
23
|
+
|
24
|
+
### Overview
|
12
25
|
|
13
|
-
## Functionality
|
14
26
|
|
15
|
-
|
27
|
+
This plugin provides native memory instrumentation for monitoring and metrics collection, including memory usage via `free` and `vmstat`, including metrics. **NOTE**: This plugin may have cross-platform issues.
|
28
|
+
|
29
|
+
### Files
|
16
30
|
* bin/check-memory.rb
|
17
31
|
* bin/check-memory.sh
|
18
32
|
* bin/check-memory-percent.rb
|
@@ -23,24 +37,137 @@
|
|
23
37
|
* bin/check-swap.rb
|
24
38
|
* bin/metrics-memory-percent.rb
|
25
39
|
* bin/metrics-memory.rb
|
40
|
+
|
41
|
+
**check-memory**
|
42
|
+
Evaluate free system memory for Linux-based systems.
|
43
|
+
|
44
|
+
**check-memory-percent**
|
45
|
+
Evaluate the percentage of free system memory for Linux-based systems.
|
46
|
+
|
47
|
+
**check-ram**
|
48
|
+
Check the percentage of free RAM.
|
49
|
+
|
50
|
+
**check-swap-percent**
|
51
|
+
Checks swap usage as a percentage of the total swap.
|
52
|
+
|
53
|
+
**check-swap**
|
54
|
+
Evaluate swap memory usage for Linux-based systems.
|
55
|
+
|
56
|
+
**metrics-memory-percent**
|
57
|
+
Read memory statistics as a percentage and put them in a form usable by Graphite. Metrics borrowed from [HoardD](https://github.com/coredump/hoardd).
|
58
|
+
|
59
|
+
**metrics-memory-vmstat**
|
60
|
+
Read memory statistics and put them in a form usable by `vmstat`.
|
61
|
+
|
62
|
+
**metrics-memory**
|
63
|
+
Read memory statistics and put them in a form usable by Graphite. Metrics borrowed from [HoardD](https://github.com/coredump/hoardd).
|
64
|
+
|
65
|
+
## Usage examples
|
66
|
+
|
67
|
+
### Help
|
68
|
+
|
69
|
+
**check-ram.rb**
|
70
|
+
```
|
71
|
+
Usage: /opt/sensu/embedded/bin/check-ram.rb (options)
|
72
|
+
-c CRIT
|
73
|
+
-f, --free checks free threshold, defaults to true
|
74
|
+
-m, --megabytes Unless --megabytes is specified the thresholds are in percentage of memory used as opposed to MB of ram left
|
75
|
+
-u, --used checks used threshold, defaults to false
|
76
|
+
-w WARN
|
77
|
+
```
|
78
|
+
|
79
|
+
**metrics-memory-percent.rb**
|
80
|
+
```
|
81
|
+
Usage: /opt/sensu/embedded/bin/metrics-memory-percent.rb (options)
|
82
|
+
-s, --scheme SCHEME Metric naming scheme, text to prepend to metric
|
83
|
+
```
|
84
|
+
|
85
|
+
## Configuration
|
86
|
+
### Sensu Go
|
87
|
+
#### Asset registration
|
26
88
|
|
27
|
-
|
28
|
-
Use `-h` flag on any command to see available usages, `-w` to set warning threshold `-c` to set critical threshold and `-p` to print out performance data.
|
29
|
-
* `/opt/sensu/embedded/bin/check-memory.rb -w 2500 -c 3000` - Values in Megabytes
|
30
|
-
* `/opt/sensu/embedded/bin/check-memory-percent.rb -w 70 -c 80` - Values in Percentages
|
31
|
-
* `/opt/sensu/embedded/bin/check-swap.rb -w 2500 -c 3000` - Values in Megabytes
|
32
|
-
* `/opt/sensu/embedded/bin/check-swap-percent.rb -w 70 -c 80` - Values in Percentages
|
33
|
-
* `/opt/sensu/embedded/bin/metrics-memory.rb -s FooBar` - So metrics are now prepended with foobar, default is machine hostname.
|
89
|
+
Assets are the best way to make use of this plugin. If you're not using an asset, please consider doing so! If you're using sensuctl 5.13 or later, you can use the following command to add the asset:
|
34
90
|
|
35
|
-
|
91
|
+
`sensuctl asset add sensu-plugins/sensu-plugins-memory-checks`
|
36
92
|
|
37
|
-
[
|
93
|
+
If you're using an earlier version of sensuctl, you can download the asset definition from [this project's Bonsai Asset Index page](https://bonsai.sensu.io/assets/sensu-plugins/sensu-plugins-memory-checks).
|
94
|
+
|
95
|
+
#### Asset definition
|
96
|
+
|
97
|
+
```yaml
|
98
|
+
---
|
99
|
+
type: Asset
|
100
|
+
api_version: core/v2
|
101
|
+
metadata:
|
102
|
+
name: sensu-plugins-memory-checks
|
103
|
+
spec:
|
104
|
+
url: https://assets.bonsai.sensu.io/c5391d4ae186484226732344b35cf95c0b07b8ec/sensu-plugins-memory-checks_4.0.0_centos_linux_amd64.tar.gz
|
105
|
+
sha512: ea297a85aa3612da7f78d948f9784443fffac511040c5130a2dcde7191a0004044c2ef881e665520cbc64431955ab19920d84de6b5fed85c63da7091c4b93bf0
|
106
|
+
```
|
107
|
+
|
108
|
+
#### Check definition
|
109
|
+
|
110
|
+
```yaml
|
111
|
+
---
|
112
|
+
type: CheckConfig
|
113
|
+
spec:
|
114
|
+
command: "check-memory.rb"
|
115
|
+
handlers: []
|
116
|
+
high_flap_threshold: 0
|
117
|
+
interval: 10
|
118
|
+
low_flap_threshold: 0
|
119
|
+
publish: true
|
120
|
+
runtime_assets:
|
121
|
+
- sensu-plugins/sensu-plugins-memory-checks
|
122
|
+
- sensu/sensu-ruby-runtime
|
123
|
+
subscriptions:
|
124
|
+
- linux
|
125
|
+
```
|
126
|
+
|
127
|
+
### Sensu Core
|
128
|
+
|
129
|
+
#### Check definition
|
130
|
+
```json
|
131
|
+
{
|
132
|
+
"checks": {
|
133
|
+
"metrics-disk-usage": {
|
134
|
+
"command": "metric-disk-usage.rb",
|
135
|
+
"subscribers": ["linux"],
|
136
|
+
"interval": 10,
|
137
|
+
"refresh": 10,
|
138
|
+
"handlers": ["influxdb"]
|
139
|
+
}
|
140
|
+
}
|
141
|
+
}
|
142
|
+
```
|
143
|
+
|
144
|
+
## Installation from source
|
145
|
+
|
146
|
+
### Sensu Go
|
147
|
+
|
148
|
+
See the instructions above for [asset registration](#asset-registration)
|
149
|
+
|
150
|
+
### Sensu Core
|
151
|
+
|
152
|
+
Install and setup plugins on [Sensu Core](https://docs.sensu.io/sensu-core/latest/installation/installing-plugins/)
|
153
|
+
|
154
|
+
## Additional notes
|
38
155
|
|
39
156
|
### `bin/check-ram.rb`
|
40
157
|
|
41
|
-
Ruby does not have a good native way
|
42
|
-
|
43
|
-
|
44
|
-
|
158
|
+
Ruby does not have a good native way to grab information on memory usage (without using C extensions or running shell commands and parsing out). For this reason, `check-ram.rb` uses a gem called `vmstat` that has a dependency on a GCC to compile the C extensions.
|
159
|
+
|
160
|
+
To avoid errors that occur when trying to compile the C extensions without GCC present, we do not install the `vmstat` gem by default.
|
161
|
+
|
162
|
+
**Users who need to use `check-ram.rb` must install build tools, including GCC**. This usually requires two steps but can vary based on your distribution and Ruby setup:
|
163
|
+
|
164
|
+
1. Install `gcc`. If you are on a Debian system, GCC is located in the `build-essential` package. On RHEL systems, `yum groupinstall "Development tools" ` will provide the required packages.
|
165
|
+
2. Install the `vmstat` gem into the path from which Sensu gems are expected to run, `sudo /opt/sensu/embedded/bin/gem install vmstat --no-rdoc --no-ri`, or the equivalent for installing Sensu gems in your configuration management system.
|
166
|
+
|
167
|
+
### Certification verification
|
168
|
+
|
169
|
+
If you are verifying certificates in the gem install you will need the [certificate for the `sys-filesystem` gem](https://raw.githubusercontent.com/djberg96/sys-filesystem/ffi/certs/djberg96_pub.pem) loaded in the gem certificate store.
|
170
|
+
|
171
|
+
## Contributing
|
45
172
|
|
46
|
-
|
173
|
+
See [CONTRIBUTING.md](https://github.com/sensu-plugins/sensu-plugins-memory-checks/blob/master/CONTRIBUTING.md) for information about contributing to this plugin.
|
data/bin/check-memory-percent.rb
CHANGED
data/bin/check-memory.rb
CHANGED
data/bin/check-ram.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
#
|
3
5
|
# check-ram
|
4
6
|
#
|
@@ -32,6 +34,7 @@
|
|
32
34
|
# Released under the same terms as Sensu (the MIT license); see LICENSE
|
33
35
|
# for details.
|
34
36
|
#
|
37
|
+
|
35
38
|
require 'sensu-plugin/check/cli'
|
36
39
|
|
37
40
|
class CheckRAM < Sensu::Plugin::Check::CLI
|
@@ -71,6 +74,7 @@ class CheckRAM < Sensu::Plugin::Check::CLI
|
|
71
74
|
require 'vmstat'
|
72
75
|
rescue LoadError => e
|
73
76
|
raise unless e.message =~ /vmstat/
|
77
|
+
|
74
78
|
unknown "Error unable to load vmstat gem: #{e}"
|
75
79
|
end
|
76
80
|
|
data/bin/check-swap-percent.rb
CHANGED
data/bin/check-swap.rb
CHANGED
data/bin/metrics-memory.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
#
|
3
5
|
# metrics-memory
|
4
6
|
#
|
@@ -67,7 +69,7 @@ class MemoryGraphite < Sensu::Plugin::Metric::CLI::Graphite
|
|
67
69
|
mem['usedWOBuffersCaches'] = mem['used'] - (mem['buffers'] + mem['cached'])
|
68
70
|
mem['freeWOBuffersCaches'] = mem['free'] + (mem['buffers'] + mem['cached'])
|
69
71
|
end
|
70
|
-
mem['swapUsedPercentage'] = 100 * mem['swapUsed'] / mem['swapTotal'] if mem['swapTotal']
|
72
|
+
mem['swapUsedPercentage'] = 100 * mem['swapUsed'] / mem['swapTotal'] if mem['swapTotal'].positive?
|
71
73
|
|
72
74
|
mem
|
73
75
|
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: 4.
|
4
|
+
version: 4.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: 2019-
|
11
|
+
date: 2019-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: codeclimate-test-reporter
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '13.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '13.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: redcarpet
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 0.
|
131
|
+
version: 0.77.0
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 0.
|
138
|
+
version: 0.77.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: vmstat
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,14 +171,14 @@ description: |-
|
|
171
171
|
Note that this plugin may have cross-platform issues.
|
172
172
|
email: "<sensu-users@googlegroups.com>"
|
173
173
|
executables:
|
174
|
-
- check-memory-percent.rb
|
175
|
-
- check-swap-percent.rb
|
176
174
|
- check-swap.rb
|
177
|
-
- check-ram.rb
|
178
|
-
- metrics-memory.rb
|
179
|
-
- check-memory.rb
|
180
175
|
- metrics-memory-percent.rb
|
176
|
+
- check-swap-percent.rb
|
177
|
+
- metrics-memory.rb
|
178
|
+
- check-memory-percent.rb
|
181
179
|
- metrics-memory-vmstat.rb
|
180
|
+
- check-ram.rb
|
181
|
+
- check-memory.rb
|
182
182
|
extensions: []
|
183
183
|
extra_rdoc_files: []
|
184
184
|
files:
|
@@ -223,7 +223,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
223
|
- !ruby/object:Gem::Version
|
224
224
|
version: '0'
|
225
225
|
requirements: []
|
226
|
-
|
226
|
+
rubyforge_project:
|
227
|
+
rubygems_version: 2.7.7
|
227
228
|
signing_key:
|
228
229
|
specification_version: 4
|
229
230
|
summary: Sensu plugins for checking memory
|