check_zfs 0.0.2 → 0.0.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.
- data/Guardfile +9 -0
- data/README.md +14 -7
- data/bin/check_zfs +7 -1
- data/check_zfs.gemspec +3 -2
- data/features/check_zfs.feature +10 -1
- metadata +26 -9
data/Guardfile
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard 'cucumber' do
|
5
|
+
watch(%r{^bin/.+$}) { 'features' }
|
6
|
+
watch(%r{^features/.+\.feature$})
|
7
|
+
watch(%r{^features/support/.+$}) { 'features' }
|
8
|
+
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
|
9
|
+
end
|
data/README.md
CHANGED
@@ -2,22 +2,29 @@
|
|
2
2
|
|
3
3
|
Monitor the health of your ZFS pools with Nagios
|
4
4
|
|
5
|
-
|
5
|
+
## Introduction
|
6
6
|
|
7
|
-
|
7
|
+
Maybe you want to know if a passed out hard disk degrates your ZFS pool.
|
8
|
+
check_zfs converts the output of `zpool` into the (Nagios Plugin format)[http://nagiosplug.sourceforge.net/developer-guidelines.html]... really no rocket science.
|
9
|
+
Install this little gem on your ZFS host and let [Nagios](http://www.nagios.org/) run it via [NRPE](http://exchange.nagios.org/directory/Addons/Monitoring-Agents/NRPE--2D-Nagios-Remote-Plugin-Executor/details) to see if your pools are still green (=ONLINE).
|
10
|
+
|
11
|
+
## Installation and Usage
|
12
|
+
|
13
|
+
NRPE needs to be installed on your ZFS host and should have defined a check_zfs service.
|
14
|
+
Then install the check_zfs via RubyGems:
|
8
15
|
|
9
16
|
`gem install check_zfs`
|
10
17
|
|
11
|
-
|
18
|
+
Run it manually for testing:
|
12
19
|
|
13
20
|
`check_zfs`
|
14
21
|
|
15
|
-
TODO: Add config example for nagios!
|
16
|
-
TODO: Show command in action!
|
17
|
-
|
18
22
|
## Caveats
|
19
23
|
|
20
|
-
|
24
|
+
This gem was tested under Solaris 10 10/09 with...
|
25
|
+
|
26
|
+
`pkginfo -l SUNWzfsu`[/VERSION:\s+(.*)/,1]
|
27
|
+
=> "11.10.0,REV=2006.05.18.01.46"
|
21
28
|
|
22
29
|
## Note on Patches/Pull Requests
|
23
30
|
|
data/bin/check_zfs
CHANGED
@@ -2,8 +2,14 @@
|
|
2
2
|
require 'nagios-probe'
|
3
3
|
|
4
4
|
class CheckZFS < Nagios::Probe
|
5
|
+
def zpools
|
6
|
+
output = `zpool list -H -o name,health 2>&1`
|
7
|
+
raise output unless $?.success?
|
8
|
+
output.split("\n")
|
9
|
+
end
|
10
|
+
|
5
11
|
def health_by_pool
|
6
|
-
@health_by_pool ||=
|
12
|
+
@health_by_pool ||= zpools.inject({}) do |pools,line|
|
7
13
|
name, health = line.split("\t")
|
8
14
|
pools[name] = health
|
9
15
|
pools
|
data/check_zfs.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'check_zfs'
|
5
|
-
s.version = '0.0.
|
5
|
+
s.version = '0.0.3'
|
6
6
|
s.authors = ["Björn Albers"]
|
7
7
|
s.email = ["bjoernalbers@googlemail.com"]
|
8
8
|
s.description = 'Monitor the health of your ZFS pools with Nagios'
|
@@ -13,7 +13,8 @@ Gem::Specification.new do |s|
|
|
13
13
|
|
14
14
|
s.add_development_dependency 'cucumber', '>= 1.0.2'
|
15
15
|
s.add_development_dependency 'aruba', '>= 0.4.6'
|
16
|
-
s.add_development_dependency 'aruba-doubles', '>= 0.
|
16
|
+
s.add_development_dependency 'aruba-doubles', '>= 0.2.0'
|
17
|
+
s.add_development_dependency 'guard-cucumber', '>= 0.7.3'
|
17
18
|
|
18
19
|
s.files = `git ls-files`.split("\n")
|
19
20
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
data/features/check_zfs.feature
CHANGED
@@ -5,7 +5,7 @@ Feature: Check ZFS
|
|
5
5
|
I want the health of my ZFS pools monitored with Nagios by check_zfs
|
6
6
|
|
7
7
|
Scenario Outline: Exit status and stdout
|
8
|
-
Given
|
8
|
+
Given I could run `zpool list -H -o name,health` with stdout:
|
9
9
|
"""
|
10
10
|
rpool <rpool>
|
11
11
|
tank <tank>
|
@@ -24,3 +24,12 @@ Feature: Check ZFS
|
|
24
24
|
| ONLINE | ONLINE | ONLINE | 0 | OK: 3 ONLINE |
|
25
25
|
| ONLINE | DEGRADED | ONLINE | 1 | Warning: 1 DEGRADED, 2 ONLINE |
|
26
26
|
| ONLINE | DEGRADED | FAULTED | 2 | Critical: 1 FAULTED, 1 DEGRADED, 1 ONLINE |
|
27
|
+
|
28
|
+
Scenario: Missing zpool command
|
29
|
+
Given I could run `zpool list -H -o name,health` with exit status 127 and stderr:
|
30
|
+
"""
|
31
|
+
command not found: zpool list -H -o name,health
|
32
|
+
"""
|
33
|
+
When I run `check_zfs`
|
34
|
+
Then the exit status should be 3
|
35
|
+
And the stdout should contain "Unknown: command not found: zpool"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: check_zfs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Bj\xC3\xB6rn Albers"
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-11-02 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: nagios-probe
|
@@ -73,14 +73,30 @@ dependencies:
|
|
73
73
|
requirements:
|
74
74
|
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
hash:
|
76
|
+
hash: 23
|
77
77
|
segments:
|
78
78
|
- 0
|
79
|
-
-
|
80
|
-
-
|
81
|
-
version: 0.
|
79
|
+
- 2
|
80
|
+
- 0
|
81
|
+
version: 0.2.0
|
82
82
|
type: :development
|
83
83
|
version_requirements: *id004
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: guard-cucumber
|
86
|
+
prerelease: false
|
87
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
hash: 5
|
93
|
+
segments:
|
94
|
+
- 0
|
95
|
+
- 7
|
96
|
+
- 3
|
97
|
+
version: 0.7.3
|
98
|
+
type: :development
|
99
|
+
version_requirements: *id005
|
84
100
|
description: Monitor the health of your ZFS pools with Nagios
|
85
101
|
email:
|
86
102
|
- bjoernalbers@googlemail.com
|
@@ -93,6 +109,7 @@ extra_rdoc_files: []
|
|
93
109
|
files:
|
94
110
|
- .gitignore
|
95
111
|
- Gemfile
|
112
|
+
- Guardfile
|
96
113
|
- LICENSE
|
97
114
|
- README.md
|
98
115
|
- Rakefile
|
@@ -133,7 +150,7 @@ rubyforge_project:
|
|
133
150
|
rubygems_version: 1.8.8
|
134
151
|
signing_key:
|
135
152
|
specification_version: 3
|
136
|
-
summary: check_zfs-0.0.
|
153
|
+
summary: check_zfs-0.0.3
|
137
154
|
test_files:
|
138
155
|
- features/check_zfs.feature
|
139
156
|
- features/support/env.rb
|