sensu-plugins-green-dragon 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -31
- data/bin/check-non-success-ratio.rb +7 -9
- data/lib/green-dragon-plugins/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: 7c0b2a4d16fab60b5edb1a6cc76d7030d2a5ee39
|
4
|
+
data.tar.gz: 6a5771deee2da610746d02de712d4d2d9905c683
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 293479178a5306eaaefa83b17d4ef919d5848693a156c0df87a3f40d953f5713cfdac6d09c9507e7022914d3a08ae9e9d2f2c70926d08ea646b1bd4dfd70d638
|
7
|
+
data.tar.gz: b5a36574dea24b3552f2bc6a5ddbb9b6c30eb67ed676ea29d162f91f1bec711661696fb6091dab75a74817cc1875e17d9e5780591966fab2aa0c4c097beeba80
|
data/README.md
CHANGED
@@ -1,35 +1,23 @@
|
|
1
|
-
|
1
|
+
A single gem for custom Sensu checks developed by Team Green Dragon. At the time of writing there's only one such check:
|
2
|
+
* [check-non-success-ratio.rb](bin/check-non-success-ratio.rb) - checks whether the ratio between successful (200)
|
3
|
+
and unsuccessful (non-200) requests to the API matches specified criteria (see code comments for example usage).
|
2
4
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem 'green-dragon-plugins'
|
5
|
+
## Setup
|
6
|
+
To install necessary dependencies on your local computer:
|
7
|
+
```
|
8
|
+
bundle install
|
13
9
|
```
|
14
10
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
$ gem install green-dragon-plugins
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
-
|
33
|
-
## Contributing
|
11
|
+
## Build
|
12
|
+
To build the gem:
|
13
|
+
```
|
14
|
+
gem build sensu-plugins-green-dragon.gemspec
|
15
|
+
```
|
34
16
|
|
35
|
-
|
17
|
+
## Publish
|
18
|
+
To publish the gem to RubyGems:
|
19
|
+
1. Ask Grzegorz to give you necessary rights.
|
20
|
+
2. Execute:
|
21
|
+
```
|
22
|
+
gem push sensu-plugins-green-dragon-VERSION.gem
|
23
|
+
```
|
@@ -123,20 +123,18 @@ class CheckNonSuccessRatio < Sensu::Plugin::Check::CLI
|
|
123
123
|
username: config[:username],
|
124
124
|
password: config[:password]
|
125
125
|
|
126
|
-
success_responses_result = influxdb.query "select sum(value) from counter_httpResponseCode where httpStatus = '200' and application = '#{config[:app]}' and time > now() -
|
127
|
-
non_success_responses_result = influxdb.query "select sum(value) from counter_httpResponseCode where httpStatus != '200' and application = '#{config[:app]}' and time > now() -
|
126
|
+
success_responses_result = influxdb.query "select sum(value) from counter_httpResponseCode where httpStatus = '200' and application = '#{config[:app]}' and time > now() - 15m"
|
127
|
+
non_success_responses_result = influxdb.query "select sum(value) from counter_httpResponseCode where httpStatus != '200' and application = '#{config[:app]}' and time > now() - 15m"
|
128
128
|
|
129
|
-
|
130
|
-
critical 'No result for success query'
|
131
|
-
elsif non_success_responses_result.empty?
|
132
|
-
critical 'No result for non-success query'
|
133
|
-
end
|
134
|
-
|
135
|
-
result_json_path = JsonPath.new('$..values[0].sum')
|
129
|
+
result_json_path = JsonPath.new '$..values[0].sum'
|
136
130
|
|
137
131
|
success_responses_value = get_single_value(result_json_path, success_responses_result)
|
138
132
|
non_success_responses_value = get_single_value(result_json_path, non_success_responses_result)
|
139
133
|
|
134
|
+
if success_responses_value + non_success_responses_value == 0
|
135
|
+
ok 'No requests in the past 15 minutes'
|
136
|
+
end
|
137
|
+
|
140
138
|
ratio = non_success_responses_value.to_f / (success_responses_value + non_success_responses_value)
|
141
139
|
|
142
140
|
calc = Dentaku::Calculator.new
|
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.
|
4
|
+
version: 0.1.6
|
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-
|
11
|
+
date: 2017-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|