sensu-plugins-green-dragon 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c0b2a4d16fab60b5edb1a6cc76d7030d2a5ee39
4
- data.tar.gz: 6a5771deee2da610746d02de712d4d2d9905c683
3
+ metadata.gz: cf5f0a35ebef0cbee266779884aeea2e6930d149
4
+ data.tar.gz: a5c3257ffc859fe4cf766a63c30bcc9feb3b019f
5
5
  SHA512:
6
- metadata.gz: 293479178a5306eaaefa83b17d4ef919d5848693a156c0df87a3f40d953f5713cfdac6d09c9507e7022914d3a08ae9e9d2f2c70926d08ea646b1bd4dfd70d638
7
- data.tar.gz: b5a36574dea24b3552f2bc6a5ddbb9b6c30eb67ed676ea29d162f91f1bec711661696fb6091dab75a74817cc1875e17d9e5780591966fab2aa0c4c097beeba80
6
+ metadata.gz: bfa29e483da549ca2ba050ebf13f2b739920c7e98879f3bf49957377e2adc3e47b01f085be25f8d2e9f138326c686e4f5dd2974850c48e087d633c0980e6d877
7
+ data.tar.gz: '086b4cfcb0891c3f628d77d23c52f0de3c8622fdbeeb22e35f9b4d8ecc3e66b74079ee358ec508626e046e0658e3d36e14176c3d24d2a82c547d2d4462100909'
data/README.md CHANGED
@@ -8,6 +8,12 @@ To install necessary dependencies on your local computer:
8
8
  bundle install
9
9
  ```
10
10
 
11
+ ## Test
12
+ There's no "sensu plugins test framework", so the easiest way of testing a check is running it with different params e.g.
13
+ ```
14
+ ./check-non-success-ratio.rb -H influx_url -d influx_database -u influx_user -p influx_password -a your_app_name -w 'value >= 0.1' -c 'value >= 0.2'
15
+ ```
16
+
11
17
  ## Build
12
18
  To build the gem:
13
19
  ```
@@ -18,7 +18,7 @@
18
18
  # gem: dentaku
19
19
  #
20
20
  # USAGE:
21
- # check-non-success-ratio.rb -H localhost -d my_database -u my_user -p my_password -a my-application-name -w 'value >= 0.5' -c 'value >= 0.75'
21
+ # check-non-success-ratio.rb -H localhost -d my_database -u my_user -p my_password -a my-application-name -m 20 -w 'value >= 0.2' -c 'value >= 0.4'
22
22
  #
23
23
 
24
24
  require 'influxdb'
@@ -91,6 +91,12 @@ class CheckNonSuccessRatio < Sensu::Plugin::Check::CLI
91
91
  default: nil,
92
92
  description: 'Application for which the check is executed'
93
93
 
94
+ option :min,
95
+ short: '-m MIN_REQUESTS',
96
+ long: '--min_requests MIN_REQUESTS',
97
+ default: 1,
98
+ description: 'Minimum amount of requests for check to be performed'
99
+
94
100
  option :warning,
95
101
  short: '-w WARNING',
96
102
  long: '--warning WARNING',
@@ -131,8 +137,8 @@ class CheckNonSuccessRatio < Sensu::Plugin::Check::CLI
131
137
  success_responses_value = get_single_value(result_json_path, success_responses_result)
132
138
  non_success_responses_value = get_single_value(result_json_path, non_success_responses_result)
133
139
 
134
- if success_responses_value + non_success_responses_value == 0
135
- ok 'No requests in the past 15 minutes'
140
+ if success_responses_value + non_success_responses_value < config[:min].to_i
141
+ ok 'Not enough requests in the past 15 minutes'
136
142
  end
137
143
 
138
144
  ratio = non_success_responses_value.to_f / (success_responses_value + non_success_responses_value)
@@ -1,3 +1,3 @@
1
1
  module GreenDragonPlugins
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-green-dragon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grzegorz Ziemonski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-18 00:00:00.000000000 Z
11
+ date: 2017-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin