sensu-plugins-sensu 0.0.2 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea8fb02ddec6dba9ff715d0089a0c9e07b9ff88c
4
- data.tar.gz: 6317a60751baec6308a6e48e49e0979e6ad46c8f
3
+ metadata.gz: a381a81345529aeac455af0750fd82ee60598560
4
+ data.tar.gz: d9285b72add6aa32615cb5cbc59f36f6729fd6de
5
5
  SHA512:
6
- metadata.gz: a1a0cb463f9af261dbc41c9d6b104a0ca9b07ffe844567ec3a4ccfdb5f4fdc5967d67e9e1ad3d5395ec8aefb7bddbb8461ca2277f4bc309f8181f8f024ed5c3f
7
- data.tar.gz: d97b8dd70f36f4be65a99c092a76c7159f57f2236a96a3ccf37657de1989591a288049203ec8e34dec31383de2bac0346b92a3c3b52d2ef67cfcb40d256c7a99
6
+ metadata.gz: ebd55f0b6b842882983204d55b1ff3c2ad2e647d463a7d2963ff627e753f5e444d68858c3627832ccc502736ecffc48d5fc99fcfbf2b6b081eaac149066a2305
7
+ data.tar.gz: 5c385b751d7032c950753eaead76b8e360844d3095d032b54d3fbcb18f99a3ab337f7ac5f23cf61aa570c6fb48078152eaafcd9c492242276200e86fd01c1d46
checksums.yaml.gz.sig CHANGED
@@ -1,4 +1,2 @@
1
- )��=gH��A�[�b��.7�����͑���?�� MT�]
2
- b��$-}���W��:�{�����v���h�D���U�ޏ(�
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 ~�(6cb����!�� ������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][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
- [ ![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-sensu.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-sensu)
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](https://github.com/sensu-plugins/documentation/blob/master/user_docs/installation_instructions.md)
22
+ [Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
22
23
 
23
24
  ## Notes
@@ -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
- # #YELLOW
114
- unless issued.empty? # rubocop:disable UnlessElse
113
+ unless issued.empty?
115
114
  issued_sorted = issued.sort
116
115
  time = issued_sorted.pop
117
- # #YELLOW
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
- # #YELLOW
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
- # #YELLOW
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
- # #YELLOW
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
@@ -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
- # #YELLOW
100
- unless issued.empty? # rubocop:disable UnlessElse
99
+ unless issued.empty?
101
100
  issued_sorted = issued.sort
102
101
  time = issued_sorted.pop
103
- # #YELLOW
104
- unless time.nil? # rubocop:disable UnlessElse
102
+ unless time.nil?
105
103
  uri += "/#{time}"
106
104
  [time, api_request(uri)]
107
105
  else
@@ -2,8 +2,8 @@ module SensuPluginsSensu
2
2
  # This defines the version of the gem
3
3
  module Version
4
4
  MAJOR = 0
5
- MINOR = 0
6
- PATCH = 2
5
+ MINOR = 1
6
+ PATCH = 0
7
7
 
8
8
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
9
9
  end
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.2
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: 2015-07-14 00:00:00.000000000 Z
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: Sensu sensu plugins
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.6
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