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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b0ed94d0467ef520453c752e6e826c9a698303e3
4
- data.tar.gz: 3d8a2558a51d4db142df3019bd36299c7a7ce5cf
3
+ metadata.gz: 00e6cf84c928223961b1c067386b24560ad898c3
4
+ data.tar.gz: 66768c9f5f7500b47caa5b7e7d759634a93bbc4f
5
5
  SHA512:
6
- metadata.gz: 3aafa1c88a6c0dd5075bbc6a3bf44f24d93bc50b094fce91f042be39f4dfa51c7672b16927c91110312da879ec04546ceef4c3f0304c2cec0f7a99b9a14eb7c4
7
- data.tar.gz: f528a0d4fbcaa5c2a1aa792649dc79fef52d021a2535090563bc2e8c9e1a0beaa2045a5e6e373a6842d0f7ba6494f7eb9d6b249fd99d9359ae5bbe3e3c99a8dc
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.8.0] - 2018-07-18
7
- - Added `source:sensu` label to `service.status` metric
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
@@ -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: "sensu.#{sanitize_value(@check_name)}"}
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: "sensu.#{sanitize_value(@check_name)}"}
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 host [String] (Optional) hostname of host that ran the check
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, host=@host, timestamp=@event['check']['executed'].to_i * 1000)
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
- return create_datapoint('service.status', check_status, timestamp, labels, host)
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 metric_host [String] (Optional) Set a host for the metric
267
+ # @param hostname [String] (Optional) Set a hostname for the metric
262
268
  #
263
- def create_datapoint(name, value, time, labels = {}, metric_host=@host)
269
+ def create_datapoint(name, value, time, labels = {}, hostname=@host)
264
270
  datapoint = {
265
- host: metric_host,
271
+ host: hostname,
266
272
  labels: labels,
267
273
  name: name,
268
274
  timestamp: time,
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsOutlyer
2
2
  module Version
3
3
  MAJOR = 0
4
- MINOR = 8
4
+ MINOR = 9
5
5
  PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-outlyer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dataloop Software, INC. Trading as Outlyer