sensu-plugins-outlyer 0.8.0 → 0.9.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 +2 -2
- data/bin/outlyer-metrics.rb +14 -8
- data/lib/sensu-plugins-outlyer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00e6cf84c928223961b1c067386b24560ad898c3
|
4
|
+
data.tar.gz: 66768c9f5f7500b47caa5b7e7d759634a93bbc4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c55c068f0d9710beea2a1bf1d0b5ca9be2fe66fba39eac687e79a753a879241cae83196839c486105f0c92a315b76a1532adad229055a70befc7da95ba340a9
|
7
|
+
data.tar.gz: 9b0fa05ac20330bc11bcb2ad725844350e8e3dc049be0bb688a64592071ba50aa1f4acbc470c34afcb7ba1d2334fc664b0011712162f22cd03994e687f4bc8e6
|
data/CHANGELOG.md
CHANGED
@@ -3,8 +3,8 @@ 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
|
-
## [0.
|
7
|
-
- Added `source:sensu` label to
|
6
|
+
## [0.9.0] - 2018-07-18
|
7
|
+
- Added `source:sensu` label to metrics
|
8
8
|
- Fixed bug with Nagios parsing
|
9
9
|
|
10
10
|
## [0.7.0] - 2018-07-16
|
data/bin/outlyer-metrics.rb
CHANGED
@@ -109,7 +109,8 @@ class OutlyerMetrics < Sensu::Handler
|
|
109
109
|
begin
|
110
110
|
name = metric_parts[0]
|
111
111
|
value = metric_parts[1].split(";")[0].to_f
|
112
|
-
labels = {service:
|
112
|
+
labels = {service: sanitize_value(@check_name),
|
113
|
+
source: 'sensu'}
|
113
114
|
data.push(create_datapoint(name, value, @event['check']['executed'].to_i * 1000, labels))
|
114
115
|
rescue => error
|
115
116
|
# Raised when any metrics could not be parsed
|
@@ -141,7 +142,8 @@ class OutlyerMetrics < Sensu::Handler
|
|
141
142
|
output.split("\n").each do |metric|
|
142
143
|
m = metric.split
|
143
144
|
next unless m.count == 3
|
144
|
-
labels = {service:
|
145
|
+
labels = {service: sanitize_value(@check_name),
|
146
|
+
source: 'sensu'}
|
145
147
|
|
146
148
|
# Check to see if we have a scheme filter that matches the metric name
|
147
149
|
if schemes
|
@@ -220,15 +222,19 @@ class OutlyerMetrics < Sensu::Handler
|
|
220
222
|
# Unknown is used to tell Outlyer there was a parsing error for the check
|
221
223
|
#
|
222
224
|
# @param check_status [Integer] Check status code
|
223
|
-
# @param
|
225
|
+
# @param hostname [String] (Optional) hostname of host that ran the check
|
224
226
|
# @param timestamp [Integer] (Optional) timestamp of when host ran the check
|
225
227
|
#
|
226
|
-
def create_status_metric(check_status,
|
228
|
+
def create_status_metric(check_status, hostname=@host, timestamp=@event['check']['executed'].to_i * 1000)
|
227
229
|
labels = {
|
228
230
|
service: sanitize_value(@check_name),
|
229
231
|
source: 'sensu'
|
230
232
|
}
|
231
|
-
|
233
|
+
point = create_datapoint('service.status', check_status, timestamp, labels, hostname)
|
234
|
+
if config[:debug]
|
235
|
+
puts "Created status datapoint with properties #{point}"
|
236
|
+
end
|
237
|
+
point
|
232
238
|
end
|
233
239
|
|
234
240
|
# Ensures all label values conform to Outlyer's data format requirements:
|
@@ -258,11 +264,11 @@ class OutlyerMetrics < Sensu::Handler
|
|
258
264
|
# @param value [Float] metric value
|
259
265
|
# @param time [Integer] epoch timestamp of metric in milliseconds
|
260
266
|
# @param labels [HashMap] (Optional) Additional labels to append to data point
|
261
|
-
# @param
|
267
|
+
# @param hostname [String] (Optional) Set a hostname for the metric
|
262
268
|
#
|
263
|
-
def create_datapoint(name, value, time, labels = {},
|
269
|
+
def create_datapoint(name, value, time, labels = {}, hostname=@host)
|
264
270
|
datapoint = {
|
265
|
-
host:
|
271
|
+
host: hostname,
|
266
272
|
labels: labels,
|
267
273
|
name: name,
|
268
274
|
timestamp: time,
|