check_zfs 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/bin/check_zfs +35 -29
- data/check_zfs.gemspec +5 -5
- metadata +116 -78
- data/.rvmrc +0 -1
data/.gitignore
CHANGED
data/bin/check_zfs
CHANGED
@@ -1,37 +1,22 @@
|
|
1
1
|
#!/usr/bin/env ruby -w
|
2
|
-
require 'nagiosplugin'
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
def health_by_pool
|
12
|
-
@health_by_pool ||= zpools.inject({}) do |pools,line|
|
13
|
-
name, health = line.split("\t")
|
14
|
-
pools[name] = health
|
15
|
-
pools
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def pools(health = nil)
|
20
|
-
(health && health_by_pool.select { |p,h| h == health.to_s.upcase } ) || health_by_pool
|
21
|
-
end
|
22
|
-
|
23
|
-
def critical?
|
24
|
-
!pools(:faulted).empty?
|
25
|
-
end
|
3
|
+
begin
|
4
|
+
require 'nagiosplugin'
|
5
|
+
rescue LoadError
|
6
|
+
require 'rubygems'
|
7
|
+
require 'nagiosplugin'
|
8
|
+
end
|
26
9
|
|
27
|
-
def warning?
|
28
|
-
!pools(:degraded).empty?
|
29
|
-
end
|
30
10
|
|
31
|
-
|
32
|
-
|
11
|
+
class ZFS < NagiosPlugin::Plugin
|
12
|
+
# Check the ZFS status (required method by nagiosplugin)
|
13
|
+
def check
|
14
|
+
critical(output) if !pools(:faulted).empty?
|
15
|
+
warning(output) if !pools(:degraded).empty?
|
16
|
+
ok(output) if pools(:online).count == pools.count
|
33
17
|
end
|
34
18
|
|
19
|
+
# @return [String] the summarized check result
|
35
20
|
def output
|
36
21
|
s = []
|
37
22
|
[:faulted, :degraded, :online].each do |health|
|
@@ -39,6 +24,27 @@ class ZFS < NagiosPlugin::Plugin
|
|
39
24
|
end
|
40
25
|
s.join(", ")
|
41
26
|
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def pools(health = nil)
|
31
|
+
(health && health_by_pool.select { |p,h| h == health.to_s.upcase } ) || health_by_pool
|
32
|
+
end
|
33
|
+
|
34
|
+
def health_by_pool
|
35
|
+
@health_by_pool ||= zpools.inject({}) do |pools,line|
|
36
|
+
name, health = line.split("\t")
|
37
|
+
pools[name] = health
|
38
|
+
pools
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def zpools
|
43
|
+
out = `zpool list -H -o name,health 2>&1`
|
44
|
+
raise out unless $?.success?
|
45
|
+
out.split("\n")
|
46
|
+
end
|
42
47
|
end
|
43
48
|
|
44
|
-
|
49
|
+
|
50
|
+
ZFS.run
|
data/check_zfs.gemspec
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'check_zfs'
|
5
|
-
s.version = '0.
|
6
|
-
s.authors = [
|
7
|
-
s.email = [
|
5
|
+
s.version = '0.2.0'
|
6
|
+
s.authors = ['Björn Albers']
|
7
|
+
s.email = ['bjoernalbers@googlemail.com']
|
8
8
|
s.description = 'Monitor the health of your ZFS pools with Nagios'
|
9
9
|
s.summary = "#{s.name}-#{s.version}"
|
10
10
|
s.homepage = 'https://github.com/bjoernalbers/check_zfs'
|
11
11
|
|
12
|
-
s.add_dependency 'nagiosplugin', '~> 0.0
|
12
|
+
s.add_dependency 'nagiosplugin', '~> 1.0.0'
|
13
13
|
|
14
14
|
s.add_development_dependency 'rake'
|
15
15
|
s.add_development_dependency 'cucumber', '>= 1.0.2'
|
@@ -20,5 +20,5 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.files = `git ls-files`.split("\n")
|
21
21
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
22
22
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
23
|
-
s.require_paths = [
|
23
|
+
s.require_paths = ['lib']
|
24
24
|
end
|
metadata
CHANGED
@@ -1,92 +1,127 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: check_zfs
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
-
|
12
|
+
authors:
|
13
|
+
- "Bj\xC3\xB6rn Albers"
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
+
|
18
|
+
date: 2012-03-29 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
type: :runtime
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
17
23
|
none: false
|
18
|
-
requirements:
|
24
|
+
requirements:
|
19
25
|
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
|
22
|
-
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
hash: 23
|
28
|
+
segments:
|
29
|
+
- 1
|
30
|
+
- 0
|
31
|
+
- 0
|
32
|
+
version: 1.0.0
|
23
33
|
prerelease: false
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
requirement: &70353598950600 !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
29
|
-
requirements:
|
30
|
-
- - ! '>='
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: '0'
|
34
|
+
name: nagiosplugin
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
33
37
|
type: :development
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
34
47
|
prerelease: false
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
48
|
+
name: rake
|
49
|
+
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
type: :development
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
39
53
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 19
|
58
|
+
segments:
|
59
|
+
- 1
|
60
|
+
- 0
|
61
|
+
- 2
|
43
62
|
version: 1.0.2
|
44
|
-
type: :development
|
45
63
|
prerelease: false
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
64
|
+
name: cucumber
|
65
|
+
version_requirements: *id003
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
type: :development
|
68
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
50
69
|
none: false
|
51
|
-
requirements:
|
52
|
-
- -
|
53
|
-
- !ruby/object:Gem::Version
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
hash: 3
|
74
|
+
segments:
|
75
|
+
- 0
|
76
|
+
- 4
|
77
|
+
- 6
|
54
78
|
version: 0.4.6
|
55
|
-
type: :development
|
56
79
|
prerelease: false
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
80
|
+
name: aruba
|
81
|
+
version_requirements: *id004
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
type: :development
|
84
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
61
85
|
none: false
|
62
|
-
requirements:
|
63
|
-
- -
|
64
|
-
- !ruby/object:Gem::Version
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
hash: 23
|
90
|
+
segments:
|
91
|
+
- 0
|
92
|
+
- 2
|
93
|
+
- 0
|
65
94
|
version: 0.2.0
|
66
|
-
type: :development
|
67
95
|
prerelease: false
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
96
|
+
name: aruba-doubles
|
97
|
+
version_requirements: *id005
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
type: :development
|
100
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
72
101
|
none: false
|
73
|
-
requirements:
|
74
|
-
- -
|
75
|
-
- !ruby/object:Gem::Version
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
hash: 5
|
106
|
+
segments:
|
107
|
+
- 0
|
108
|
+
- 7
|
109
|
+
- 3
|
76
110
|
version: 0.7.3
|
77
|
-
type: :development
|
78
111
|
prerelease: false
|
79
|
-
|
112
|
+
name: guard-cucumber
|
113
|
+
version_requirements: *id006
|
80
114
|
description: Monitor the health of your ZFS pools with Nagios
|
81
|
-
email:
|
115
|
+
email:
|
82
116
|
- bjoernalbers@googlemail.com
|
83
|
-
executables:
|
117
|
+
executables:
|
84
118
|
- check_zfs
|
85
119
|
extensions: []
|
120
|
+
|
86
121
|
extra_rdoc_files: []
|
87
|
-
|
122
|
+
|
123
|
+
files:
|
88
124
|
- .gitignore
|
89
|
-
- .rvmrc
|
90
125
|
- Gemfile
|
91
126
|
- Guardfile
|
92
127
|
- LICENSE
|
@@ -99,34 +134,37 @@ files:
|
|
99
134
|
- lib/check_zfs.rb
|
100
135
|
homepage: https://github.com/bjoernalbers/check_zfs
|
101
136
|
licenses: []
|
137
|
+
|
102
138
|
post_install_message:
|
103
139
|
rdoc_options: []
|
104
|
-
|
140
|
+
|
141
|
+
require_paths:
|
105
142
|
- lib
|
106
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
143
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
107
144
|
none: false
|
108
|
-
requirements:
|
109
|
-
- -
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
|
112
|
-
segments:
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
hash: 3
|
149
|
+
segments:
|
113
150
|
- 0
|
114
|
-
|
115
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
|
+
version: "0"
|
152
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
153
|
none: false
|
117
|
-
requirements:
|
118
|
-
- -
|
119
|
-
- !ruby/object:Gem::Version
|
120
|
-
|
121
|
-
segments:
|
154
|
+
requirements:
|
155
|
+
- - ">="
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
hash: 3
|
158
|
+
segments:
|
122
159
|
- 0
|
123
|
-
|
160
|
+
version: "0"
|
124
161
|
requirements: []
|
162
|
+
|
125
163
|
rubyforge_project:
|
126
|
-
rubygems_version: 1.8.
|
164
|
+
rubygems_version: 1.8.11
|
127
165
|
signing_key:
|
128
166
|
specification_version: 3
|
129
|
-
summary: check_zfs-0.
|
130
|
-
test_files:
|
167
|
+
summary: check_zfs-0.2.0
|
168
|
+
test_files:
|
131
169
|
- features/check_zfs.feature
|
132
170
|
- features/support/env.rb
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm use 1.9.2@check_zfs --create
|