sensu-plugins-zfs 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -26
- data/bin/check-zpool.rb +6 -7
- data/lib/sensu-plugins-zfs/version.rb +1 -1
- data/lib/sensu-plugins-zfs/zpool.rb +17 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c3b451ae14ff17e2f5569f4eef1358f847270a9
|
4
|
+
data.tar.gz: d7ca3bc299d41919c524ab6878e72447536f5f68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fd139ba8f539247651f0945d48243660d39f6b988494161553678caa6f067b4e8fe529dc4c7f950dfd8b089632f3e99b240d5cf92c8c5c9c431dd1d7ad54f3a
|
7
|
+
data.tar.gz: cb27a3f0ee3e105b78819a85e061f528acabd6d99d5bfed7cf53126c09dc8c531fef5c042a3d29f67911ae1671f608ca2ee0f7a071b861dc34fd813eefdb93cb
|
data/README.md
CHANGED
@@ -1,38 +1,23 @@
|
|
1
|
-
#
|
1
|
+
# SensuPluginsZFS
|
2
2
|
|
3
|
-
|
3
|
+
Sensu plugin for zfs checks.
|
4
4
|
|
5
|
-
|
5
|
+
So far we just got a simple plugin that checks if the zpool is online.
|
6
6
|
|
7
|
-
##
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem 'sensu-plugins-zfs'
|
13
|
-
```
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
7
|
+
## Checks
|
20
8
|
|
21
|
-
|
9
|
+
### check-zpool.rb
|
22
10
|
|
23
|
-
|
11
|
+
Checks if the zpool state is ONLINE
|
24
12
|
|
25
|
-
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
13
|
+
## Installation
|
14
|
+
[Installation and setup](http://sensu-plugins.io/docs/installation_instructions.html)
|
32
15
|
|
33
16
|
## Contributing
|
34
17
|
|
35
|
-
|
18
|
+
That this time ideas for additional checks/metrics would be very much appreciated.
|
19
|
+
|
20
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/blacksails/sensu-plugins-zfs.
|
36
21
|
|
37
22
|
|
38
23
|
## License
|
data/bin/check-zpool.rb
CHANGED
@@ -5,13 +5,12 @@ require 'sensu-plugins-zfs'
|
|
5
5
|
|
6
6
|
class CheckZPool < Sensu::Plugin::Check::CLI
|
7
7
|
def run
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
else
|
14
|
-
critical
|
8
|
+
zpools = SensuPluginsZFS::ZFS.zpools
|
9
|
+
zpools.each do |zp|
|
10
|
+
unless zp.ok?
|
11
|
+
critical "zpool #{zp.name} has state #{zp.state}"
|
12
|
+
end
|
15
13
|
end
|
14
|
+
ok "all zpools are ok"
|
16
15
|
end
|
17
16
|
end
|
@@ -1,7 +1,22 @@
|
|
1
1
|
module SensuPluginsZFS
|
2
|
+
class ZFS
|
3
|
+
def self.zpools
|
4
|
+
%x[sudo zpool list -H -o name].map do |name|
|
5
|
+
ZPool.new name
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
2
10
|
class ZPool
|
3
|
-
|
4
|
-
|
11
|
+
attr_reader :state, :name
|
12
|
+
|
13
|
+
def initialize(name)
|
14
|
+
@name = name
|
15
|
+
@state = %x[sudo zpool status #{name} | grep '^ state: ' | cut -d ' ' -f 3].strip
|
16
|
+
end
|
17
|
+
|
18
|
+
def ok?
|
19
|
+
return @state == "ONLINE"
|
5
20
|
end
|
6
21
|
end
|
7
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-zfs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Nørgaard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|