sensu-plugin 1.1.0 → 1.2.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: 0f7c3f8899f53b4d8ee6bddd6c5784a8a1bfaa9a
4
- data.tar.gz: f4602264337a31598521a7148b7ea50c2332c77a
3
+ metadata.gz: 0b8bf9dc7a64cb5b2a2359146d1d8cfa747fc8e6
4
+ data.tar.gz: 52223d03497178da064f55e89e307d1ab86dfef4
5
5
  SHA512:
6
- metadata.gz: 4796d2c5b1a1bd17e718a385911c5e1b9bf578e2ef0f8076161d9d7b49cf0bc3094964ab95de5420c85936ff1bf13a834ce586b101feafd43bfb07102efe38dc
7
- data.tar.gz: 908cd78083ecd040fc1d1a9f818536f5cbbdeb363ec4d1e4d8de1b766f81ded2740654dbfea2755584600fb0a85a4ce62d6142819389c52a8e0edb913a07d329
6
+ metadata.gz: d698f30f72883a2024bb7096c14cc42ec4fa740a12e337c7903018b76b2e30444030fe907b8dc962d3f2a87c2dac6fc08b2400ec00fb36d84d9f0f4d83a654f5
7
+ data.tar.gz: 5768eb08725dc2f4d723a2dc367587854f108082c08804fa6679982fd70ce684fcbb4f1f8867171a27cff6119ff94d1015594162ccdd465d619edec46f8eef13
@@ -76,6 +76,9 @@ module Sensu
76
76
  end
77
77
 
78
78
  def api_request(method, path, &blk)
79
+ if not settings.has_key?('api')
80
+ raise "api.json settings not found."
81
+ end
79
82
  http = Net::HTTP.new(settings['api']['host'], settings['api']['port'])
80
83
  req = net_http_req_class(method).new(path)
81
84
  if settings['api']['user'] && settings['api']['password']
@@ -133,6 +136,8 @@ module Sensu
133
136
  bail scope + ' alerts silenced'
134
137
  end
135
138
  end
139
+ rescue Errno::ECONNREFUSED
140
+ puts 'connection refused attempting to query the sensu api for a stash'
136
141
  rescue Timeout::Error
137
142
  puts 'timed out while attempting to query the sensu api for a stash'
138
143
  end
@@ -154,6 +159,8 @@ module Sensu
154
159
  bail 'check dependency event exists'
155
160
  end
156
161
  end
162
+ rescue Errno::ECONNREFUSED
163
+ puts 'connection refused attempting to query the sensu api for an event'
157
164
  rescue Timeout::Error
158
165
  puts 'timed out while attempting to query the sensu api for an event'
159
166
  end
@@ -1,6 +1,6 @@
1
1
  module Sensu
2
2
  module Plugin
3
- VERSION = "1.1.0"
3
+ VERSION = "1.2.0"
4
4
  EXIT_CODES = {
5
5
  'OK' => 0,
6
6
  'WARNING' => 1,
@@ -3,7 +3,9 @@ module Sensu
3
3
  module Utils
4
4
 
5
5
  def config_files
6
- if ENV['SENSU_CONFIG_FILES']
6
+ if ENV['SENSU_LOADED_TEMPFILE']
7
+ IO.read(ENV['SENSU_LOADED_TEMPFILE']).split(':')
8
+ elsif ENV['SENSU_CONFIG_FILES']
7
9
  ENV['SENSU_CONFIG_FILES'].split(':')
8
10
  else
9
11
  ['/etc/sensu/config.json'] + Dir['/etc/sensu/conf.d/**/*.json']
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.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Decklin Foster
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-09-29 00:00:00.000000000 Z
12
+ date: 2015-07-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json