sensu-plugins-disk-checks 1.1.2 → 1.1.3
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +11 -0
- data/README.md +5 -0
- data/bin/check-disk-usage.rb +2 -8
- data/bin/check-smart-status.rb +13 -2
- data/bin/metrics-disk-usage.rb +1 -1
- data/lib/sensu-plugins-disk-checks/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70cfbdd21bd520136259552003e3a60d363246f3
|
4
|
+
data.tar.gz: e922cddef3c7b7dee281556e26bb65ff22d91598
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7af23943cd7939e1fd36c10939ecc814a4418c79fb15301d2d35f91e7b8ee31655e2c2631eddc33b240f589283927e00258be16635b75b9d3170fb52d1ffdfc4
|
7
|
+
data.tar.gz: 2ac99b50435fe73d71b85811c8784462bd3cbe9f5542f45c82fc48df58b36a8c67128590f24d220367bc378f5134a2e4635b6cd6fa8015d5848a86f7d700eed5
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,17 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
5
5
|
|
6
6
|
## Unreleased
|
7
7
|
|
8
|
+
[1.1.3] - 2016-01-15
|
9
|
+
### Added
|
10
|
+
- Add --json option to check-smart-status.rb
|
11
|
+
|
12
|
+
### Changed
|
13
|
+
- Let check-smart-status.rb skip SMART incapable disks
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
- metrics-disk-usage.rb: fix regular expression in unless statement
|
17
|
+
- check-disk-usage.rb: fix wrong TiB formatting in to_human function
|
18
|
+
|
8
19
|
## [1.1.2] - 2015-12-14
|
9
20
|
### Added
|
10
21
|
- check-disk-usage.rb: Add option to include only certain mount points
|
data/README.md
CHANGED
@@ -93,3 +93,8 @@ This is a sample input file used by check-smart-status, see the script for furth
|
|
93
93
|
[Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
|
94
94
|
|
95
95
|
## Notes
|
96
|
+
|
97
|
+
### Certification Verification
|
98
|
+
|
99
|
+
If you are verifying certificates in the gem install you will need the certificate for the `sys-filesystem` gem loaded
|
100
|
+
in the gem certificate store. That cert can be found [here](https://raw.githubusercontent.com/djberg96/sys-filesystem/ffi/certs/djberg96_pub.pem).
|
data/bin/check-disk-usage.rb
CHANGED
@@ -178,14 +178,8 @@ class CheckDisk < Sensu::Plugin::Check::CLI
|
|
178
178
|
end
|
179
179
|
|
180
180
|
def to_human(s)
|
181
|
-
|
182
|
-
s
|
183
|
-
i = prefix.length - 1
|
184
|
-
while s > 512 && i > 0
|
185
|
-
s /= 1024
|
186
|
-
i -= 1
|
187
|
-
end
|
188
|
-
((s > 9 || s.modulo(1) < 0.1 ? '%d' : '%.1f') % s) + ' ' + prefix[i]
|
181
|
+
unit = [[1_099_511_627_776, 'TiB'], [1_073_741_824, 'GiB'], [1_048_576, 'MiB'], [1024, 'KiB'], [0, 'B']].detect { |u| s >= u[0] }
|
182
|
+
"#{s > 0 ? s / unit[0] : s} #{unit[1]}"
|
189
183
|
end
|
190
184
|
|
191
185
|
# Determine the percent inode usage
|
data/bin/check-smart-status.rb
CHANGED
@@ -72,6 +72,13 @@ class SmartCheckStatus < Sensu::Plugin::Check::CLI
|
|
72
72
|
required: false,
|
73
73
|
default: 'smartctl'
|
74
74
|
|
75
|
+
option :json,
|
76
|
+
short: '-j path/to/smart.json',
|
77
|
+
long: '--json path/to/smart.json',
|
78
|
+
description: 'Path to SMART attributes JSON file',
|
79
|
+
required: false,
|
80
|
+
default: File.dirname(__FILE__) + '/smart.json'
|
81
|
+
|
75
82
|
option :defaults,
|
76
83
|
short: '-d 0,0,0,0',
|
77
84
|
long: '--defaults 0,0,0,0',
|
@@ -120,7 +127,7 @@ class SmartCheckStatus < Sensu::Plugin::Check::CLI
|
|
120
127
|
# Main function
|
121
128
|
#
|
122
129
|
def run
|
123
|
-
@smart_attributes = JSON.parse(IO.read(
|
130
|
+
@smart_attributes = JSON.parse(IO.read(config[:json]), symbolize_names: true)[:smart][:attributes]
|
124
131
|
@smart_debug = config[:debug] == 'on'
|
125
132
|
|
126
133
|
# Set default threshold
|
@@ -241,7 +248,11 @@ class SmartCheckStatus < Sensu::Plugin::Check::CLI
|
|
241
248
|
devices = []
|
242
249
|
all.each do |line|
|
243
250
|
partition = line.scan(/\w+/).last.scan(/^\D+$/).first
|
244
|
-
|
251
|
+
next if partition.nil?
|
252
|
+
output = `sudo #{config[:binary]} -i /dev/#{partition}`
|
253
|
+
available = !output.scan(/SMART support is: Available/).empty?
|
254
|
+
enabled = !output.scan(/SMART support is: Enabled/).empty?
|
255
|
+
devices << partition if available && enabled
|
245
256
|
end
|
246
257
|
|
247
258
|
devices
|
data/bin/metrics-disk-usage.rb
CHANGED
@@ -99,7 +99,7 @@ class DiskUsageMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
99
99
|
`df -PB#{config[:block_size]} #{config[:local] ? '-l' : ''}`.split("\n").drop(1).each do |line|
|
100
100
|
_, _, used, avail, used_p, mnt = line.split
|
101
101
|
|
102
|
-
unless %r{/sys|/dev|/run}.match(mnt)
|
102
|
+
unless %r{/sys[/|$]|/dev[/|$]|/run[/|$]}.match(mnt)
|
103
103
|
next if config[:ignore_mnt] && config[:ignore_mnt].find { |x| mnt.match(x) }
|
104
104
|
next if config[:include_mnt] && !config[:include_mnt].find { |x| mnt.match(x) }
|
105
105
|
if config[:flatten]
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-disk-checks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sensu-Plugins and contributors
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
|
31
31
|
HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
33
|
+
date: 2016-01-15 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: sensu-plugin
|
metadata.gz.sig
CHANGED
Binary file
|