sensu-plugins-filesystem-checks 0.1.0 → 0.2.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
  SHA1:
3
- metadata.gz: e1c85dcc44b7f269fb1cedd56c56f998f9a0c9d1
4
- data.tar.gz: 4a0a1c5d73c1868933d5d0293a7715c860137c81
3
+ metadata.gz: dbe2493bb95355d680d06d2c870a25520fb971b2
4
+ data.tar.gz: a3ea4c03d9b9798c82a6024f940597c8a32faa99
5
5
  SHA512:
6
- metadata.gz: 27746d379e8ac14e6dca6eb9219f242d5c7ed661003b60d4ec639dc611e486aa40ac70c68f00d0c942f8543c29b4c079c3aa66a232e40b2e2db1adaadbd681f9
7
- data.tar.gz: 4329839a9dc8a515bcd5b0edb8c60a12270377bb68d13f158cad277b8b717a56f173e5b0c666c7fda2fe87c229870f488a877529379bfe7dba186429f3e97cb1
6
+ metadata.gz: 45ca11455597066d22a8e821f764b53bf2ede5090643d510c832be0349ec7cc1d4fc705b086f492f4626accd1aae8fd16e735d01170118f3d9c36a1be78fdf7e
7
+ data.tar.gz: 77a6d40800b1c00e26d479b5064a82e149a2f5625550c1c6b1c40392bf5702230a7537c843fd909b97bd7aeb2f406a5ef864582d45c1614bdf027a6bed3c602d
@@ -3,8 +3,12 @@ This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
4
  This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
5
 
6
- ## [Unreleased][unreleased]
7
- - nothing
6
+ ## [Unreleased]
7
+ ### Added
8
+ - Added 'metrics-nfsstat.rb' for collecting nfsstat metrics
9
+
10
+ ### Changed
11
+ - Renamed metric-{dirsize,filename} to metrics-{dirsize,filename}
8
12
 
9
13
  ## [0.1.0] - 2015-08-04
10
14
  ### Added
@@ -34,3 +38,9 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
34
38
  ## 0.0.1 - [2015-04-30]
35
39
  ### Added
36
40
  - initial release
41
+
42
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-filesystem-checks/compare/0.1.0...HEAD
43
+ [0.1.0]: https://github.com/sensu-plugins/sensu-plugins-filesystem-checks/compare/0.0.3...0.0.4
44
+ [0.0.4]: https://github.com/sensu-plugins/sensu-plugins-filesystem-checks/compare/0.0.3...0.0.4
45
+ [0.0.3]: https://github.com/sensu-plugins/sensu-plugins-filesystem-checks/compare/0.0.2...0.0.3
46
+ [0.0.2]: https://github.com/sensu-plugins/sensu-plugins-filesystem-checks/compare/0.0.1...0.0.2
data/README.md CHANGED
@@ -5,7 +5,6 @@
5
5
  [![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-filesystem-checks/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-filesystem-checks)
6
6
  [![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-filesystem-checks/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-filesystem-checks)
7
7
  [![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-filesystem-checks.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-filesystem-checks)
8
- [ ![Codeship Status for sensu-plugins/sensu-plugins-filesystem-checks](https://codeship.com/projects/4b97d0a0-db4c-0132-445b-5ad94843e341/status?branch=master)](https://codeship.com/projects/79592)
9
8
 
10
9
  ## Functionality
11
10
 
@@ -18,8 +17,9 @@
18
17
  * bin/check-fs-writable.rb
19
18
  * bin/check-mtime.rb
20
19
  * bin/check-tail.rb
21
- * bin/metric-dirsize.rb
22
- * bin/metric-filesize.rb
20
+ * bin/metrics-dirsize.rb
21
+ * bin/metrics-filesize.rb
22
+ * bin/metrics-nfsstat.rb
23
23
 
24
24
  ## Usage
25
25
 
@@ -59,11 +59,11 @@ class Checksum < Sensu::Plugin::Check::CLI
59
59
  unknown 'We have nothing to compare this file with.'
60
60
  end
61
61
 
62
- if config[:hashfile]
63
- hash = IO.read(config[:hashfile]).chomp
64
- else
65
- hash = config[:hash] || Digest::SHA2.file(files.first).hexdigest
66
- end
62
+ hash = if config[:hashfile]
63
+ IO.read(config[:hashfile]).chomp
64
+ else
65
+ config[:hash] || Digest::SHA2.file(files.first).hexdigest
66
+ end
67
67
 
68
68
  errors = []
69
69
 
@@ -77,7 +77,7 @@ class CheckFSWritable < Sensu::Plugin::Check::CLI
77
77
  def acquire_mnt_pts
78
78
  mnt_pts = []
79
79
  vol_groups = acquire_vol_groups.split("\n")
80
- vol_groups.each do |vol_group|
80
+ vol_groups.each do |vol_group|
81
81
  `grep #{vol_group} /proc/self/mounts | awk '{print $2, $4}' | awk -F, '{print $1}' | awk '{print $1, $2}'`.split("\n").each do |mnt|
82
82
  mnt_pts << mnt
83
83
  end
@@ -88,8 +88,8 @@ class CheckFSWritable < Sensu::Plugin::Check::CLI
88
88
  # Does proc list the mount point as rw
89
89
  #
90
90
  def rw_in_proc?(mount_info)
91
- mount_info.each do |pt|
92
- @crit_pt_proc << "#{pt.split[0]}" if pt.split[1] != 'rw'
91
+ mount_info.each do |pt|
92
+ @crit_pt_proc << pt.split[0].to_s if pt.split[1] != 'rw'
93
93
  end
94
94
  end
95
95
 
@@ -99,13 +99,13 @@ class CheckFSWritable < Sensu::Plugin::Check::CLI
99
99
  #
100
100
  def rw_test?(mount_info)
101
101
  mount_info.each do |pt|
102
- (Dir.exist? pt.split[0]) || (@crit_pt_test << "#{pt.split[0]}")
102
+ (Dir.exist? pt.split[0]) || (@crit_pt_test << pt.split[0].to_s)
103
103
  file = Tempfile.new('.sensu', pt.split[0])
104
104
  puts "The temp file we are writing to is: #{file.path}" if config[:debug]
105
105
  # #YELLOW
106
106
  # need to add a check here to validate permissions, if none it pukes
107
- file.write('mops') || @crit_pt_test << "#{pt.split[0]}"
108
- file.read || @crit_pt_test << "#{pt.split[0]}"
107
+ file.write('mops') || @crit_pt_test << pt.split[0].to_s
108
+ file.read || @crit_pt_test << pt.split[0].to_s
109
109
  file.close
110
110
  file.unlink
111
111
  end
@@ -133,13 +133,13 @@ class CheckFSWritable < Sensu::Plugin::Check::CLI
133
133
  #
134
134
  def manual_test
135
135
  config[:dir].each do |d|
136
- (Dir.exist? d) || (@crit_pt_test << "#{d}")
136
+ (Dir.exist? d) || (@crit_pt_test << d.to_s)
137
137
  file = Tempfile.new('.sensu', d)
138
138
  puts "The temp file we are writing to is: #{file.path}" if config[:debug]
139
139
  # #YELLOW
140
140
  # need to add a check here to validate permissions, if none it pukes
141
- file.write('mops') || @crit_pt_test << "#{d}"
142
- file.read || @crit_pt_test << "#{d}"
141
+ file.write('mops') || @crit_pt_test << d.to_s
142
+ file.read || @crit_pt_test << d.to_s
143
143
  file.close
144
144
  file.unlink
145
145
  end
@@ -76,7 +76,7 @@ class Tail < Sensu::Plugin::Check::CLI
76
76
  if pattern_match?
77
77
  send(
78
78
  # #YELLOW
79
- config[:warn_only] ? :warning : :critical, # rubocop:disable BlockNesting
79
+ config[:warn_only] ? :warning : :critical, # rubocop:disable BlockNesting
80
80
  "Pattern matched: #{config[:pattern]}"
81
81
  )
82
82
  else
@@ -1,6 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
2
  #
3
- # metric-dirsize
3
+ # metrics-dirsize
4
4
  #
5
5
  # DESCRIPTION:
6
6
  # Simple wrapper around `du` for getting directory size stats,
@@ -18,7 +18,7 @@
18
18
  # gem: sensu-plugin
19
19
  #
20
20
  # USAGE:
21
- # metric-dirsize.rb --dir /var/backups/postgres/ --real
21
+ # metrics-dirsize.rb --dir /var/backups/postgres/ --real
22
22
  #
23
23
  # NOTES:
24
24
  #
@@ -1,6 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
2
  #
3
- # metric-filesize
3
+ # metrics-filesize
4
4
  #
5
5
  # DESCRIPTION:
6
6
  # Simple wrapper around `stat` for getting file size stats,
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # metrics-nfsstat
4
+ #
5
+ # DESCRIPTION:
6
+ # Simple wrapper around `nfsstat` for getting nfs server/client stats.
7
+ #
8
+ # OUTPUT:
9
+ # metric data
10
+ #
11
+ # PLATFORMS:
12
+ # Linux
13
+ #
14
+ # DEPENDENCIES:
15
+ # gem: sensu-plugin
16
+ #
17
+ # USAGE:
18
+ #
19
+ # NOTES:
20
+ #
21
+ # LICENSE:
22
+ # Copyright 2016 Mitsutoshi Aoe
23
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
24
+ # for details.
25
+ #
26
+
27
+ require 'socket'
28
+ require 'sensu-plugin/metric/cli'
29
+
30
+ class NfsstatMetrics < Sensu::Plugin::Metric::CLI::Graphite
31
+ option :scheme,
32
+ description: 'Metric naming scheme, text to prepend to metric',
33
+ short: '-s SCHEME',
34
+ long: '--scheme SCHEME',
35
+ default: "#{Socket.gethostname}.nfsstat"
36
+
37
+ def run
38
+ begin
39
+ output = `/usr/sbin/nfsstat -l`
40
+ rescue Errno::ENOENT => err
41
+ unknown err
42
+ end
43
+
44
+ output.each_line do |line|
45
+ next unless /^nfs\s+(.+):\s+(\d+)/ =~ line
46
+ key = Regexp.last_match[1].split.join('.')
47
+ val = Regexp.last_match[2].to_i
48
+ output "#{config[:scheme]}.#{key}", val
49
+ end
50
+
51
+ ok
52
+ end
53
+ end
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsFilesystemChecks
2
2
  module Version
3
3
  MAJOR = 0
4
- MINOR = 1
4
+ MINOR = 2
5
5
  PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
metadata CHANGED
@@ -1,51 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-filesystem-checks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----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AuGXNaWItiPPMseSQzLJ
29
- JKP4hVvbc1d+oS925B1lcBiqn2aYvElbyNAVmQPywNNqkWmvtlqj9ZVJfV5HQLdu
30
- 8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
31
- HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
32
- -----END CERTIFICATE-----
33
- date: 2015-08-05 00:00:00.000000000 Z
10
+ cert_chain: []
11
+ date: 2016-03-01 00:00:00.000000000 Z
34
12
  dependencies:
35
13
  - !ruby/object:Gem::Dependency
36
14
  name: sensu-plugin
37
15
  requirement: !ruby/object:Gem::Requirement
38
16
  requirements:
39
- - - '='
17
+ - - "~>"
40
18
  - !ruby/object:Gem::Version
41
- version: 1.2.0
19
+ version: '1.2'
42
20
  type: :runtime
43
21
  prerelease: false
44
22
  version_requirements: !ruby/object:Gem::Requirement
45
23
  requirements:
46
- - - '='
24
+ - - "~>"
47
25
  - !ruby/object:Gem::Version
48
- version: 1.2.0
26
+ version: '1.2'
49
27
  - !ruby/object:Gem::Dependency
50
28
  name: bundler
51
29
  requirement: !ruby/object:Gem::Requirement
@@ -148,16 +126,16 @@ dependencies:
148
126
  name: rubocop
149
127
  requirement: !ruby/object:Gem::Requirement
150
128
  requirements:
151
- - - '='
129
+ - - "~>"
152
130
  - !ruby/object:Gem::Version
153
- version: 0.32.1
131
+ version: '0.37'
154
132
  type: :development
155
133
  prerelease: false
156
134
  version_requirements: !ruby/object:Gem::Requirement
157
135
  requirements:
158
- - - '='
136
+ - - "~>"
159
137
  - !ruby/object:Gem::Version
160
- version: 0.32.1
138
+ version: '0.37'
161
139
  - !ruby/object:Gem::Dependency
162
140
  name: yard
163
141
  requirement: !ruby/object:Gem::Requirement
@@ -172,11 +150,15 @@ dependencies:
172
150
  - - "~>"
173
151
  - !ruby/object:Gem::Version
174
152
  version: '0.8'
175
- description: Sensu plugins for filesystems
153
+ description: |-
154
+ This plugin provides native instrumentation for monitoring and metrics
155
+ collection, including:health, usage, and various metrics of filesystem
156
+ attributes.
176
157
  email: "<sensu-users@googlegroups.com>"
177
158
  executables:
178
- - metric-filesize.rb
179
- - metric-dirsize.rb
159
+ - metrics-nfsstat.rb
160
+ - metrics-filesize.rb
161
+ - metrics-dirsize.rb
180
162
  - check-tail.rb
181
163
  - check-mtime.rb
182
164
  - check-fs-writable.rb
@@ -199,8 +181,9 @@ files:
199
181
  - bin/check-fs-writable.rb
200
182
  - bin/check-mtime.rb
201
183
  - bin/check-tail.rb
202
- - bin/metric-dirsize.rb
203
- - bin/metric-filesize.rb
184
+ - bin/metrics-dirsize.rb
185
+ - bin/metrics-filesize.rb
186
+ - bin/metrics-nfsstat.rb
204
187
  - lib/sensu-plugins-filesystem-checks.rb
205
188
  - lib/sensu-plugins-filesystem-checks/version.rb
206
189
  homepage: https://github.com/sensu-plugins/sensu-plugins-filesystem-checks
@@ -1,3 +0,0 @@
1
- ��6� ���NII���T%�HD�L*W[�_�q���U�8S3���¡�g�� ����r˙�t�k���_:g�ih�n����|�%5 � �!�:��o4�A�33����s?���݅`��w�bv/-����|bX�Q�(�ӡx���%Hq昽���[�$�
2
- ��S$�3��@Ũ�"4,V5�6x��x��T�w�5+
3
- .Y�8경U�1�b&�19����T���3=BXrF��H�ÈF�L �Y����Yp
data.tar.gz.sig DELETED
@@ -1 +0,0 @@
1
- ���1:;�3��q�'=SK��5�:n���G�a� Hu�p� ��lH/��=2qJ�"��4�!{1�:�`.��2ˈ�C�Z+(DT1=��{j� .�X� 9��Axm{o��)a��
metadata.gz.sig DELETED
Binary file