sensu-plugins-disk-checks 5.1.3 → 5.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/bin/check-disk-usage.rb +18 -2
- data/bin/check-fstab-mounts.rb +9 -9
- data/bin/check-smart.rb +3 -3
- data/lib/sensu-plugins-disk-checks/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2c5f3e7cb7dc768ff1903d561a3aaedcd2d2298ca3e7d6ba7782f504fa8d31c
|
4
|
+
data.tar.gz: b728133e6f2082c0a5454f730caa9dee13248f3104ffd8ee1610913f81f7aff5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12f3b53ded7a8a036573176976e5e9dceeda4a9886ace306dd88b46bf2dfd54c5bf36523cb6c2976024cd6c2b176a19cdac284c49f8ec57115599055215bfbf8
|
7
|
+
data.tar.gz: 7e17b7dd33bfebf3d6ebd7253036e3982cb17b3a92241dc13248cc72c1f6ec030e1d4d9ca3067d9974614f56402711a065e130237204bba1165ef3491bacc564
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,10 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [5.1.4] - 2020-11-05
|
9
|
+
### Fixed
|
10
|
+
- change Sensu asset build definition to match ruby-runtime build collection. No change to underlying plugin functionality
|
11
|
+
|
8
12
|
## [5.1.3] - 2020-06-02
|
9
13
|
### Fixed
|
10
14
|
- fix for incorrect Ruby literal string freeze in binaries
|
data/bin/check-disk-usage.rb
CHANGED
@@ -65,6 +65,12 @@ class CheckDisk < Sensu::Plugin::Check::CLI
|
|
65
65
|
description: 'Ignore option(s)',
|
66
66
|
proc: proc { |a| a.split('.') }
|
67
67
|
|
68
|
+
option :ignorereadonly,
|
69
|
+
long: '--ignore-readonly',
|
70
|
+
description: 'Ignore read-only filesystems',
|
71
|
+
boolean: true,
|
72
|
+
default: false
|
73
|
+
|
68
74
|
option :ignore_reserved,
|
69
75
|
description: 'Ignore bytes reserved for privileged processes',
|
70
76
|
short: '-r',
|
@@ -139,6 +145,7 @@ class CheckDisk < Sensu::Plugin::Check::CLI
|
|
139
145
|
next if config[:ignoremnt]&.include?(line.mount_point)
|
140
146
|
next if config[:ignorepathre]&.match(line.mount_point)
|
141
147
|
next if config[:ignoreopt]&.include?(line.options)
|
148
|
+
next if config[:ignorereadonly] && line.options.split(',').include?('ro')
|
142
149
|
next if config[:includemnt] && !config[:includemnt].include?(line.mount_point)
|
143
150
|
rescue StandardError
|
144
151
|
unknown 'An error occured getting the mount info'
|
@@ -196,8 +203,17 @@ class CheckDisk < Sensu::Plugin::Check::CLI
|
|
196
203
|
end
|
197
204
|
|
198
205
|
def to_human(size)
|
199
|
-
unit = [
|
200
|
-
|
206
|
+
unit = [
|
207
|
+
[1_099_511_627_776, 'TiB'],
|
208
|
+
[1_073_741_824, 'GiB'],
|
209
|
+
[1_048_576, 'MiB'],
|
210
|
+
[1024, 'KiB'],
|
211
|
+
[0, 'B']
|
212
|
+
].detect { |u| size >= u[0] }
|
213
|
+
format(
|
214
|
+
"%.2f #{unit[1]}",
|
215
|
+
(size >= 1024 ? size.to_f / unit[0] : size)
|
216
|
+
)
|
201
217
|
end
|
202
218
|
|
203
219
|
# Determine the percent inode usage
|
data/bin/check-fstab-mounts.rb
CHANGED
@@ -53,30 +53,30 @@ class CheckFstabMounts < Sensu::Plugin::Check::CLI
|
|
53
53
|
@missing_mounts = []
|
54
54
|
end
|
55
55
|
|
56
|
-
def resolve_device(
|
57
|
-
if
|
58
|
-
uuid =
|
56
|
+
def resolve_device(device)
|
57
|
+
if device.start_with?('UUID=')
|
58
|
+
uuid = device.split('=')[1]
|
59
59
|
path = File.join('/', 'dev', 'disk', 'by-uuid', uuid)
|
60
60
|
if File.exist?(path) && File.symlink?(path)
|
61
61
|
return File.realpath(path)
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
if
|
66
|
-
label =
|
65
|
+
if device.start_with?('LABEL=')
|
66
|
+
label = device.split('=')[1]
|
67
67
|
path = File.join('/', 'dev', 'disk', 'by-label', label)
|
68
68
|
if File.exist?(path) && File.symlink?(path)
|
69
69
|
return File.realpath(path)
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
-
if
|
74
|
-
if File.symlink?(
|
75
|
-
|
73
|
+
if device.start_with?('/dev/mapper')
|
74
|
+
if File.symlink?(device)
|
75
|
+
device = File.realpath(device, '/')
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
|
79
|
+
device
|
80
80
|
end
|
81
81
|
|
82
82
|
# Check by mount destination (col 2 in fstab and proc/mounts)
|
data/bin/check-smart.rb
CHANGED
@@ -171,7 +171,7 @@ class CheckSMART < Sensu::Plugin::Check::CLI
|
|
171
171
|
# Main function
|
172
172
|
#
|
173
173
|
def run
|
174
|
-
unless @devices.length > 0
|
174
|
+
unless @devices.length > 0
|
175
175
|
exit_with(
|
176
176
|
config[:no_smart_capable_disks],
|
177
177
|
'No SMART capable devices found'
|
@@ -181,13 +181,13 @@ class CheckSMART < Sensu::Plugin::Check::CLI
|
|
181
181
|
unhealthy_disks = @devices.select { |disk| disk.smart_capable? && !disk.healthy? }
|
182
182
|
unknown_disks = @devices.reject(&:smart_capable?)
|
183
183
|
|
184
|
-
if unhealthy_disks.length > 0
|
184
|
+
if unhealthy_disks.length > 0
|
185
185
|
output = unhealthy_disks.map(&:health_output)
|
186
186
|
output.concat(unknown_disks.map(&:capability_output))
|
187
187
|
critical output.join("\n")
|
188
188
|
end
|
189
189
|
|
190
|
-
if unknown_disks.length > 0
|
190
|
+
if unknown_disks.length > 0
|
191
191
|
exit_with(
|
192
192
|
config[:smart_incapable_disks],
|
193
193
|
unknown_disks.map(&:capability_output).join("\n")
|
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: 5.1.
|
4
|
+
version: 5.1.4
|
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: 2020-06
|
11
|
+
date: 2020-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|
@@ -219,8 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
219
219
|
- !ruby/object:Gem::Version
|
220
220
|
version: '0'
|
221
221
|
requirements: []
|
222
|
-
|
223
|
-
rubygems_version: 2.7.7
|
222
|
+
rubygems_version: 3.0.8
|
224
223
|
signing_key:
|
225
224
|
specification_version: 4
|
226
225
|
summary: Sensu plugins for disk checks
|