sensu-plugins-graphite 2.1.0 → 2.2.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 +4 -4
- data/CHANGELOG.md +5 -1
- data/bin/check-graphite-data.rb +0 -64
- data/lib/sensu-plugins-graphite/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d927f5d0696a7ae2fd4e5b80737c2dd04871dcf5
|
|
4
|
+
data.tar.gz: 00a59e69564492be952412b9fa7ee085cebe7217
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e99c76be15977f9ba3423c5fd42fd4b6b121d4670dcd8ccda431bed1ccf93e275c9edd1336b49d73cc2cb8714db2c09897d3a42bf39434701a4befc49ffa3c57
|
|
7
|
+
data.tar.gz: d5c6ca351b7a3f13e5433a2492f7cd6132c746be4ed76ff71d50d741fee2c3b1b3e539ccceae71656735a9a504f479867cbfffad49dde28757a41980d1c3f16f
|
data/CHANGELOG.md
CHANGED
|
@@ -4,12 +4,15 @@ 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
|
+
|
|
7
8
|
## [2.1.0]
|
|
8
9
|
### Changed
|
|
9
10
|
- Disable filtering for handler-graphite-status.rb
|
|
10
11
|
### Fixed
|
|
11
12
|
- Error handling in graphite handlers
|
|
12
13
|
- Duplicate short option in check-graphite.rb
|
|
14
|
+
### Removed
|
|
15
|
+
- check-graphite-data.rb: Removed unused method `retrieve_data` since it's duplicate from graphite_proxy
|
|
13
16
|
|
|
14
17
|
## [2.0.0] - 2016-06-21
|
|
15
18
|
### Added
|
|
@@ -68,7 +71,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
|
68
71
|
### Added
|
|
69
72
|
- initial release
|
|
70
73
|
|
|
71
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-graphite/compare/2.
|
|
74
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-graphite/compare/2.2.0...HEAD
|
|
75
|
+
[2.2.0]: https://github.com/sensu-plugins/sensu-plugins-graphite/compare/2.1.0...2.2.0
|
|
72
76
|
[2.1.0]: https://github.com/sensu-plugins/sensu-plugins-graphite/compare/2.0.0...2.1.0
|
|
73
77
|
[2.0.0]: https://github.com/sensu-plugins/sensu-plugins-graphite/compare/1.1.0...2.0.0
|
|
74
78
|
[1.1.0]: https://github.com/sensu-plugins/sensu-plugins-graphite/compare/1.0.0...1.1.0
|
data/bin/check-graphite-data.rb
CHANGED
|
@@ -84,70 +84,6 @@ class CheckGraphiteData < Sensu::Plugin::Check::CLI
|
|
|
84
84
|
end
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
-
# grab data from graphite
|
|
88
|
-
def retrieve_data
|
|
89
|
-
unless @raw_data
|
|
90
|
-
begin
|
|
91
|
-
unless config[:server].start_with?('https://', 'http://')
|
|
92
|
-
config[:server].prepend('http://')
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
url = "#{config[:server]}/render?format=json&target=#{formatted_target}&from=#{config[:from]}&until=#{config[:until]}"
|
|
96
|
-
|
|
97
|
-
url_opts = {}
|
|
98
|
-
|
|
99
|
-
if config[:no_ssl_verify]
|
|
100
|
-
url_opts[:ssl_verify_mode] = OpenSSL::SSL::VERIFY_NONE
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
if config[:username] && (config[:password] || config[:passfile])
|
|
104
|
-
if config[:passfile]
|
|
105
|
-
pass = File.open(config[:passfile]).readline
|
|
106
|
-
elsif config[:password]
|
|
107
|
-
pass = config[:password]
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
url_opts[:http_basic_authentication] = [config[:username], pass.chomp]
|
|
111
|
-
end # we don't have both username and password trying without
|
|
112
|
-
|
|
113
|
-
handle = open(url, url_opts)
|
|
114
|
-
|
|
115
|
-
@raw_data = handle.gets
|
|
116
|
-
if @raw_data == '[]'
|
|
117
|
-
unknown 'Empty data received from Graphite - metric probably doesn\'t exist'
|
|
118
|
-
else
|
|
119
|
-
@json_data = JSON.parse(@raw_data)
|
|
120
|
-
output = {}
|
|
121
|
-
@json_data.each do |raw|
|
|
122
|
-
raw['datapoints'].delete_if { |v| v.first.nil? }
|
|
123
|
-
next if raw['datapoints'].empty?
|
|
124
|
-
target = raw['target']
|
|
125
|
-
data = raw['datapoints'].map(&:first)
|
|
126
|
-
start = raw['datapoints'].first.last
|
|
127
|
-
dend = raw['datapoints'].last.last
|
|
128
|
-
step = ((dend - start) / raw['datapoints'].size.to_f).ceil
|
|
129
|
-
output[target] = { 'target' => target, 'data' => data, 'start' => start, 'end' => dend, 'step' => step }
|
|
130
|
-
end
|
|
131
|
-
output
|
|
132
|
-
end
|
|
133
|
-
rescue SocketError
|
|
134
|
-
unknown 'Failed to connect to graphite server'
|
|
135
|
-
rescue OpenURI::HTTPError
|
|
136
|
-
unknown 'Server error or invalid graphite expression'
|
|
137
|
-
rescue NoMethodError
|
|
138
|
-
unknown 'No data for time period and/or target'
|
|
139
|
-
rescue Errno::ECONNREFUSED
|
|
140
|
-
unknown 'Connection refused when connecting to Graphite server'
|
|
141
|
-
rescue Errno::ECONNRESET
|
|
142
|
-
unknown 'Connection reset by peer when connecting to Graphite server'
|
|
143
|
-
rescue EOFError
|
|
144
|
-
unknown 'End of file error when reading from Graphite server'
|
|
145
|
-
rescue => e
|
|
146
|
-
unknown "An unknown error occurred: #{e.inspect}"
|
|
147
|
-
end
|
|
148
|
-
end
|
|
149
|
-
end
|
|
150
|
-
|
|
151
87
|
# type:: :warning or :critical
|
|
152
88
|
# Return alert if required
|
|
153
89
|
def check(type)
|
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.2.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: 2017-06-
|
|
11
|
+
date: 2017-06-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: array_stats
|