sensu-plugins-graphite 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -1
- data/README.md +1 -1
- data/bin/check-graphite-stats.rb +1 -1
- data/bin/check-graphite.rb +2 -2
- data/bin/handler-graphite-event.rb +1 -1
- data/bin/handler-graphite-notify.rb +2 -2
- data/bin/handler-graphite-status.rb +5 -2
- data/lib/sensu-plugins-graphite/graphite_proxy/proxy.rb +14 -21
- data/lib/sensu-plugins-graphite/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8331eec9eb6a5f9cf9247c209a05cbd4735c67c4
|
4
|
+
data.tar.gz: a0add0a78abe919a5c43f8df3241f1123ce09ffa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e0ada3c1be5f354b91f03955036e15efbc79a180dfcece3135d743a148eac9fd5ae9c5698d6c5050ff9a82fdbe92cf86a759bb5b59b5805a448aae012c3a9d7
|
7
|
+
data.tar.gz: 928b1e29800fe91a4f951a4059786179a19b8954f37f244c6cd74dae05a0982ec2f25b67f3abe36e86fd73a98a4f1e3d405a60a81e920e90ecdbdd365850337e
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,12 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
4
4
|
This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
|
+
## [2.1.0]
|
8
|
+
### Changed
|
9
|
+
- Disable filtering for handler-graphite-status.rb
|
10
|
+
### Fixed
|
11
|
+
- Error handling in graphite handlers
|
12
|
+
- Duplicate short option in check-graphite.rb
|
7
13
|
|
8
14
|
## [2.0.0] - 2016-06-21
|
9
15
|
### Added
|
@@ -62,7 +68,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
62
68
|
### Added
|
63
69
|
- initial release
|
64
70
|
|
65
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-graphite/compare/2.
|
71
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-graphite/compare/2.1.0...HEAD
|
72
|
+
[2.1.0]: https://github.com/sensu-plugins/sensu-plugins-graphite/compare/2.0.0...2.1.0
|
66
73
|
[2.0.0]: https://github.com/sensu-plugins/sensu-plugins-graphite/compare/1.1.0...2.0.0
|
67
74
|
[1.1.0]: https://github.com/sensu-plugins/sensu-plugins-graphite/compare/1.0.0...1.1.0
|
68
75
|
[1.0.0]: https://github.com/sensu-plugins/sensu-plugins-graphite/compare/0.0.7...1.0.0
|
data/README.md
CHANGED
data/bin/check-graphite-stats.rb
CHANGED
data/bin/check-graphite.rb
CHANGED
@@ -67,14 +67,14 @@ class Graphite < Sensu::Plugin::Check::CLI
|
|
67
67
|
|
68
68
|
option :acceptable_diff_percentage,
|
69
69
|
description: 'The acceptable diff from max values in percentage, used in check_function_increasing',
|
70
|
-
short: '-
|
70
|
+
short: '-D ACCEPTABLE_DIFF_PERCENTAGE',
|
71
71
|
long: '--acceptable_diff_percentage ACCEPTABLE_DIFF_PERCENTAGE',
|
72
72
|
default: 0
|
73
73
|
|
74
74
|
option :check_function_increasing,
|
75
75
|
description: 'Check that value is increasing or equal over time (use acceptable_diff_percentage if it should allow to be lower)',
|
76
76
|
short: '-i',
|
77
|
-
long: '--
|
77
|
+
long: '--check_function_increasing',
|
78
78
|
default: false,
|
79
79
|
boolean: true
|
80
80
|
|
@@ -26,7 +26,7 @@ class GraphiteEvent < Sensu::Handler
|
|
26
26
|
uri = URI.parse(uri)
|
27
27
|
req = Net::HTTP::Post.new(uri.path)
|
28
28
|
sock = Net::HTTP.new(uri.host, uri.port)
|
29
|
-
sock.use_ssl = uri.scheme == 'https'
|
29
|
+
sock.use_ssl = uri.scheme == 'https'
|
30
30
|
req.body = body
|
31
31
|
|
32
32
|
req.basic_auth(uri.user, uri.password) if uri.user
|
@@ -21,8 +21,8 @@ class Resolve < Sensu::Handler
|
|
21
21
|
graphite.push_to_graphite do |graphite_socket|
|
22
22
|
graphite_socket.puts message
|
23
23
|
end
|
24
|
-
rescue
|
25
|
-
error_msg = "Can't connect to #{settings['graphite_notify']['host']}:#{port} and send message #{message}'"
|
24
|
+
rescue => e
|
25
|
+
error_msg = "Can't connect to #{settings['graphite_notify']['host']}:#{port} and send message #{message}: #{e}'"
|
26
26
|
raise error_msg
|
27
27
|
end
|
28
28
|
end
|
@@ -11,6 +11,9 @@ require 'sensu-handler'
|
|
11
11
|
require 'simple-graphite'
|
12
12
|
|
13
13
|
class Resolve < Sensu::Handler
|
14
|
+
# override filters from Sensu::Handler. not appropriate for metric handlers
|
15
|
+
def filter; end
|
16
|
+
|
14
17
|
def handle
|
15
18
|
port = settings['graphite_notify']['port'] ? settings['graphite_notify']['port'].to_s : '2003'
|
16
19
|
graphite = Graphite.new(host: settings['graphite_notify']['host'], port: port)
|
@@ -22,8 +25,8 @@ class Resolve < Sensu::Handler
|
|
22
25
|
graphite.push_to_graphite do |graphite_socket|
|
23
26
|
graphite_socket.puts message
|
24
27
|
end
|
25
|
-
rescue
|
26
|
-
error_msg = "Can't connect to #{settings['graphite_notify']['host']}:#{port} and send message #{message}'"
|
28
|
+
rescue => e
|
29
|
+
error_msg = "Can't connect to #{settings['graphite_notify']['host']}:#{port} and send message #{message}: #{e}'"
|
27
30
|
raise error_msg
|
28
31
|
end
|
29
32
|
end
|
@@ -3,10 +3,7 @@ require 'open-uri'
|
|
3
3
|
module SensuPluginsGraphite
|
4
4
|
module GraphiteProxy
|
5
5
|
class ProxyError < StandardError
|
6
|
-
|
7
|
-
|
8
|
-
def initialize(msg, args)
|
9
|
-
self.exception = args[:exception]
|
6
|
+
def initialize(msg)
|
10
7
|
super msg
|
11
8
|
end
|
12
9
|
end
|
@@ -87,24 +84,20 @@ module SensuPluginsGraphite
|
|
87
84
|
handle = open(url, request_auth_options(config))
|
88
85
|
|
89
86
|
@raw_data = handle.gets
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
rescue
|
97
|
-
raise ProxyError
|
98
|
-
rescue
|
99
|
-
raise ProxyError
|
100
|
-
rescue
|
101
|
-
raise ProxyError
|
102
|
-
rescue Errno::ECONNRESET => e
|
103
|
-
raise ProxyError.new('Connection reset by peer when connecting to Graphite server', exception: e)
|
104
|
-
rescue EOFError => e
|
105
|
-
raise ProxyError.new('End of file error when reading from Graphite server', exception: e)
|
87
|
+
json_data = JSON.parse(@raw_data)
|
88
|
+
format_output(json_data)
|
89
|
+
rescue OpenURI::HTTPError
|
90
|
+
raise ProxyError, 'Failed to connect to Graphite server'
|
91
|
+
rescue NoMethodError, JSON::ParserError
|
92
|
+
raise ProxyError, 'No data for time period and/or target'
|
93
|
+
rescue Errno::ECONNREFUSED
|
94
|
+
raise ProxyError, 'Connection refused when connecting to Graphite server'
|
95
|
+
rescue Errno::ECONNRESET
|
96
|
+
raise ProxyError, 'Connection reset by peer when connecting to Graphite server'
|
97
|
+
rescue EOFError
|
98
|
+
raise ProxyError, 'End of file error when reading from Graphite server'
|
106
99
|
rescue => e
|
107
|
-
raise ProxyError
|
100
|
+
raise ProxyError, "An unknown error occurred: #{e.inspect}"
|
108
101
|
end
|
109
102
|
end
|
110
103
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-graphite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sensu Plugins and contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: array_stats
|
@@ -268,9 +268,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
268
268
|
version: '0'
|
269
269
|
requirements: []
|
270
270
|
rubyforge_project:
|
271
|
-
rubygems_version: 2.5
|
271
|
+
rubygems_version: 2.4.5
|
272
272
|
signing_key:
|
273
273
|
specification_version: 4
|
274
274
|
summary: Sensu plugins for graphite
|
275
275
|
test_files: []
|
276
|
-
has_rdoc:
|