sensu-plugins-influxdb-metrics-checker 0.4.0 → 0.4.4
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 +15 -6
- data/bin/check-influxdb-metrics.rb +30 -6
- 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: 89eb5ded52962e841d56e247226c498c626eb122
|
4
|
+
data.tar.gz: 5dab8ae7bbfd8408658e385a6e1303cd8cac73ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33db0900a25d7533b421c4d913872a3c69095fbb5f6cd6d2b26328a3f492ebc1d638dad8e4008bbe567b675f292ef5127c9dac2f05b9e67c5487af64dcbda593
|
7
|
+
data.tar.gz: 907c4d77e84f18221292f798c7fce8f6bf1dec428f9aac5740c5e1713eef024675c42ffece9a569e0ff2a9bafb8daff8a1fe092e9c1b99c21a8bea8a8e40bb24
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,11 @@ 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.2] - 2017-01-20
|
7
|
+
- eight release
|
8
|
+
Small fix when printing numbers
|
9
|
+
|
10
|
+
|
6
11
|
# [0.4.0] - 2017-01-20
|
7
12
|
- seventh release
|
8
13
|
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.
|
@@ -46,4 +51,6 @@ Leaving 5 minutes to the data to consolidate.
|
|
46
51
|
[0.2.1]: https://github.com/pliyosenpai/sensu-plugins-influxdb-metrics-checker/0.2.1...0.3.0
|
47
52
|
[0.3.0]: https://github.com/pliyosenpai/sensu-plugins-influxdb-metrics-checker/0.3.0...0.3.2
|
48
53
|
[0.3.2]: https://github.com/pliyosenpai/sensu-plugins-influxdb-metrics-checker/0.3.2...0.3.4
|
49
|
-
[0.3.
|
54
|
+
[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.2
|
56
|
+
[0.4.2]: https://github.com/pliyosenpai/sensu-plugins-influxdb-metrics-checker/0.4.2...HEAD
|
data/README.md
CHANGED
@@ -66,17 +66,26 @@ ruby check-influxdb-metrics.rb --host=metrics-influxdb.internal.com --port=8086
|
|
66
66
|
|
67
67
|
**Triangulation**
|
68
68
|
|
69
|
-
In trigonometry and geometry, triangulation is the process of determining the location of a point by forming triangles to it from known points. This feature of the script is inspired in that idea.
|
70
|
-
|
69
|
+
In trigonometry and geometry, [triangulation](https://en.wikipedia.org/wiki/Triangulation) is the process of determining the location of a point by forming triangles to it from known points. This feature of the script is inspired in that idea.
|
71
70
|
|
72
71
|
[![triangulation_01.png](https://s24.postimg.org/kjihvilvp/triangulation_01.png (2KB))](https://postimg.org/image/hcnybw1fl/)
|
73
72
|
|
74
|
-
Once we have a given metric A (ex: messages.sent), we'll normally compare that to yesterday's weather A', we'll get the percentage of difference and according to our threshold we'll fire an alert. Cool. Now let's go one step further.
|
75
|
-
We may have a metric B (ex: sessions.generated), that has a business dependency on
|
73
|
+
Once we have a given metric A (ex: messages.sent), we'll normally compare that to yesterday's weather A', we'll get the percentage of difference (X in the picture) and according to our threshold we'll fire an alert. Cool. Now let's go one step further.
|
74
|
+
We may have a metric B (ex: sessions.generated), that has a business dependency on A. And if we dig further in our metrics, we may discover that, let's say, for every 5 metrics in A we have 1 in B. (In this example, let's say that you'll need 5 messages sent to build 1 session).
|
75
|
+
|
76
|
+
If we could say that every 5 As relates to 1 B, then the % of difference for A (X in the picture) and the percentage of difference for B (Y in the picture) will always be the same
|
77
|
+
```
|
78
|
+
Ex: A' = 15500, A = 20500, X = 32.26%. B' = 3100, B = 4100, Y = 32.26%. So ideally C (distance) = 1.92
|
79
|
+
```
|
80
|
+
Realistically, it's not always like that in production applications, sometimes you may need 7 messages, others only 4, so your average would be something around 5.333. Therefore, we can't say that the % in difference will always be the same, but once we look at the *distance* between these percentages (C in the picture), we'll see that they are pretty close. And that's the spirit of it, the ability to diagnose when the distance is higher than expected.
|
76
81
|
|
77
|
-
|
82
|
+
A more real example will be:
|
83
|
+
|
84
|
+
```
|
85
|
+
A' = 15500, A = 20500, X = 32.26%. B' = 3081, B = 4134, Y = 34.18%. Therefore C (distance) = 1.92
|
86
|
+
```
|
78
87
|
|
79
|
-
Let's say that the system that sends items has an increase of 150%, and you are using this tool to verify that, therefore you don't get any exceptions because there is no drop in the metrics, but the system that process sessions keeps in the same 2% increase, which is a big distance up to
|
88
|
+
Let's say that the system that sends items has an increase of 150%, and you are using this tool to verify that, therefore you don't get any exceptions because there is no drop in the metrics, but the system that process sessions keeps in the same 2% increase, which is a big distance of 148 up to 150. We clearly have a problem here. Maybe some bottleneck is happening somewhere, maybe some messages are lost due to this huge increase, and hopefully this feature will allow you to identify that something fussy is going on.
|
80
89
|
|
81
90
|
**How it works**
|
82
91
|
|
@@ -266,7 +266,7 @@ class CheckInfluxDbMetrics < Sensu::Plugin::Check::CLI
|
|
266
266
|
ok 'no metrics found'
|
267
267
|
elsif @today_metric_count > @yesterday_metric_count
|
268
268
|
display_metrics
|
269
|
-
critical 'For ' + config[:metric] + ' more metrics tracked today (' + @today_metric_count + ') than yesterday (' + @yesterday_metric_count + ')
|
269
|
+
critical 'For ' + config[:metric] + ' more metrics tracked today (' + @today_metric_count.to_s + ') than yesterday (' + @yesterday_metric_count.to_s + ')'
|
270
270
|
elsif @today_metric_count == @yesterday_metric_count
|
271
271
|
compare_each_metric_in_regex
|
272
272
|
else
|
@@ -279,13 +279,25 @@ class CheckInfluxDbMetrics < Sensu::Plugin::Check::CLI
|
|
279
279
|
evaluate_percentage_and_notify(difference)
|
280
280
|
end
|
281
281
|
|
282
|
+
def difference_for_regex_queries(today, yesterday)
|
283
|
+
difference = difference_between_two_metrics(today, yesterday)
|
284
|
+
evaluate_percentage_for_regex(difference)
|
285
|
+
end
|
286
|
+
|
282
287
|
def compare_each_metric_in_regex
|
283
288
|
@today_metrics.each do |today_key, today_value|
|
284
289
|
@yesterday_metrics.each do |yesterday_key, yesterday_value|
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
290
|
+
iterate_through_each_value_in_regex(today_key, today_value, yesterday_key, yesterday_value)
|
291
|
+
end
|
292
|
+
end
|
293
|
+
ok 'all regex metrics seems fine'
|
294
|
+
end
|
295
|
+
|
296
|
+
def iterate_through_each_value_in_regex(today_key, today_value, yesterday_key, yesterday_value)
|
297
|
+
if today_key.eql? yesterday_key
|
298
|
+
puts yesterday_value.to_s + ' vs ' + today_value.to_s + ' for ' + today_key
|
299
|
+
if today_value > yesterday_value
|
300
|
+
difference_for_regex_queries(today_value, yesterday_value)
|
289
301
|
end
|
290
302
|
end
|
291
303
|
end
|
@@ -307,6 +319,17 @@ class CheckInfluxDbMetrics < Sensu::Plugin::Check::CLI
|
|
307
319
|
)
|
308
320
|
end
|
309
321
|
|
322
|
+
def evaluate_percentage_for_regex(difference)
|
323
|
+
puts 'Difference of: ' + difference.round(3).to_s + ' % for a period of ' + config[:period].to_s + 'm'
|
324
|
+
if difference > config[:crit]
|
325
|
+
critical "\"#{config[:metric]}\" difference is above allowed minimum of #{config[:crit]} %"
|
326
|
+
elsif difference > config[:warn]
|
327
|
+
warning "\"#{config[:metric]}\" difference is above warn threshold of #{config[:warn]}"
|
328
|
+
else
|
329
|
+
puts 'this metric seems ok'
|
330
|
+
end
|
331
|
+
end
|
332
|
+
|
310
333
|
def evaluate_percentage_and_notify(difference)
|
311
334
|
puts 'Difference of: ' + difference.round(3).to_s + ' % for a period of ' + config[:period].to_s + 'm'
|
312
335
|
if difference < config[:crit]
|
@@ -320,7 +343,8 @@ class CheckInfluxDbMetrics < Sensu::Plugin::Check::CLI
|
|
320
343
|
|
321
344
|
def evaluate_distance_and_notify(distance)
|
322
345
|
if distance > config[:distance].to_f
|
323
|
-
|
346
|
+
puts 'distance of ' + distance.to_s
|
347
|
+
critical config[:metric] + ' vs ' + config[:triangulate] + ' distance is greater than allowed minimum of ' + config[:distance].to_s
|
324
348
|
else
|
325
349
|
ok 'distance ok'
|
326
350
|
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.4
|
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-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|