sensu-plugins-disk-checks 0.0.1.alpha.4 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 380b6afbc2f12bfbb4fff5f145ffe75558a5e6cd
4
- data.tar.gz: 1f0851cdf0c4a7f50b9dd38dbf06d02b297270aa
3
+ metadata.gz: 4c6d81fc4caef9f10566d677be5c7c91347c8340
4
+ data.tar.gz: 1fee51e08c482fc2dcc02ab2d8504e2fa7c908f1
5
5
  SHA512:
6
- metadata.gz: 6a7ff14143b439f68f72510e0199a544fdc0228cae7a691f412001fd5cfc0e0497cd07be6c8aa872e45c7fa3c2cd6e516c596f1aed91f6bd56de694cdcfb4b0f
7
- data.tar.gz: c7487d14b20e17a4bc7e07bfb5fd5433f69c923a720f3c27a6831e70c6740404ae13f0587f8e20ddd60581f96e3acbb3b6d4fd75a9c0957d6fada2a2b5134a7f
6
+ metadata.gz: 09bdd997c6af774b1b1edffd51615c27625962d8aeea987c5cfceae82312053e53d4ed57c791c1562480f1a06a715b08d2beefeedabfe01c86938365744747fb
7
+ data.tar.gz: c1c33931cfc9e6527fba5c86e22ad1f91d399d9ac44d9cf6a70036e640ab9707d752d94a343f3191df15f48e49c59100a9b974e444c8f576bd265b462e49897a
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- �����~�C���[-�:DK/�;4}���>�K�=q��vg ܂���m������ȐS^�Xh�vȀ�K���dMDOyᙓu�KR>d`[�|0�>Ұ��L�ljH��X8�yT�
2
- o|>I+ϸ �Q����0�Y��;�Vj��ҝ�ݝ��x�C��3J�$}����D��W*� [J,z��i�hX\1�J�s/aG\�*����>�9��h�Ș::H m�)L�H��?[:��g���-p�5�� Ka��_0eZ���\��;YS
1
+ u`κ�U:��.
2
+ =�A��9E/���,���xD
data/CHANGELOG.md CHANGED
@@ -1,28 +1,16 @@
1
- #### 0.0.1.alpha.1
1
+ #Change Log
2
+ This project adheres to [Semantic Versioning](http://semver.org/).
2
3
 
3
- * baseline release identical to **sensu-community-plugins** repo
4
- * basic yard coverage
5
- * pinned dependencies
6
- * built against 1.9.3, 2.0, 2.1
7
- * cryptographically signed
4
+ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
8
5
 
9
- #### 0.0.1.alpha.2
6
+ ## Unreleased][unreleased]
10
7
 
11
- * bump Vagrant box to Cent 6.6
12
- * update LICENSE and gemspec authors
13
- * update README
14
- * add required Ruby version *>= 1.9.3*
15
- * add test/spec_help.rb
8
+ ## 0.0.1 - 2015-04-21
16
9
 
17
- #### 0.0.1.alpha.3
10
+ ### Added
11
+ - initial release
18
12
 
19
- * add check-smart-status
20
- * add check-smart
21
- * add pry gem as a development dependency
13
+ ## 0.0.2 - 2015-04-21
22
14
 
23
- #### 0.0.1.alpha.4
24
-
25
- * refactored check-disk to use sys-filesystem gem instead of df, it is not 100% backwards compatible dur to the new use of objects vs, plain text
26
- * depreciated check-disk in favor of check-disk-usage, it will be removed in the first stable release
27
- * add pry as a development dependency
28
- * updated README with more detailed installation instructions
15
+ ### Fixed
16
+ - deployment issue
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2015 devops@yieldbot.com
1
+ Copyright (c) 2015 Sensu-Plugins
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -5,8 +5,7 @@
5
5
  [![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-disk-checks/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-disk-checks)
6
6
  [![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-disk-checks/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-disk-checks)
7
7
  [![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-disk-checks.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-disk-checks)
8
- [![Inline docs](http://inch-ci.org/github/sensu-plugins/sensu-plugins-disk-checks.svg?branch=master&style=shields)](http://inch-ci.org/github/sensu-plugins/sensu-plugins-disk-checks)
9
-
8
+ [ ![Codeship Status for sensu-plugins/sensu-plugins-disk-checks](https://codeship.com/projects/a78630e0-cc5b-0132-01ab-7a3494c6b360/status?branch=master)](https://codeship.com/projects/76007)
10
9
  ## Functionality
11
10
 
12
11
  **check-disk-fail**
@@ -90,39 +89,6 @@ This is a sample input file used by check-smart-status, see the script for furth
90
89
 
91
90
  ## Installation
92
91
 
93
- Add the public key (if you haven’t already) as a trusted certificate
94
-
95
- ```
96
- gem cert --add <(curl -Ls https://raw.githubusercontent.com/sensu-plugins/sensu-plugins.github.io/master/certs/sensu-plugins.pem)
97
- gem install <gem> -P MediumSecurity
98
- ```
99
-
100
- You can also download the key from /certs/ within each repository.
101
-
102
- #### Rubygems
103
-
104
- `gem install sensu-plugins-disk-checks`
105
-
106
- #### Bundler
107
-
108
- Add *sensu-plugins-disk-checks* to your Gemfile and run `bundle install` or `bundle update`
109
-
110
- #### Chef
111
-
112
- Using the Sensu **sensu_gem** LWRP
113
- ```
114
- sensu_gem 'sensu-plugins-disk-checks' do
115
- options('--prerelease')
116
- version '0.0.1.alpha.2'
117
- end
118
- ```
119
-
120
- Using the Chef **gem_package** resource
121
- ```
122
- gem_package 'sensu-plugins-process-checks' do
123
- options('--prerelease')
124
- version '0.0.1.alpha.2'
125
- end
126
- ```
92
+ [Installation and Setup](https://github.com/sensu-plugins/documentation/blob/master/user_docs/installation_instructions.md)
127
93
 
128
94
  ## Notes
@@ -9,7 +9,7 @@
9
9
  # plain text
10
10
  #
11
11
  # PLATFORMS:
12
- # Linux, BSD, Solaris, Windows
12
+ # Linux, BSD, Windows
13
13
  #
14
14
  # DEPENDENCIES:
15
15
  # gem: sensu-plugin
@@ -20,7 +20,7 @@
20
20
  # NOTES:
21
21
  #
22
22
  # LICENSE:
23
- # Copyright 2015 Yieldbot Inc <devops@yieldbot.com>
23
+ # Copyright 2015 Yieldbot Inc <Sensu-Plugins>
24
24
  # Released under the same terms as Sensu (the MIT license); see LICENSE
25
25
  # for details.
26
26
  #
@@ -72,11 +72,6 @@ class CheckDisk < Sensu::Plugin::Check::CLI
72
72
  proc: proc(&:to_i),
73
73
  default: 95
74
74
 
75
- option :debug,
76
- short: '-d',
77
- long: '--debug',
78
- description: 'Output list of included filesystems'
79
-
80
75
  # Setup variables
81
76
  #
82
77
  def initialize
@@ -93,34 +88,39 @@ class CheckDisk < Sensu::Plugin::Check::CLI
93
88
  next if config[:fstype] && !config[:fstype].include?(line.mount_type)
94
89
  next if config[:ignoretype] && config[:ignoretype].include?(line.mount_type)
95
90
  next if config[:ignoremnt] && config[:ignoremnt].include?(line.mount_point)
96
- puts "Name: #{ line.name } Mount Point: #{ line.mount_point } FS Type: #{ line.mount_type }" if config[:debug]
97
91
  rescue
98
92
  unknown 'An error occured getting the mount info'
99
93
  end
100
- @fs_info = Filesystem.stat(line.mount_point)
101
- if percent_inodes >= config[:icrit]
94
+ check_mount(line)
95
+ end
96
+ end
97
+
98
+ def check_mount(line)
99
+ fs_info = Filesystem.stat(line.mount_point)
100
+ if @fs_info.respond_to?(:inodes) # needed for windows
101
+ if percent_inodes(fs_info) >= config[:icrit]
102
102
  @crit_fs << "#{line.mount_point} #{percent_inodes}% inode usage"
103
- elsif percent_inodes >= config[:iwarn]
104
- @warn_fs << "#{line.mount_point} #{percent_inodes}% inode usage"
105
- end
106
- if percent_bytes >= config[:bcrit]
107
- @crit_fs << "#{line.mount_point} #{percent_bytes}% bytes usage"
108
- elsif percent_bytes >= config[:bwarn]
109
- @warn_fs << "#{line.mount_point} #{percent_bytes}% bytes usage"
103
+ elsif percent_inodes(fs_info) >= config[:iwarn]
104
+ @warn_fs << "#{line.mount_point} #{percent_inodes}% inode usage"
110
105
  end
111
106
  end
107
+ if percent_bytes(fs_info) >= config[:bcrit]
108
+ @crit_fs << "#{line.mount_point} #{percent_bytes}% bytes usage"
109
+ elsif percent_bytes(fs_info) >= config[:bwarn]
110
+ @warn_fs << "#{line.mount_point} #{percent_bytes}% bytes usage"
111
+ end
112
112
  end
113
113
 
114
114
  # Determine the percent inode usage
115
115
  #
116
- def percent_inodes
117
- (100.0 - (100.0 * @fs_info.inodes_free / @fs_info.inodes)).round(2)
116
+ def percent_inodes(fs_info)
117
+ (100.0 - (100.0 * fs_info.inodes_free / fs_info.inodes)).round(2)
118
118
  end
119
119
 
120
120
  # Determine the percent byte usage
121
121
  #
122
- def percent_bytes
123
- (100.0 - (100.0 * @fs_info.bytes_free / @fs_info.bytes_total)).round(2)
122
+ def percent_bytes(fs_info)
123
+ (100.0 - (100.0 * fs_info.bytes_free / fs_info.bytes_total)).round(2)
124
124
  end
125
125
 
126
126
  # Generate output
@@ -119,7 +119,7 @@ class SmartCheckStatus < Sensu::Plugin::Check::CLI
119
119
 
120
120
  # Main function
121
121
  #
122
- def run
122
+ def run # rubocop:disable all
123
123
  @smart_attributes = JSON.parse(IO.read(File.dirname(__FILE__) + '/smart.json'), symbolize_names: true)[:smart][:attributes]
124
124
  @smart_debug = config[:debug] == 'on'
125
125
 
@@ -227,7 +227,7 @@ class SmartCheckStatus < Sensu::Plugin::Check::CLI
227
227
 
228
228
  # find all devices from /proc/partitions or from parameter
229
229
  #
230
- def find_devices
230
+ def find_devices # rubocop:disable all
231
231
  # Return parameter value if it's defined
232
232
  return config[:devices].split(',') unless config[:devices] == 'all'
233
233
 
data/bin/check-smart.rb CHANGED
@@ -108,7 +108,7 @@ class CheckSMART < Sensu::Plugin::Check::CLI
108
108
 
109
109
  # Main function
110
110
  #
111
- def run
111
+ def run # rubocop:disable all
112
112
  # #YELLOW
113
113
  unless @devices.length > 0 # rubocop:disable IfUnlessModifier
114
114
  unknown 'No SMART capable devices found'
@@ -57,7 +57,7 @@ class DiskCapacity < Sensu::Plugin::Metric::CLI::Graphite
57
57
 
58
58
  # Main function
59
59
  #
60
- def run
60
+ def run # rubocop:disable all
61
61
  # Get capacity metrics from DF as they don't appear in /proc
62
62
  `df -PT`.split("\n").drop(1).each do |line|
63
63
  begin
data/bin/disk-metrics.rb CHANGED
@@ -50,7 +50,7 @@ class DiskGraphite < Sensu::Plugin::Metric::CLI::Graphite
50
50
  default: false
51
51
 
52
52
  # Main function
53
- def run
53
+ def run # rubocop:disable all
54
54
  # http://www.kernel.org/doc/Documentation/iostats.txt
55
55
  metrics = %w(reads readsMerged sectorsRead readTime writes writesMerged sectorsWritten writeTime ioInProgress ioTime ioTimeWeighted)
56
56
 
@@ -92,7 +92,7 @@ class DiskUsageMetrics < Sensu::Plugin::Metric::CLI::Graphite
92
92
 
93
93
  # Main function
94
94
  #
95
- def run
95
+ def run # rubocop:disable all
96
96
  delim = config[:flatten] == true ? '_' : '.'
97
97
  # Get disk usage from df with used and avail in megabytes
98
98
  # #YELLOW
@@ -1,7 +1,14 @@
1
+ require 'sensu-plugins-disk-checks/version'
2
+
3
+ # Load the defaults
4
+
1
5
  #
2
- # Set gem version
6
+ # Default class
3
7
  #
4
8
  module SensuPluginsDiskChecks
5
- # Gem version
6
- VERSION = '0.0.1.alpha.4'
9
+ class << self
10
+ end
11
+
12
+ class << self
13
+ end
7
14
  end
@@ -0,0 +1,28 @@
1
+ require 'json'
2
+
3
+ # encoding: utf-8
4
+ module SensuPluginsDiskChecks
5
+ # This defines the version of the gem
6
+ module Version
7
+ MAJOR = 0
8
+ MINOR = 0
9
+ PATCH = 1
10
+
11
+ VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
12
+
13
+ NAME = 'sensu-plugins-disk-checks'
14
+ BANNER = "#{NAME} v%s"
15
+
16
+ module_function
17
+
18
+ def version
19
+ format(BANNER, VER_STRING)
20
+ end
21
+
22
+ def json_version
23
+ {
24
+ 'version' => VER_STRING
25
+ }.to_json
26
+ end
27
+ end
28
+ end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-disk-checks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.alpha.4
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
- - Yieldbot, Inc. and contributors
7
+ - Sensu-Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
@@ -30,196 +30,186 @@ cert_chain:
30
30
  8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
31
31
  HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
32
32
  -----END CERTIFICATE-----
33
- date: 2015-02-04 00:00:00.000000000 Z
33
+ date: 2015-05-22 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
- name: sensu-plugin
36
+ name: sys-filesystem
37
37
  requirement: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - '='
40
40
  - !ruby/object:Gem::Version
41
- version: 1.1.0
41
+ version: 1.1.4
42
42
  type: :runtime
43
43
  prerelease: false
44
44
  version_requirements: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - '='
47
47
  - !ruby/object:Gem::Version
48
- version: 1.1.0
48
+ version: 1.1.4
49
49
  - !ruby/object:Gem::Dependency
50
- name: sys-filesystem
50
+ name: filesystem
51
51
  requirement: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - '>='
53
+ - - '='
54
54
  - !ruby/object:Gem::Version
55
- version: '0'
55
+ version: 0.1.0
56
56
  type: :runtime
57
57
  prerelease: false
58
58
  version_requirements: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - '>='
60
+ - - '='
61
61
  - !ruby/object:Gem::Version
62
- version: '0'
62
+ version: 0.1.0
63
63
  - !ruby/object:Gem::Dependency
64
- name: filesystem
64
+ name: sensu-plugin
65
65
  requirement: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - '>='
67
+ - - '='
68
68
  - !ruby/object:Gem::Version
69
- version: '0'
69
+ version: 1.1.0
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - '>='
74
+ - - '='
75
75
  - !ruby/object:Gem::Version
76
- version: '0'
76
+ version: 1.1.0
77
77
  - !ruby/object:Gem::Dependency
78
78
  name: codeclimate-test-reporter
79
79
  requirement: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - '>='
81
+ - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '0'
83
+ version: '0.4'
84
84
  type: :development
85
85
  prerelease: false
86
86
  version_requirements: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - '>='
88
+ - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: '0'
90
+ version: '0.4'
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rubocop
93
93
  requirement: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - ~>
95
+ - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: 0.17.0
97
+ version: '0.30'
98
98
  type: :development
99
99
  prerelease: false
100
100
  version_requirements: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - ~>
102
+ - - "~>"
103
103
  - !ruby/object:Gem::Version
104
- version: 0.17.0
104
+ version: '0.30'
105
105
  - !ruby/object:Gem::Dependency
106
106
  name: rspec
107
107
  requirement: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - ~>
109
+ - - "~>"
110
110
  - !ruby/object:Gem::Version
111
111
  version: '3.1'
112
112
  type: :development
113
113
  prerelease: false
114
114
  version_requirements: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - ~>
116
+ - - "~>"
117
117
  - !ruby/object:Gem::Version
118
118
  version: '3.1'
119
119
  - !ruby/object:Gem::Dependency
120
120
  name: bundler
121
121
  requirement: !ruby/object:Gem::Requirement
122
122
  requirements:
123
- - - ~>
123
+ - - "~>"
124
124
  - !ruby/object:Gem::Version
125
125
  version: '1.7'
126
126
  type: :development
127
127
  prerelease: false
128
128
  version_requirements: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - ~>
130
+ - - "~>"
131
131
  - !ruby/object:Gem::Version
132
132
  version: '1.7'
133
133
  - !ruby/object:Gem::Dependency
134
134
  name: rake
135
135
  requirement: !ruby/object:Gem::Requirement
136
136
  requirements:
137
- - - ~>
137
+ - - "~>"
138
138
  - !ruby/object:Gem::Version
139
139
  version: '10.0'
140
140
  type: :development
141
141
  prerelease: false
142
142
  version_requirements: !ruby/object:Gem::Requirement
143
143
  requirements:
144
- - - ~>
144
+ - - "~>"
145
145
  - !ruby/object:Gem::Version
146
146
  version: '10.0'
147
147
  - !ruby/object:Gem::Dependency
148
148
  name: github-markup
149
149
  requirement: !ruby/object:Gem::Requirement
150
150
  requirements:
151
- - - '>='
151
+ - - "~>"
152
152
  - !ruby/object:Gem::Version
153
- version: '0'
153
+ version: '1.3'
154
154
  type: :development
155
155
  prerelease: false
156
156
  version_requirements: !ruby/object:Gem::Requirement
157
157
  requirements:
158
- - - '>='
158
+ - - "~>"
159
159
  - !ruby/object:Gem::Version
160
- version: '0'
160
+ version: '1.3'
161
161
  - !ruby/object:Gem::Dependency
162
162
  name: redcarpet
163
163
  requirement: !ruby/object:Gem::Requirement
164
164
  requirements:
165
- - - '>='
165
+ - - "~>"
166
166
  - !ruby/object:Gem::Version
167
- version: '0'
167
+ version: '3.2'
168
168
  type: :development
169
169
  prerelease: false
170
170
  version_requirements: !ruby/object:Gem::Requirement
171
171
  requirements:
172
- - - '>='
172
+ - - "~>"
173
173
  - !ruby/object:Gem::Version
174
- version: '0'
174
+ version: '3.2'
175
175
  - !ruby/object:Gem::Dependency
176
176
  name: yard
177
177
  requirement: !ruby/object:Gem::Requirement
178
178
  requirements:
179
- - - '>='
179
+ - - "~>"
180
180
  - !ruby/object:Gem::Version
181
- version: '0'
181
+ version: '0.8'
182
182
  type: :development
183
183
  prerelease: false
184
184
  version_requirements: !ruby/object:Gem::Requirement
185
185
  requirements:
186
- - - '>='
186
+ - - "~>"
187
187
  - !ruby/object:Gem::Version
188
- version: '0'
188
+ version: '0.8'
189
189
  - !ruby/object:Gem::Dependency
190
190
  name: pry
191
191
  requirement: !ruby/object:Gem::Requirement
192
192
  requirements:
193
- - - '>='
193
+ - - "~>"
194
194
  - !ruby/object:Gem::Version
195
- version: '0'
195
+ version: '0.10'
196
196
  type: :development
197
197
  prerelease: false
198
198
  version_requirements: !ruby/object:Gem::Requirement
199
199
  requirements:
200
- - - '>='
200
+ - - "~>"
201
201
  - !ruby/object:Gem::Version
202
- version: '0'
203
- description: Sensu disk checks
204
- email: <sensu-users@googlegroups.com>
205
- executables:
206
- - check-disk-fail.rb
207
- - check-disk-usage.rb
208
- - check-disk.rb
209
- - check-fs-writable.rb
210
- - check-fstab-mounts.rb
211
- - check-smart-status.rb
212
- - check-smart.rb
213
- - disk-capacity-metrics.rb
214
- - disk-metrics.rb
215
- - disk-usage-metrics.rb
202
+ version: '0.10'
203
+ description: Sensu plugins for disk checks
204
+ email: "<sensu-users@googlegroups.com>"
205
+ executables: []
216
206
  extensions: []
217
207
  extra_rdoc_files: []
218
208
  files:
219
- - bin/check-disk-fail.rb
209
+ - CHANGELOG.md
210
+ - LICENSE
211
+ - README.md
220
212
  - bin/check-disk-usage.rb
221
- - bin/check-disk.rb
222
- - bin/check-fs-writable.rb
223
213
  - bin/check-fstab-mounts.rb
224
214
  - bin/check-smart-status.rb
225
215
  - bin/check-smart.rb
@@ -227,32 +217,35 @@ files:
227
217
  - bin/disk-metrics.rb
228
218
  - bin/disk-usage-metrics.rb
229
219
  - lib/sensu-plugins-disk-checks.rb
230
- - LICENSE
231
- - README.md
232
- - CHANGELOG.md
220
+ - lib/sensu-plugins-disk-checks/version.rb
233
221
  homepage: https://github.com/sensu-plugins/sensu-plugins-disk-checks
234
222
  licenses:
235
223
  - MIT
236
- metadata: {}
237
- post_install_message:
224
+ metadata:
225
+ maintainer: "@mattyjones"
226
+ development_status: active
227
+ production_status: unstable - testing recommended
228
+ release_draft: 'false'
229
+ release_prerelease: 'false'
230
+ post_install_message: You can use the embedded Ruby by setting EMBEDDED_RUBY=true
231
+ in /etc/default/sensu
238
232
  rdoc_options: []
239
233
  require_paths:
240
234
  - lib
241
235
  required_ruby_version: !ruby/object:Gem::Requirement
242
236
  requirements:
243
- - - '>='
237
+ - - ">="
244
238
  - !ruby/object:Gem::Version
245
239
  version: 1.9.3
246
240
  required_rubygems_version: !ruby/object:Gem::Requirement
247
241
  requirements:
248
- - - '>'
242
+ - - ">="
249
243
  - !ruby/object:Gem::Version
250
- version: 1.3.1
244
+ version: '0'
251
245
  requirements: []
252
246
  rubyforge_project:
253
- rubygems_version: 2.0.14
247
+ rubygems_version: 2.4.6
254
248
  signing_key:
255
249
  specification_version: 4
256
- summary: Sensu disk checks
250
+ summary: Sensu plugins for disk checks
257
251
  test_files: []
258
- has_rdoc:
metadata.gz.sig CHANGED
Binary file
@@ -1,49 +0,0 @@
1
- #! /usr/bin/env ruby
2
- #
3
- # check-disk-fail
4
- #
5
- # DESCRIPTION:
6
- # Check for failing disks
7
- # Greps through dmesg output looking for indications that a drive is failing.
8
- #
9
- # OUTPUT:
10
- # plain text
11
- #
12
- # PLATFORMS:
13
- # Linux
14
- #
15
- # DEPENDENCIES:
16
- # gem: sensu-plugin
17
- #
18
- # USAGE:
19
- #
20
- # NOTES:
21
- #
22
- # LICENSE:
23
- # Coppyright 07/14/2014 Shane Feek and Alan Smith.
24
- # Released under the same terms as Sensu (the MIT license); see LICENSE
25
- # for details.
26
- #
27
-
28
- require 'sensu-plugin/check/cli'
29
-
30
- #
31
- # Check Disk Fail
32
- #
33
- class CheckDiskFail < Sensu::Plugin::Check::CLI
34
- # Main function
35
- #
36
- # Check the contents of dmesg for a set of given strings
37
- def run
38
- dmesg = `dmesg`.lines
39
-
40
- %w(Read Write Smart).each do |v|
41
- found = dmesg.grep(/failed command\: #{v.upcase}/)
42
- # #YELLOW
43
- unless found.empty? # rubocop:disable IfUnlessModifier
44
- critical "Disk #{v} Failure"
45
- end
46
- end
47
- ok
48
- end
49
- end
data/bin/check-disk.rb DELETED
@@ -1,157 +0,0 @@
1
- #! /usr/bin/env ruby
2
- #
3
- # check-disk
4
- #
5
- # DESCRIPTION:
6
- # Uses GNU's -T option for listing filesystem type; unfortunately, this
7
- # is not portable to BSD. Warning/critical levels are percentages only.
8
- #
9
- # OUTPUT:
10
- # plain text
11
- #
12
- # PLATFORMS:
13
- # Linux
14
- #
15
- # DEPENDENCIES:
16
- # gem: sensu-plugin
17
- #
18
- # USAGE:
19
- #
20
- # NOTES:
21
- #
22
- # LICENSE:
23
- # Copyright 2011 Sonian, Inc <chefs@sonian.net>
24
- # Released under the same terms as Sensu (the MIT license); see LICENSE
25
- # for details.
26
- #
27
-
28
- require 'sensu-plugin/check/cli'
29
-
30
- #
31
- # Check Disk
32
- #
33
- class CheckDisk < Sensu::Plugin::Check::CLI
34
- option :fstype,
35
- short: '-t TYPE[,TYPE]',
36
- description: 'Only check fs type(s)',
37
- proc: proc { |a| a.split(',') }
38
-
39
- option :ignoretype,
40
- short: '-x TYPE[,TYPE]',
41
- description: 'Ignore fs type(s)',
42
- proc: proc { |a| a.split(',') }
43
-
44
- option :ignoremnt,
45
- short: '-i MNT[,MNT]',
46
- description: 'Ignore mount point(s)',
47
- proc: proc { |a| a.split(',') }
48
-
49
- option :ignoreline,
50
- short: '-l PATTERN[,PATTERN]',
51
- description: 'Ignore df line(s) matching pattern(s)',
52
- proc: proc { |a| a.split(',') }
53
-
54
- option :includeline,
55
- short: '-L PATTERN[,PATTERN]',
56
- description: 'Only include df line(s) matching pattern(s)',
57
- proc: proc { |a| a.split(',') }
58
-
59
- option :warn,
60
- short: '-w PERCENT',
61
- description: 'Warn if PERCENT or more of disk full',
62
- proc: proc(&:to_i),
63
- default: 85
64
-
65
- option :crit,
66
- short: '-c PERCENT',
67
- description: 'Critical if PERCENT or more of disk full',
68
- proc: proc(&:to_i),
69
- default: 95
70
-
71
- option :iwarn,
72
- short: '-W PERCENT',
73
- description: 'Warn if PERCENT or more of inodes used',
74
- proc: proc(&:to_i),
75
- default: 85
76
-
77
- option :icrit,
78
- short: '-K PERCENT',
79
- description: 'Critical if PERCENT or more of inodes used',
80
- proc: proc(&:to_i),
81
- default: 95
82
-
83
- option :debug,
84
- short: '-d',
85
- long: '--debug',
86
- description: 'Output list of included filesystems'
87
-
88
- # Setup variables
89
- #
90
- def initialize
91
- super
92
- @crit_fs = []
93
- @warn_fs = []
94
- @line_count = 0
95
- end
96
-
97
- # Read the output of `df` spliting the lines based upon their fields
98
- # This will check both blocks and inodes
99
- def read_df
100
- `df -lPT`.split("\n").drop(1).each do |line|
101
- begin
102
- _fs, type, _blocks, _used, _avail, capacity, mnt = line.split
103
- next if config[:includeline] && !config[:includeline].find { |x| line.match(x) }
104
- next if config[:fstype] && !config[:fstype].include?(type)
105
- next if config[:ignoretype] && config[:ignoretype].include?(type)
106
- next if config[:ignoremnt] && config[:ignoremnt].include?(mnt)
107
- next if config[:ignoreline] && config[:ignoreline].find { |x| line.match(x) }
108
- puts line if config[:debug]
109
- rescue
110
- unknown "malformed line from df: #{line}"
111
- end
112
- @line_count += 1
113
- if capacity.to_i >= config[:crit]
114
- @crit_fs << "#{mnt} #{capacity}"
115
- elsif capacity.to_i >= config[:warn]
116
- @warn_fs << "#{mnt} #{capacity}"
117
- end
118
- end
119
-
120
- `df -lPTi`.split("\n").drop(1).each do |line|
121
- begin
122
- _fs, type, _inodes, _used, _avail, capacity, mnt = line.split
123
- next if config[:includeline] && !config[:includeline].find { |x| line.match(x) }
124
- next if config[:fstype] && !config[:fstype].include?(type)
125
- next if config[:ignoretype] && config[:ignoretype].include?(type)
126
- next if config[:ignoremnt] && config[:ignoremnt].include?(mnt)
127
- next if config[:ignoreline] && config[:ignoreline].find { |x| line.match(x) }
128
- puts line if config[:debug]
129
- rescue
130
- unknown "malformed line from df: #{line}"
131
- end
132
- @line_count += 1
133
- if capacity.to_i > config[:icrit]
134
- @crit_fs << "#{mnt} inodes #{capacity}"
135
- elsif capacity.to_i >= config[:iwarn]
136
- @warn_fs << "#{mnt} inodes #{capacity}"
137
- end
138
- end
139
- end
140
-
141
- # Generate output
142
- #
143
- def usage_summary
144
- (@crit_fs + @warn_fs).join(', ')
145
- end
146
-
147
- # Main function
148
- #
149
- def run
150
- unknown 'Do not use -l and -L options concurrently' if config[:includeline] && config[:ignoreline]
151
- read_df
152
- unknown 'No filesystems found' unless @line_count > 0
153
- critical usage_summary unless @crit_fs.empty?
154
- warning usage_summary unless @warn_fs.empty?
155
- ok "All disk usage under #{config[:warn]}% and inode usage under #{config[:iwarn]}%"
156
- end
157
- end
@@ -1,143 +0,0 @@
1
- #! /usr/bin/env ruby
2
- #
3
- # check-fs-writable
4
- #
5
- # DESCRIPTION:
6
- # This plugin checks that a filesystem is writable. Useful for checking for stale NFS mounts.
7
- #
8
- # OUTPUT:
9
- # plain text
10
- #
11
- # PLATFORMS:
12
- # Linux
13
- #
14
- # DEPENDENCIES:
15
- # gem: sensu-plugin
16
- # gem: rubysl-tempfile
17
- #
18
- # USAGE:
19
- # ./check-fs-writable.rb --auto (check all volgroups in fstab)
20
- # ./check-fs-writable.rb --dir /,/var,/usr,/home (check a defined list of directories)
21
- #
22
- # NOTES:
23
- #
24
- # LICENSE:
25
- # Copyright 2014 Yieldbot, Inc <devops@yieldbot.com>
26
- # Released under the same terms as Sensu (the MIT license); see LICENSE
27
- # for details.
28
- #
29
-
30
- require 'sensu-plugin/check/cli'
31
- require 'tempfile'
32
-
33
- #
34
- # Check Filesystem Writable
35
- #
36
- class CheckFSWritable < Sensu::Plugin::Check::CLI
37
- option :dir,
38
- description: 'Directory to check for writability',
39
- short: '-d DIRECTORY',
40
- long: '--directory DIRECTORY',
41
- proc: proc { |a| a.split(',') }
42
-
43
- option :auto,
44
- description: 'Auto discover mount points via fstab',
45
- short: '-a',
46
- long: '--auto-discover'
47
-
48
- option :debug,
49
- description: 'Print debug statements',
50
- long: '--debug'
51
-
52
- # Setup variables
53
- #
54
- def initialize
55
- super
56
- @crit_pt_proc = []
57
- @crit_pt_test = []
58
- end
59
-
60
- # Generate output
61
- #
62
- def usage_summary
63
- if @crit_pt_test.empty? && @crit_pt_proc.empty?
64
- ok 'All filesystems are writable'
65
- elsif @crit_pt_test || @crit_pt_proc
66
- critical "The following file systems are not writeable: #{ @crit_pt_test }, #{@crit_pt_proc}"
67
- end
68
- end
69
-
70
- # Get the mount points from the self namespace
71
- #
72
- def acquire_mnt_pts
73
- `grep VolGroup /proc/self/mounts | awk '{print $2, $4}' | awk -F, '{print $1}' | awk '{print $1, $2}'`
74
- end
75
-
76
- # Does proc list the mount point as rw
77
- #
78
- def rw_in_proc?(mount_info)
79
- mount_info.each do |pt|
80
- @crit_pt_proc << "#{ pt.split[0] }" if pt.split[1] != 'rw'
81
- end
82
- end
83
-
84
- # Create a tempfile at each mount point and attempt to write a line to it
85
- # If it can't write the line, or the mount point does not exist it will
86
- # generate a critical error
87
- #
88
- def rw_test?(mount_info)
89
- mount_info.each do |pt|
90
- (Dir.exist? pt.split[0]) || (@crit_pt_test << "#{ pt.split[0] }")
91
- file = Tempfile.new('.sensu', pt.split[0])
92
- puts "The temp file we are writing to is: #{ file.path }" if config[:debug]
93
- # #YELLOW
94
- # need to add a check here to validate permissions, if none it pukes
95
- file.write('mops') || @crit_pt_test << "#{ pt.split[0] }"
96
- file.read || @crit_pt_test << "#{ pt.split[0] }"
97
- file.close
98
- file.unlink
99
- end
100
- end
101
-
102
- # Auto-generate a list of mount points to check based upon the self
103
- # namespace in proc
104
- #
105
- def auto_discover
106
- # #YELLOW
107
- # this will only work for a single namespace as of now
108
- mount_info = acquire_mnt_pts.split("\n")
109
- warning 'No mount points found' if mount_info.length == 0
110
- # #YELLOW
111
- # I want to map this at some point to make it pretty and eaiser to read for large filesystems
112
- puts 'This is a list of mount_pts and their current status: ', mount_info if config[:debug]
113
- rw_in_proc?(mount_info)
114
- rw_test?(mount_info)
115
- puts "The critical mount points according to proc are: #{ @crit_pt_proc }" if config[:debug]
116
- puts "The critical mount points according to actual testing are: #{ @crit_pt_test }" if config[:debug]
117
- end
118
-
119
- # Create a tempfile as each mount point and attempt to write a line to it
120
- # If it can't write the line, or the mount point does not exist it will
121
- # generate a critical error
122
- #
123
- def manual_test
124
- config[:dir].each do |d|
125
- (Dir.exist? d) || (@crit_pt_test << "#{ d }")
126
- file = Tempfile.new('.sensu', d)
127
- puts "The temp file we are writing to is: #{ file.path }" if config[:debug]
128
- # #YELLOW
129
- # need to add a check here to validate permissions, if none it pukes
130
- file.write('mops') || @crit_pt_test << "#{ d }"
131
- file.read || @crit_pt_test << "#{ d }"
132
- file.close
133
- file.unlink
134
- end
135
- end
136
-
137
- # Main function
138
- #
139
- def run
140
- (auto_discover if config[:auto]) || (manual_test if config[:dir]) || (warning 'No directorties to check')
141
- usage_summary
142
- end
143
- end