sensu-plugins-sensu 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +2 -4
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +8 -1
- data/README.md +3 -2
- data/bin/check-aggregate.rb +5 -10
- data/bin/handler-sensu-deregister.rb +28 -0
- data/bin/metrics-aggregate.rb +2 -4
- data/lib/sensu-plugins-sensu/version.rb +2 -2
- metadata +6 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a381a81345529aeac455af0750fd82ee60598560
|
4
|
+
data.tar.gz: d9285b72add6aa32615cb5cbc59f36f6729fd6de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebd55f0b6b842882983204d55b1ff3c2ad2e647d463a7d2963ff627e753f5e444d68858c3627832ccc502736ecffc48d5fc99fcfbf2b6b081eaac149066a2305
|
7
|
+
data.tar.gz: 5c385b751d7032c950753eaead76b8e360844d3095d032b54d3fbcb18f99a3ab337f7ac5f23cf61aa570c6fb48078152eaafcd9c492242276200e86fd01c1d46
|
checksums.yaml.gz.sig
CHANGED
@@ -1,4 +1,2 @@
|
|
1
|
-
|
2
|
-
b
|
3
|
-
��J�\��Y��^q-ɉ��xZK���!1��=�V�c6�Z%��A�&���Z�X�2Wg���|
|
4
|
-
���:�v q"�N�,7��
|
1
|
+
|
2
|
+
�f�5��c��/�:��"?�bp�)��h;�&���sP5��@1~������`ty�"���@iXVj#�A�V�{�C�8�uG-�Ơ"��T�m Nщ�ٛ���u䒚b�X���+1P�z6C�,�G�)ɂ�j�{�h���X6@AQ&�:�@-�N�/���2��%!��[��@$�DG�`��sӿ�=�:%����&Cd%��f��� ��x���;ҹc6U ~�(6c�b����!��������l�
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -3,7 +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
|
-
## Unreleased
|
6
|
+
## Unreleased
|
7
|
+
|
8
|
+
[0.1.0] - 2016-01-08
|
9
|
+
### Added
|
10
|
+
- added sensu-deregister handler for deregistering a sensu client upon request (see https://github.com/sensu/sensu-build/pull/148 for example).
|
11
|
+
|
12
|
+
### Changed
|
13
|
+
- rubocop cleanup
|
7
14
|
|
8
15
|
## [0.0.2] - 2015-07-14
|
9
16
|
### Changed
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
## Sensu-Plugins-sensu
|
2
2
|
|
3
|
-
[
|
3
|
+
[![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-sensu.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-sensu)
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/sensu-plugins-sensu.svg)](http://badge.fury.io/rb/sensu-plugins-sensu)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-sensu/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-sensu)
|
6
6
|
[![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-sensu/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-sensu)
|
@@ -13,11 +13,12 @@
|
|
13
13
|
* bin/metrics-aggregate.rb
|
14
14
|
* bin/metrics-delete-expired-stashes.rb
|
15
15
|
* bin/handler-sensu.rb
|
16
|
+
* bin/handler-sensu-deregister.rb
|
16
17
|
|
17
18
|
## Usage
|
18
19
|
|
19
20
|
## Installation
|
20
21
|
|
21
|
-
[Installation and Setup](
|
22
|
+
[Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
|
22
23
|
|
23
24
|
## Notes
|
data/bin/check-aggregate.rb
CHANGED
@@ -110,12 +110,10 @@ class CheckAggregate < Sensu::Plugin::Check::CLI
|
|
110
110
|
def acquire_aggregate
|
111
111
|
uri = "/aggregates/#{config[:check]}"
|
112
112
|
issued = api_request(uri + "?age=#{config[:age]}" + (config[:limit] ? "&limit=#{config[:limit]}" : ''))
|
113
|
-
|
114
|
-
unless issued.empty? # rubocop:disable UnlessElse
|
113
|
+
unless issued.empty?
|
115
114
|
issued_sorted = issued.sort
|
116
115
|
time = issued_sorted.pop
|
117
|
-
|
118
|
-
unless time.nil? # rubocop:disable UnlessElse
|
116
|
+
unless time.nil?
|
119
117
|
uri += "/#{time}"
|
120
118
|
uri += '?summarize=output' if config[:summarize]
|
121
119
|
api_request(uri)
|
@@ -139,20 +137,17 @@ class CheckAggregate < Sensu::Plugin::Check::CLI
|
|
139
137
|
end
|
140
138
|
|
141
139
|
def compare_pattern(aggregate)
|
142
|
-
|
143
|
-
if config[:summarize] && config[:pattern] # rubocop:disable GuardClause
|
140
|
+
if config[:summarize] && config[:pattern]
|
144
141
|
regex = Regexp.new(config[:pattern])
|
145
142
|
mappings = {}
|
146
143
|
message = config[:message] || 'One of these is not like the others!'
|
147
|
-
|
148
|
-
aggregate[:outputs].each do |output, _count| # rubocop:disable Style/Next
|
144
|
+
aggregate[:outputs].each do |output, _count|
|
149
145
|
matched = regex.match(output.to_s)
|
150
146
|
unless matched.nil?
|
151
147
|
key = matched[1]
|
152
148
|
value = matched[2..-1]
|
153
149
|
if mappings.key?(key)
|
154
|
-
#
|
155
|
-
unless mappings[key] == value # rubocop:disable IfUnlessModifier, BlockNesting
|
150
|
+
unless mappings[key] == value # rubocop:disable Metrics/BlockNesting
|
156
151
|
critical message + " (#{key})"
|
157
152
|
end
|
158
153
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'sensu-handler'
|
5
|
+
|
6
|
+
class Deregister < Sensu::Handler
|
7
|
+
def handle
|
8
|
+
delete_sensu_client!
|
9
|
+
end
|
10
|
+
|
11
|
+
def delete_sensu_client!
|
12
|
+
response = api_request(:DELETE, '/clients/' + @event['client']['name']).code
|
13
|
+
deletion_status(response)
|
14
|
+
end
|
15
|
+
|
16
|
+
def deletion_status(code)
|
17
|
+
case code
|
18
|
+
when '202'
|
19
|
+
puts "202: Successfully deleted Sensu client: #{@event['client']['name']}"
|
20
|
+
when '404'
|
21
|
+
puts "404: Unable to delete #{@event['client']['name']}, doesn't exist!"
|
22
|
+
when '500'
|
23
|
+
puts "500: Miscellaneous error when deleting #{@event['client']['name']}"
|
24
|
+
else
|
25
|
+
puts "#{res}: Completely unsure of what happened!"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/bin/metrics-aggregate.rb
CHANGED
@@ -96,12 +96,10 @@ class AggregateMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
96
96
|
def get_aggregate(check)
|
97
97
|
uri = "/aggregates/#{check}"
|
98
98
|
issued = api_request(uri + "?age=#{config[:age]}")
|
99
|
-
|
100
|
-
unless issued.empty? # rubocop:disable UnlessElse
|
99
|
+
unless issued.empty?
|
101
100
|
issued_sorted = issued.sort
|
102
101
|
time = issued_sorted.pop
|
103
|
-
|
104
|
-
unless time.nil? # rubocop:disable UnlessElse
|
102
|
+
unless time.nil?
|
105
103
|
uri += "/#{time}"
|
106
104
|
[time, api_request(uri)]
|
107
105
|
else
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-sensu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sensu-Plugins and contributors
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
|
31
31
|
HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
33
|
+
date: 2016-01-08 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: sensu-plugin
|
@@ -200,12 +200,13 @@ dependencies:
|
|
200
200
|
- - "~>"
|
201
201
|
- !ruby/object:Gem::Version
|
202
202
|
version: '0.8'
|
203
|
-
description:
|
203
|
+
description: This plugin provides monitoring and metrics for Sensu.
|
204
204
|
email: "<sensu-users@googlegroups.com>"
|
205
205
|
executables:
|
206
206
|
- metrics-delete-expired-stashes.rb
|
207
207
|
- metrics-aggregate.rb
|
208
208
|
- handler-sensu.rb
|
209
|
+
- handler-sensu-deregister.rb
|
209
210
|
- check-aggregate.rb
|
210
211
|
extensions: []
|
211
212
|
extra_rdoc_files: []
|
@@ -214,6 +215,7 @@ files:
|
|
214
215
|
- LICENSE
|
215
216
|
- README.md
|
216
217
|
- bin/check-aggregate.rb
|
218
|
+
- bin/handler-sensu-deregister.rb
|
217
219
|
- bin/handler-sensu.rb
|
218
220
|
- bin/metrics-aggregate.rb
|
219
221
|
- bin/metrics-delete-expired-stashes.rb
|
@@ -245,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
245
247
|
version: '0'
|
246
248
|
requirements: []
|
247
249
|
rubyforge_project:
|
248
|
-
rubygems_version: 2.4.
|
250
|
+
rubygems_version: 2.4.8
|
249
251
|
signing_key:
|
250
252
|
specification_version: 4
|
251
253
|
summary: Sensu plugins for sensu
|
metadata.gz.sig
CHANGED
Binary file
|