sensu-plugins-unicorn 0.0.3 → 0.0.4

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: e2e0b198bcfd07bdce6242c958fe5d84b74ac972
4
- data.tar.gz: dad9304251a0f958efca9bdaa079f6d731e342f0
3
+ metadata.gz: f7b1b2d5de2ca2cc0541aba66c8e599242213176
4
+ data.tar.gz: 4b161a8aff748de65198f1f911a2f6362a1e2d78
5
5
  SHA512:
6
- metadata.gz: dd36a13efa00e951ed3a7fd6bab0367dd75695e478cbddf02d06c8421b47c2fdbffdbf1b1f38baae8d28bd8cd70f76c465dda31a0fd54e27e397fcf54ce89c16
7
- data.tar.gz: b3556a81a6f06701bf3af70c7680859e3d1b33a080a3a50fdc1d7046ee34b4b9d78f570d98aaed5a590d5812857b708e47a074c522db8ee697cc56da5d464255
6
+ metadata.gz: 99fcc8410e22e26746df22212d090cbb48b3298f3a0756a49e82d9604be35e9fd54f4527a63300e19970c9e946726491af1a88556ae63750ed9b758ef2a99861
7
+ data.tar.gz: ab518aa0bb3aaddafb1e6b9ccaf94a7d91bb07327e6f6f1fed65db78142069995c60b149d0c67f687798513b43d1371fb230543dc801344d5255f5f4b2e22c52
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -3,14 +3,22 @@ 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
+ - nothing
8
+
9
+ ## [0.0.3] - 2015-07-14
10
+ ### Changed
11
+ - general gem cleanup
12
+
13
+ ### Added
14
+ - check-unicorn-sueue check
15
+ - metrics-unicorn check
7
16
 
8
17
  ## [0.0.3] - 2015-07-14
9
18
  ### Changed
10
19
  - updated sensu-plugin gem to 1.2.0
11
20
 
12
21
  ## [0.0.2] - 2015-06-03
13
-
14
22
  ### Fixed
15
23
  - added binstubs
16
24
 
@@ -18,7 +26,10 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
18
26
  - removed cruft from /lib
19
27
 
20
28
  ## 0.0.1 - 2015-05-30
21
-
22
29
  ### Added
23
30
  - initial release
24
31
 
32
+ [unreleased]: https://github.com/sensu-plugins/sensu-plugins-unicorn/compare/0.0.4...HEAD
33
+ [0.0.4]: https://github.com/sensu-plugins/sensu-plugins-unicorn/compare/0.0.3...0.0.4
34
+ [0.0.3]: https://github.com/sensu-plugins/sensu-plugins-unicorn/compare/0.0.2...0.0.3
35
+ [0.0.2]: https://github.com/sensu-plugins/sensu-plugins-unicorn/compare/0.0.1...0.0.2
data/README.md CHANGED
@@ -10,12 +10,13 @@
10
10
  ## Functionality
11
11
 
12
12
  ## Files
13
- * bin/check-num-recordings.rb
13
+ * bin/check-unicorn-queue.rb
14
+ * bin/metrics-unicorn.rb
14
15
 
15
16
  ## Usage
16
17
 
17
18
  ## Installation
18
19
 
19
- [Installation and Setup](https://github.com/sensu-plugins/documentation/blob/master/user_docs/installation_instructions.md)
20
+ [Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
20
21
 
21
22
  ## Notes
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # check-unicorn-queue
4
+ #
5
+ # DESCRIPTION:
6
+ # This plugin checks the queue of Unicorn (a Rack HTTP server)
7
+ #
8
+ # OUTPUT:
9
+ # plain-text
10
+ #
11
+ # PLATFORMS:
12
+ # linux
13
+ # bsd
14
+ #
15
+ # DEPENDENCIES:
16
+ # gem: sensu-plugin
17
+ # gem: raindrops
18
+ #
19
+ # USAGE:
20
+ # check-unicorn-queue.rb -w 20 -c 50 -a 127.0.0.1:8080
21
+ #
22
+ # LICENSE:
23
+ # Nathan Williams <nath.e.will@gmail.com>
24
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
25
+ # for details.
26
+
27
+ require 'sensu-plugin/check/cli'
28
+ require 'raindrops'
29
+
30
+ class CheckUnicornQueue < Sensu::Plugin::Check::CLI
31
+ option :addr,
32
+ short: '-a address',
33
+ description: 'tcp address and port (e.g. 127.0.0.1:8080)'
34
+
35
+ option :socket,
36
+ short: '-s socket',
37
+ description: 'path to unix socket (e.g. /run/unicorn.sock)'
38
+
39
+ option :warn,
40
+ short: '-w warn',
41
+ proc: proc(&:to_i),
42
+ description: 'request queue warn threshold'
43
+
44
+ option :critical,
45
+ short: '-c critical',
46
+ proc: proc(&:to_i),
47
+ description: 'request queue critical threshold'
48
+
49
+ def run
50
+ @queued = queued
51
+ unknown "QUEUE STATUS - #{@queued.inspect}" unless @queued
52
+ critical "#{@queued} QUEUED" if @queued >= config[:critical]
53
+ warn "#{@queued} QUEUED" if @queued >= config[:warn]
54
+ ok "#{@queued} QUEUED"
55
+ end
56
+
57
+ def queued
58
+ if config[:addr]
59
+ Raindrops::Linux
60
+ .tcp_listener_stats(config[:addr].split(','))[0].queued
61
+ elsif config[:socket]
62
+ Raindrops::Linux
63
+ .unix_listener_stats(config[:socket].split(','))[0].queued
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,50 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # unicorn-metrics
4
+ #
5
+ # DESCRIPTION:
6
+ #
7
+ # OUTPUT:
8
+ # metric data
9
+ #
10
+ # PLATFORMS:
11
+ # Linux
12
+ #
13
+ # DEPENDENCIES:
14
+ # gem: sensu-plugin
15
+ # gem: raindrops
16
+ #
17
+ # USAGE:
18
+ #
19
+ # NOTES:
20
+ #
21
+ # LICENSE:
22
+ # Copyright 2014 Sonian, Inc. and contributors. <support@sensuapp.org>
23
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
24
+ # for details.
25
+ #
26
+
27
+ require 'sensu-plugin/metric/cli'
28
+ require 'raindrops'
29
+
30
+ class UnicornMetrics < Sensu::Plugin::Metric::CLI::Graphite
31
+ option :scheme,
32
+ description: 'Metric naming scheme, text to prepend to metric',
33
+ short: '-s SCHEME',
34
+ long: '--scheme SCHEME',
35
+ default: "#{Socket.gethostname}.unicorn"
36
+
37
+ option :socket,
38
+ description: 'Unicorn socket path',
39
+ short: '-p SOCKET',
40
+ long: '--socket-path SOCKET',
41
+ default: '/tmp/unicorn.sock'
42
+
43
+ def run
44
+ stats = Raindrops::Linux.unix_listener_stats([config[:socket]])[config[:socket]]
45
+
46
+ output "#{config[:scheme]}.active", stats.active
47
+ output "#{config[:scheme]}.queued", stats.queued
48
+ ok
49
+ end
50
+ end
@@ -2,7 +2,7 @@ module SensuPluginsUnicorn
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- PATCH = 3
5
+ PATCH = 4
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-unicorn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
@@ -30,22 +30,22 @@ 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: 2015-08-07 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
- name: nori
36
+ name: raindrops
37
37
  requirement: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - '='
40
40
  - !ruby/object:Gem::Version
41
- version: 2.6.0
41
+ version: 0.15.0
42
42
  type: :runtime
43
43
  prerelease: false
44
44
  version_requirements: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - '='
47
47
  - !ruby/object:Gem::Version
48
- version: 2.6.0
48
+ version: 0.15.0
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: sensu-plugin
51
51
  requirement: !ruby/object:Gem::Requirement
@@ -150,14 +150,14 @@ dependencies:
150
150
  requirements:
151
151
  - - '='
152
152
  - !ruby/object:Gem::Version
153
- version: '0.30'
153
+ version: 0.32.1
154
154
  type: :development
155
155
  prerelease: false
156
156
  version_requirements: !ruby/object:Gem::Requirement
157
157
  requirements:
158
158
  - - '='
159
159
  - !ruby/object:Gem::Version
160
- version: '0.30'
160
+ version: 0.32.1
161
161
  - !ruby/object:Gem::Dependency
162
162
  name: rspec
163
163
  requirement: !ruby/object:Gem::Requirement
@@ -189,14 +189,16 @@ dependencies:
189
189
  description: Sensu plugins for Unicorn server
190
190
  email: "<sensu-users@googlegroups.com>"
191
191
  executables:
192
- - check-num-recordings.rb
192
+ - metrics-unicorn.rb
193
+ - check-unicorn-queue.rb
193
194
  extensions: []
194
195
  extra_rdoc_files: []
195
196
  files:
196
197
  - CHANGELOG.md
197
198
  - LICENSE
198
199
  - README.md
199
- - bin/check-num-recordings.rb
200
+ - bin/check-unicorn-queue.rb
201
+ - bin/metrics-unicorn.rb
200
202
  - lib/sensu-plugins-unicorn.rb
201
203
  - lib/sensu-plugins-unicorn/version.rb
202
204
  homepage: https://github.com/sensu-plugins/sensu-plugins-unicorn
@@ -225,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
225
227
  version: '0'
226
228
  requirements: []
227
229
  rubyforge_project:
228
- rubygems_version: 2.4.6
230
+ rubygems_version: 2.4.8
229
231
  signing_key:
230
232
  specification_version: 4
231
233
  summary: Sensu plugins for Unicorn server
metadata.gz.sig CHANGED
@@ -1 +1,3 @@
1
- �b���;��+̰�L�P��X���O� �#4�)+ ��=�A�G�2��%�-,� _�Te�I�12����4yv����>�ǃ���ޕL�Q�VPbH1��l!@ im������{� ?�t.G]TY�p�;��ߑ���e��p.p�4B�;�d���I#��J� io� ��`*KnW/ K�
1
+ &���
2
+ ګ������n�LH^�f(y��s����Io=I�/��W5f�a�?~vVE�`���+8����P�O�߆�����i���LR�}��8t�����V�"~��rHiI��V���o�A�:���o�Ob�!O����v$`�Lv���:�w;�����P�&���5Ð�E�ъ��fC�>"�?���m���i�-O����`�h1�#7�ojz8���NR
3
+ �������7h�s��g ��Ad�o}7�h4�-�
@@ -1,107 +0,0 @@
1
- #! /usr/bin/env ruby
2
- #
3
- # check-num-recordings
4
- #
5
- # DESCRIPTION:
6
- # Checks the number of recordings in Twilio
7
- #
8
- # OUTPUT:
9
- # plain text, metric data, etc
10
- #
11
- # PLATFORMS:
12
- # Linux
13
- #
14
- # DEPENDENCIES:
15
- # gem: sensu-plugin
16
- # gem: uri
17
- # gem: nori
18
- #
19
- # USAGE:
20
- # #YELLOW
21
- #
22
- # NOTES:
23
- #
24
- # LICENSE:
25
- # Copyright (c) 2013, Justin Lambert <jlambert@letsevenup.com>
26
- # Released under the same terms as Sensu (the MIT license); see LICENSE
27
- # for details.
28
- #
29
-
30
- require 'sensu-plugin/check/cli'
31
- require 'net/http'
32
- require 'net/https'
33
- require 'uri'
34
- require 'nori'
35
-
36
- class TwilioRecordings < Sensu::Plugin::Check::CLI
37
- option :account_sid,
38
- short: '-s ACCOUNT_SID',
39
- long: '--account-sid ACCOUNT_SID',
40
- description: 'SID for the account being checked',
41
- required: true
42
-
43
- option :account_token,
44
- short: '-t ACCOUNT_TOKEN',
45
- long: '--account-token ACCOUNT_TOKEN',
46
- description: 'Secret token for the account being checked',
47
- required: true
48
-
49
- option :warning,
50
- short: '-w WARN_NUM',
51
- long: '--warnnum WARN_NUM',
52
- description: 'Number of recordings considered to be a warning',
53
- required: true
54
-
55
- option :critical,
56
- short: '-c CRIT_NUM',
57
- long: '--critnum CRIT_NUM',
58
- description: 'Number of recordings considered to be critical',
59
- required: true
60
-
61
- option :name,
62
- short: '-n NAME',
63
- long: '--name NAME',
64
- description: 'Human readable description for the account'
65
-
66
- option :root_ca,
67
- long: '--root-ca ROOT_CA_FILE',
68
- description: 'Root CA file that should be used for SSL verification',
69
- default: '/etc/pki/tls/certs/ca-bundle.crt'
70
-
71
- def run
72
- name = config[:name] || config[:account_sid]
73
-
74
- # Set up HTTP request
75
- uri = URI.parse("https://api.twilio.com/2010-04-01/Accounts/#{config[:account_sid]}/Recordings")
76
- http = Net::HTTP.new(uri.host, uri.port)
77
- http.use_ssl = true
78
-
79
- # Verify SSL cert if possible
80
- if File.exist?(config[:root_ca]) && http.use_ssl?
81
- http.ca_file = config[:root_ca]
82
- http.verify_mode = OpenSSL::SSL::VERIFY_PEER
83
- http.verify_depth = 5
84
- else
85
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
86
- end
87
-
88
- request = Net::HTTP::Get.new(uri.request_uri)
89
- request.basic_auth(config[:account_sid], config[:account_token])
90
- response = http.request(request)
91
-
92
- # Handle unknown response
93
- unknown "Received #{response.code} response code from Twilio checking account #{name}" if response.code != '200'
94
-
95
- # Parse Twilio XML
96
- messages = Nori.new(advanced_typecasting: false, advanced_typecasting: false).parse(response.body)
97
- total = messages['TwilioResponse']['Recordings']['@total'].to_i
98
-
99
- if total >= config[:critical].to_i
100
- critical "#{total} recordings pending in Twilio account #{name}"
101
- elsif total >= config[:warning].to_i
102
- warning "#{total} recordings pending in Twilio account #{name}"
103
- else
104
- ok "#{total} recordings pending in Twilio account #{name}"
105
- end
106
- end
107
- end