sensu-plugin 1.0.0 → 1.1.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a18d4d1ea86bbfe682e0659f26d4da91f130882e
4
- data.tar.gz: 0aa638b240b441302ac016601320a063c7fca8cb
3
+ metadata.gz: 0f7c3f8899f53b4d8ee6bddd6c5784a8a1bfaa9a
4
+ data.tar.gz: f4602264337a31598521a7148b7ea50c2332c77a
5
5
  SHA512:
6
- metadata.gz: 1c8b01c99bb54fb66a1560a98e5cdea279763b1c66b1a351e408a9cf642bd1eebe97f1ccddbbc0f3889ef25d13e3aca1e657d3dbbf1f6c769e7dd0c650a91dbd
7
- data.tar.gz: 35ea2fcd499c24e31f24ae6a734aa9722b03cdb63361246e1162d026d7a892e611584abdc94fd2a454c4363845e13c0e1fcb656cc21da6f1f80f0e32d36aae2a
6
+ metadata.gz: 4796d2c5b1a1bd17e718a385911c5e1b9bf578e2ef0f8076161d9d7b49cf0bc3094964ab95de5420c85936ff1bf13a834ce586b101feafd43bfb07102efe38dc
7
+ data.tar.gz: 908cd78083ecd040fc1d1a9f818536f5cbbdeb363ec4d1e4d8de1b766f81ded2740654dbfea2755584600fb0a85a4ce62d6142819389c52a8e0edb913a07d329
@@ -94,17 +94,17 @@ module Sensu
94
94
  def filter_repeated
95
95
  defaults = {
96
96
  'occurrences' => 1,
97
- 'interval' => 30,
98
- 'refresh' => 1800
97
+ 'interval' => 30,
98
+ 'refresh' => 1800
99
99
  }
100
100
 
101
101
  if settings['sensu_plugin'].is_a?(Hash)
102
102
  defaults.merge!(settings['sensu_plugin'])
103
103
  end
104
104
 
105
- occurrences = @event['check']['occurrences'] || defaults['occurrences']
106
- interval = @event['check']['interval'] || defaults['interval']
107
- refresh = @event['check']['refresh'] || defaults['refresh']
105
+ occurrences = (@event['check']['occurrences'] || defaults['occurrences']).to_i
106
+ interval = (@event['check']['interval'] || defaults['interval']).to_i
107
+ refresh = (@event['check']['refresh'] || defaults['refresh']).to_i
108
108
  if @event['occurrences'] < occurrences
109
109
  bail 'not enough occurrences'
110
110
  end
@@ -1,6 +1,6 @@
1
1
  module Sensu
2
2
  module Plugin
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  EXIT_CODES = {
5
5
  'OK' => 0,
6
6
  'WARNING' => 1,
@@ -56,6 +56,9 @@ module Sensu
56
56
  check.run
57
57
  rescue SystemExit => e
58
58
  exit e.status
59
+ rescue OptionParser::InvalidOption => e
60
+ puts "Invalid check argument(s): #{e.message}, #{e.backtrace}"
61
+ exit 1
59
62
  rescue Exception => e
60
63
  # This can't call check.critical, as the check may have failed to construct
61
64
  puts "Check failed to run: #{e.message}, #{e.backtrace}"
@@ -23,7 +23,7 @@ module Sensu
23
23
  puts args[0].to_s
24
24
  else
25
25
  args[2] ||= Time.now.to_i
26
- puts args[0..2].join("\t")
26
+ puts args[0..2].join("\s")
27
27
  end
28
28
  end
29
29
  end
@@ -49,6 +49,6 @@ class TestCheckExternal < MiniTest::Unit::TestCase
49
49
 
50
50
  def test_bad_commandline
51
51
  output = run_script '--doesnotexist'
52
- assert $?.exitstatus == 2 && output.include?('doesnotexist') && output.include?('invalid option')
52
+ assert $?.exitstatus == 1 && output.include?('doesnotexist') && output.include?('invalid option')
53
53
  end
54
54
  end
@@ -23,7 +23,7 @@ class TestGraphiteMetricExternal < MiniTest::Unit::TestCase
23
23
 
24
24
  def test_multi
25
25
  lines = run_script.split("\n")
26
- assert lines.size == 2 && lines.all? {|line| line.split("\t").size == 3 }
26
+ assert lines.size == 2 && lines.all? {|line| line.split("\s").size == 3 }
27
27
  end
28
28
 
29
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Decklin Foster