sensu-plugins-influxdb-metrics-checker 0.4.4 → 0.4.8
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 -4
- data/bin/check-influxdb-metrics.rb +35 -27
- data/lib/sensu-plugins-influxdb-metrics-checker/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: 1c949341d92c3b4ab53a73e4bb6730e7c96cf06f
|
4
|
+
data.tar.gz: 1f7b5faba9d2d4beaf0400999c6c5effc8d06a7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fa1d53baacf1dc0a5e047c6b43c51d121d8aca09c81eefa703cfc07840f9aaa14ab4f4de16fd27e95f28b6278aaa5c137f49987212a4d950eaab501f2fdd7df
|
7
|
+
data.tar.gz: 9d6702dfdc47bf67fee5cc9c401b994741569b98f6d46ae73328021206d7fa913194aab5329f09574101b53d655a87129be3b48d0227bab611215bfb0dd61033
|
data/CHANGELOG.md
CHANGED
@@ -3,11 +3,14 @@ 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.4.
|
6
|
+
# [0.4.8] - 2017-01-24
|
7
|
+
- ninth release
|
8
|
+
Bug fix when values comes as null. Now they will become zero.
|
9
|
+
|
10
|
+
# [0.4.4] - 2017-01-20
|
7
11
|
- eight release
|
8
12
|
Small fix when printing numbers
|
9
13
|
|
10
|
-
|
11
14
|
# [0.4.0] - 2017-01-20
|
12
15
|
- seventh release
|
13
16
|
New feature: Triangulation. Added the ability to get percentage of metric A, get percentage of metric B, and compare the distance between them. Useful when the metrics are related together by some business rule.
|
@@ -52,5 +55,6 @@ Leaving 5 minutes to the data to consolidate.
|
|
52
55
|
[0.3.0]: https://github.com/pliyosenpai/sensu-plugins-influxdb-metrics-checker/0.3.0...0.3.2
|
53
56
|
[0.3.2]: https://github.com/pliyosenpai/sensu-plugins-influxdb-metrics-checker/0.3.2...0.3.4
|
54
57
|
[0.3.4]: https://github.com/pliyosenpai/sensu-plugins-influxdb-metrics-checker/0.3.4...0.4.0
|
55
|
-
[0.4.0]: https://github.com/pliyosenpai/sensu-plugins-influxdb-metrics-checker/0.4.0...0.4.
|
56
|
-
[0.4.
|
58
|
+
[0.4.0]: https://github.com/pliyosenpai/sensu-plugins-influxdb-metrics-checker/0.4.0...0.4.4
|
59
|
+
[0.4.4]: https://github.com/pliyosenpai/sensu-plugins-influxdb-metrics-checker/0.4.4...0.4.8
|
60
|
+
[0.4.8]: https://github.com/pliyosenpai/sensu-plugins-influxdb-metrics-checker/0.4.8...HEAD
|
@@ -155,7 +155,7 @@ class CheckInfluxDbMetrics < Sensu::Plugin::Check::CLI
|
|
155
155
|
|
156
156
|
def metrics(metric, start_period, end_period, istriangulated)
|
157
157
|
query = query_encoded_for_a_period(metric, start_period, end_period, istriangulated)
|
158
|
-
response = request(query)
|
158
|
+
response = request(query) # puts response if debugging and what to know whats going on
|
159
159
|
parse_json(response)
|
160
160
|
end
|
161
161
|
|
@@ -174,45 +174,49 @@ class CheckInfluxDbMetrics < Sensu::Plugin::Check::CLI
|
|
174
174
|
def today_metrics
|
175
175
|
today_info = metrics(config[:metric], TODAY_START_PERIOD, today_end_period, false)
|
176
176
|
@today_metric_count = validate_metrics_and_count(today_info)
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
177
|
+
if @today_metric_count > 0
|
178
|
+
series = read_series_from_metrics(today_info)
|
179
|
+
@today_metrics = store_metrics(series)
|
180
|
+
read_value_from_series(series)
|
181
|
+
else
|
182
|
+
0
|
183
|
+
end
|
183
184
|
end
|
184
185
|
|
185
186
|
def yesterday_metrics
|
186
187
|
yesterday_info = metrics(config[:metric], YESTERDAY_START_PERIOD, yesterday_end_period, false)
|
187
188
|
@yesterday_metric_count = validate_metrics_and_count(yesterday_info)
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
189
|
+
if @yesterday_metric_count > 0
|
190
|
+
series = read_series_from_metrics(yesterday_info)
|
191
|
+
@yesterday_metrics = store_metrics(series)
|
192
|
+
read_value_from_series(series)
|
193
|
+
else
|
194
|
+
0
|
195
|
+
end
|
194
196
|
end
|
195
197
|
|
196
198
|
def today_triangulated_metrics
|
197
199
|
today_triangulated_info = metrics(config[:triangulate], TODAY_START_PERIOD, today_end_period, true)
|
198
200
|
@today_triangulated_metric_count = validate_metrics_and_count(today_triangulated_info)
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
201
|
+
if @today_triangulated_metric_count > 0
|
202
|
+
series = read_series_from_metrics(today_triangulated_info)
|
203
|
+
@today_triangulated_metrics = store_metrics(series)
|
204
|
+
read_value_from_series(series)
|
205
|
+
else
|
206
|
+
0
|
207
|
+
end
|
205
208
|
end
|
206
209
|
|
207
210
|
def yesterday_triangulated_metrics
|
208
211
|
yesterday_triangulated_info = metrics(config[:triangulate], YESTERDAY_START_PERIOD, yesterday_end_period, true)
|
209
212
|
@yesterday_triangulated_metric_count = validate_metrics_and_count(yesterday_triangulated_info)
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
213
|
+
if @yesterday_triangulated_metric_count > 0
|
214
|
+
series = read_series_from_metrics(yesterday_triangulated_info)
|
215
|
+
@yesterday_triangulated_metrics = store_metrics(series)
|
216
|
+
read_value_from_series(series)
|
217
|
+
else
|
218
|
+
0
|
219
|
+
end
|
216
220
|
end
|
217
221
|
|
218
222
|
def read_series_from_metrics(metrics)
|
@@ -220,8 +224,12 @@ class CheckInfluxDbMetrics < Sensu::Plugin::Check::CLI
|
|
220
224
|
end
|
221
225
|
|
222
226
|
def validate_metrics_and_count(metrics)
|
223
|
-
if metrics.empty? || metrics.nil? || metrics[0].nil? || metrics[0]['series'].nil?
|
224
|
-
0
|
227
|
+
if metrics.empty? || metrics.nil? || metrics[0].nil? || metrics[0]['series'].nil?
|
228
|
+
if metrics[0]['series'].nil?
|
229
|
+
0
|
230
|
+
else
|
231
|
+
metrics[0]['series'][0]['values'][0][1] || 0
|
232
|
+
end
|
225
233
|
else
|
226
234
|
metrics[0]['series'].count
|
227
235
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-influxdb-metrics-checker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juanjo Guerrero Cerezuela
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|