sensu-plugins-disk-checks 3.0.1 → 3.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6a0e99fb96d8f5c4535e80a8997cbdaaea748cb856d6c4c4531175d6ecb160b2
4
- data.tar.gz: 1fc9a89b7caa658ce283d1767be07d663bca422f25c6a2da3a8fa770eb017cb6
3
+ metadata.gz: 8b76a845add6f2cd9d29b9053f3e928f1e8cf86c133bc30571537535da43c92f
4
+ data.tar.gz: c41d56c55ca84d4b79644051ed4dae6eb3f515ed1c8ceb0912855128d23e81bb
5
5
  SHA512:
6
- metadata.gz: dea1c510c87658d1ca0ba9794003c92911405a89fd6b17f04f39d2cf37ec4ce5f39969f66a86c170fca819ce663f2be6c24ef6afed0e480fe2fffe2c1d3635e6
7
- data.tar.gz: 8691673fd0e84ce7d59af24861c4ae984aabc0129452e4d7bc99167c824ee9f3031258b0814336ab23211fb9e8fc836a8e0660367492124ba9dbb32c710c5e4f
6
+ metadata.gz: feb2b7020690df95756c9ea6466a696f6e371410b278e807989a78808067e3a2076d86b7c3c3f88dfa3205f7d3dbf7cc2f654958ea068766f58e8ba24aabc150
7
+ data.tar.gz: da4fe12cbbe5a8da2850c91b4fa01e8233808d6a7883dc9cc69c6a56d89008239803a351ca77a16aaa34d40312106caa1ba52b8e731c1347d084aa3e4edf9df8
@@ -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.1...HEAD
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
- `df -PT`.split("\n").drop(1).each do |line|
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.gsub('/dev/', '')
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
- `df -Pi`.split("\n").drop(1).each do |line|
87
- begin
88
- fs, _inodes, used, avail, capacity, _mnt = line.split
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
- timestamp = Time.now.to_i
91
- if fs =~ /\/dev/
92
- fs = fs.gsub('/dev/', '')
93
- metrics = {
94
- disk: {
95
- "#{fs}.iused" => used,
96
- "#{fs}.iavail" => avail,
97
- "#{fs}.icapacity" => capacity.delete('%')
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
- metrics.each do |parent, children|
101
- children.each do |child, value|
102
- output [config[:scheme], parent, child].join('.'), value, timestamp
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
@@ -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
- `df -PB#{config[:block_size]} #{config[:local] ? '-l' : ''}`.split("\n").drop(1).each do |line|
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
@@ -1,8 +1,8 @@
1
1
  module SensuPluginsDiskChecks
2
2
  module Version
3
3
  MAJOR = 3
4
- MINOR = 0
5
- PATCH = 1
4
+ MINOR = 1
5
+ PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
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.1
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-27 00:00:00.000000000 Z
11
+ date: 2018-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin