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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 53e49f4d8ed9518608e5f0777127b65f882c337b
4
- data.tar.gz: d3cb7415a9e93656e679d9a021571a224813d8c4
3
+ metadata.gz: 0c3b451ae14ff17e2f5569f4eef1358f847270a9
4
+ data.tar.gz: d7ca3bc299d41919c524ab6878e72447536f5f68
5
5
  SHA512:
6
- metadata.gz: e058ff43358de8d1007e6f1dfafb68467401ad21afdcb05a74e8266f69a88f45aa604c6f24a3adee412a2b5cf3ea2caddc18f65e843da448b0a273457449e230
7
- data.tar.gz: 63b8e4f3894b96d2a7a284c3b20c2f95e6a4c0fcacfa854555fadbfe2bc4ab0d3eb6c373b22c60c5b3773bd2d4d125ab46a56b434d7c9b7de6e800040cf8714c
6
+ metadata.gz: 5fd139ba8f539247651f0945d48243660d39f6b988494161553678caa6f067b4e8fe529dc4c7f950dfd8b089632f3e99b240d5cf92c8c5c9c431dd1d7ad54f3a
7
+ data.tar.gz: cb27a3f0ee3e105b78819a85e061f528acabd6d99d5bfed7cf53126c09dc8c531fef5c042a3d29f67911ae1671f608ca2ee0f7a071b861dc34fd813eefdb93cb
data/README.md CHANGED
@@ -1,38 +1,23 @@
1
- # Sensu::Plugins::Zfs
1
+ # SensuPluginsZFS
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/sensu/plugins/zfs`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Sensu plugin for zfs checks.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ So far we just got a simple plugin that checks if the zpool is online.
6
6
 
7
- ## Installation
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
- $ gem install sensu-plugins-zfs
9
+ ### check-zpool.rb
22
10
 
23
- ## Usage
11
+ Checks if the zpool state is ONLINE
24
12
 
25
- TODO: Write usage instructions here
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
- Bug reports and pull requests are welcome on GitHub at https://github.com/Benjamin Nørgaard/sensu-plugins-zfs.
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
- zpool = SensuPluginsZFS::ZPool.new
9
- state = zpool.state
10
- message "zpool state is #{state}"
11
- if state == "ONLINE"
12
- ok
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,3 +1,3 @@
1
1
  module SensuPluginsZFS
2
- VERSION = "0.2.2"
2
+ VERSION = "0.3.0"
3
3
  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
- def state
4
- %x[sudo zpool status | grep '^ state: ' | cut -d ' ' -f 3].strip
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.2.2
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-20 00:00:00.000000000 Z
11
+ date: 2017-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin