sensu-plugins-megaraid 0.0.5 → 0.0.6

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: a770940b0759daaa1ea131383cccc27f30510b50
4
- data.tar.gz: cfe07f4d9205f79ea32e4430f11c191d3a9dcc23
3
+ metadata.gz: da95be9ebd4d60461d2920c17293d421d34138a8
4
+ data.tar.gz: 6dfbb81c407406254b49f8d5c70b66f1cf1ac7dd
5
5
  SHA512:
6
- metadata.gz: bd105c6bcee86a2d027b3620851e94babee952b55a7e4a6b87fdbb5ceaefb1bca86164ff5857972f2ebd567167220500854168f4a0c5a6840ffe5ab7ae386bf4
7
- data.tar.gz: 3c6f75addbef67f1a0538569901827be0f23c59c69e6b637de6f1a59e13f9be628d7385924faf941d2ccc62ca767b137e97f4348a1fbe5edde4c82a801b68bef
6
+ metadata.gz: f6ab644e952df8b87c65fb6ccf7562e2c976ef19c13d1977fd15111ffce7200e6442adb6f76202e03b93299e4997a82a8ed92ebf3f2eabdd563a07e2ea82e492
7
+ data.tar.gz: 2beefc08db2ff6e51b27c9980287152d418f095b3368471e8eb9fc5bf3242108f8b71f2b9bd8310fbb082063af4bc504ea76394b50821576f5e0d1d9f70d64b2
data/CHANGELOG.md CHANGED
@@ -3,7 +3,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
4
  This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
5
 
6
- ## Unreleased
6
+ ## [0.0.6] - 2016-01-14
7
+ ### Added
8
+ - Added --handlers command line option
7
9
 
8
10
  ## [0.0.5] - 2015-12-29
9
11
  ### Added
@@ -24,3 +26,6 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
24
26
  ## [0.0.1] - 2015-12-28
25
27
  ### Added
26
28
  - Initial release
29
+
30
+ ## Unreleased
31
+
data/README.md CHANGED
@@ -13,8 +13,12 @@ The plugin accepts the following command line options:
13
13
  Usage: check-megaraid.rb (options)
14
14
  -C, --controller-id <ID> Comma separated list of Controller ID(s) (default: all)
15
15
  -c, --storcli-cmd <PATH> Path to StorCLI executable (default: /opt/MegaRAID/storcli/storcli64)
16
+ --dryrun Do not send events to sensu client socket
17
+ --handlers <HANDLERS> Comma separated list of handlers
16
18
  -w, --warn Warn instead of throwing a critical failure
17
19
  ```
18
20
 
21
+ Use the --handlers command line option to specify which handlers you want to use for the generated events.
22
+
19
23
  ## Author
20
24
  Matteo Cerutti - <matteo.cerutti@hotmail.co.uk>
@@ -23,11 +23,24 @@ class CheckMegaRAID < Sensu::Plugin::Check::CLI
23
23
  :proc => proc { |a| a.split(',') },
24
24
  :default => []
25
25
 
26
+ option :handlers,
27
+ :description => "Comma separated list of handlers",
28
+ :long => "--handlers <HANDLER>",
29
+ :proc => proc { |s| s.split(',') },
30
+ :default => []
31
+
26
32
  option :warn,
27
33
  :description => "Warn instead of throwing a critical failure",
28
34
  :short => "-w",
29
35
  :long => "--warn",
30
- :boolean => false
36
+ :boolean => true,
37
+ :default => false
38
+
39
+ option :dryrun,
40
+ :description => "Do not send events to sensu client socket",
41
+ :long => "--dryrun",
42
+ :boolean => true,
43
+ :default => false
31
44
 
32
45
  def initialize()
33
46
  super
@@ -62,27 +75,31 @@ class CheckMegaRAID < Sensu::Plugin::Check::CLI
62
75
  end
63
76
 
64
77
  def send_client_socket(data)
65
- sock = UDPSocket.new
66
- sock.send(data + "\n", 0, "127.0.0.1", 3030)
78
+ if config[:dryrun]
79
+ puts data.inspect
80
+ else
81
+ sock = UDPSocket.new
82
+ sock.send(data + "\n", 0, "127.0.0.1", 3030)
83
+ end
67
84
  end
68
85
 
69
86
  def send_ok(check_name, msg)
70
- event = {"name" => check_name, "status" => 0, "output" => "OK: #{msg}", "handler" => config[:handler]}
87
+ event = {"name" => check_name, "status" => 0, "output" => "#{self.class.name} OK: #{msg}", "handlers" => config[:handlers]}
71
88
  send_client_socket(event.to_json)
72
89
  end
73
90
 
74
91
  def send_warning(check_name, msg)
75
- event = {"name" => check_name, "status" => 1, "output" => "WARNING: #{msg}", "handler" => config[:handler]}
92
+ event = {"name" => check_name, "status" => 1, "output" => "#{self.class.name} WARNING: #{msg}", "handlers" => config[:handlers]}
76
93
  send_client_socket(event.to_json)
77
94
  end
78
95
 
79
96
  def send_critical(check_name, msg)
80
- event = {"name" => check_name, "status" => 2, "output" => "CRITICAL: #{msg}", "handler" => config[:handler]}
97
+ event = {"name" => check_name, "status" => 2, "output" => "#{self.class.name} CRITICAL: #{msg}", "handlers" => config[:handlers]}
81
98
  send_client_socket(event.to_json)
82
99
  end
83
100
 
84
101
  def send_unknown(check_name, msg)
85
- event = {"name" => check_name, "status" => 3, "output" => "UNKNOWN: #{msg}", "handler" => config[:handler]}
102
+ event = {"name" => check_name, "status" => 3, "output" => "#{self.class.name} UNKNOWN: #{msg}", "handlers" => config[:handlers]}
86
103
  send_client_socket(event.to_json)
87
104
  end
88
105
 
@@ -2,7 +2,7 @@ module SensuPluginsMegaRAID
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- PATCH = 5
5
+ PATCH = 6
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-megaraid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matteo Cerutti
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-29 00:00:00.000000000 Z
11
+ date: 2016-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin