sensu-plugins-disk-checks 3.0.1 → 3.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 +7 -1
- data/bin/metrics-disk-capacity.rb +26 -19
- data/bin/metrics-disk-usage.rb +7 -1
- data/lib/sensu-plugins-disk-checks/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b76a845add6f2cd9d29b9053f3e928f1e8cf86c133bc30571537535da43c92f
|
4
|
+
data.tar.gz: c41d56c55ca84d4b79644051ed4dae6eb3f515ed1c8ceb0912855128d23e81bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: feb2b7020690df95756c9ea6466a696f6e371410b278e807989a78808067e3a2076d86b7c3c3f88dfa3205f7d3dbf7cc2f654958ea068766f58e8ba24aabc150
|
7
|
+
data.tar.gz: da4fe12cbbe5a8da2850c91b4fa01e8233808d6a7883dc9cc69c6a56d89008239803a351ca77a16aaa34d40312106caa1ba52b8e731c1347d084aa3e4edf9df8
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,11 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [3.1.0] - 2018-05-02
|
9
|
+
### Added
|
10
|
+
- metrics-disk-capacity.rb, added `solaris` compatibility. Does not support inodes on `solaris` (@makaveli0129).
|
11
|
+
- metrics-disk-usage.rb: added `solaris` compatibility. Does not support block_size for config (@makaveli0129)
|
12
|
+
|
8
13
|
## [3.0.1] - 2018-03-27
|
9
14
|
### Security
|
10
15
|
- updated yard dependency to `~> 0.9.11` per: https://nvd.nist.gov/vuln/detail/CVE-2017-17042 (@majormoses)
|
@@ -175,7 +180,8 @@ https://mathias-kettner.de/checkmk_filesystems.html
|
|
175
180
|
### Added
|
176
181
|
- initial release
|
177
182
|
|
178
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-disk-checks/compare/3.0
|
183
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-disk-checks/compare/3.1.0...HEAD
|
184
|
+
[3.1.0]: https://github.com/sensu-plugins/sensu-plugins-disk-checks/compare/3.0.1...3.1.0
|
179
185
|
[3.0.1]: https://github.com/sensu-plugins/sensu-plugins-disk-checks/compare/3.0.0...3.0.1
|
180
186
|
[3.0.0]: https://github.com/sensu-plugins/sensu-plugins-disk-checks/compare/2.5.1...3.0.0
|
181
187
|
[2.5.1]: https://github.com/sensu-plugins/sensu-plugins-disk-checks/compare/2.5.0...2.5.1
|
@@ -57,13 +57,18 @@ class DiskCapacity < Sensu::Plugin::Metric::CLI::Graphite
|
|
57
57
|
#
|
58
58
|
def run
|
59
59
|
# Get capacity metrics from DF as they don't appear in /proc
|
60
|
-
|
60
|
+
command = if Gem::Platform.local.os == 'solaris'
|
61
|
+
'df -k'
|
62
|
+
else
|
63
|
+
'df -PT'
|
64
|
+
end
|
65
|
+
`#{command}`.split("\n").drop(1).each do |line|
|
61
66
|
begin
|
62
67
|
fs, _type, _blocks, used, avail, capacity, _mnt = line.split
|
63
68
|
|
64
69
|
timestamp = Time.now.to_i
|
65
70
|
if fs =~ /\/dev/
|
66
|
-
fs = fs.
|
71
|
+
fs = fs.tr('/dev/', '')
|
67
72
|
metrics = {
|
68
73
|
disk: {
|
69
74
|
"#{fs}.used" => used,
|
@@ -83,28 +88,30 @@ class DiskCapacity < Sensu::Plugin::Metric::CLI::Graphite
|
|
83
88
|
end
|
84
89
|
|
85
90
|
# Get inode capacity metrics
|
86
|
-
|
87
|
-
|
88
|
-
|
91
|
+
if Gem::Platform.local.os != 'solaris'
|
92
|
+
`df -Pi`.split("\n").drop(1).each do |line|
|
93
|
+
begin
|
94
|
+
fs, _inodes, used, avail, capacity, _mnt = line.split
|
89
95
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
96
|
+
timestamp = Time.now.to_i
|
97
|
+
if fs =~ /\/dev/
|
98
|
+
fs = fs.tr('/dev/', '')
|
99
|
+
metrics = {
|
100
|
+
disk: {
|
101
|
+
"#{fs}.iused" => used,
|
102
|
+
"#{fs}.iavail" => avail,
|
103
|
+
"#{fs}.icapacity" => capacity.delete('%')
|
104
|
+
}
|
98
105
|
}
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
106
|
+
metrics.each do |parent, children|
|
107
|
+
children.each do |child, value|
|
108
|
+
output [config[:scheme], parent, child].join('.'), value, timestamp
|
109
|
+
end
|
103
110
|
end
|
104
111
|
end
|
112
|
+
rescue StandardError
|
113
|
+
unknown "malformed line from df: #{line}"
|
105
114
|
end
|
106
|
-
rescue StandardError
|
107
|
-
unknown "malformed line from df: #{line}"
|
108
115
|
end
|
109
116
|
end
|
110
117
|
ok
|
data/bin/metrics-disk-usage.rb
CHANGED
@@ -95,7 +95,13 @@ class DiskUsageMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
95
95
|
delim = config[:flatten] == true ? '_' : '.'
|
96
96
|
# Get disk usage from df with used and avail in megabytes
|
97
97
|
# #YELLOW
|
98
|
-
|
98
|
+
command = if Gem::Platform.local.os == 'solaris'
|
99
|
+
"df -k #{config[:local] ? '-l' : ''}"
|
100
|
+
else
|
101
|
+
"df -PB#{config[:block_size]} #{config[:local] ? '-l' : ''}"
|
102
|
+
end
|
103
|
+
|
104
|
+
`#{command}`.split("\n").drop(1).each do |line|
|
99
105
|
_, _, used, avail, used_p, mnt = line.split
|
100
106
|
|
101
107
|
unless %r{/sys[/|$]|/dev[/|$]|/run[/|$]} =~ mnt
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-disk-checks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.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: 2018-03
|
11
|
+
date: 2018-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|