sensu-plugins-sidekiq 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0a375ef3a76158ce27ac3d734fee8ae44f4dcaa9
4
+ data.tar.gz: 8026eced0fa9fe0e884d89f8f85b490bc19d2abc
5
+ SHA512:
6
+ metadata.gz: 1183cd2ba7acb60c719d113b08d577be1e6c4d4dddc75d98194c8d743c016ab667658cd898becbffccbf54a97d17bb297efbd6321e458ef93ad37179fdc3793d
7
+ data.tar.gz: b206c4264959a8918e4c710dad48408a4a4aace0a14548cae3bb42234331ce99aeba98cbc1812816fd734d7f0a2c1b922ca6ca17672414761a514ab60bbaa05a
checksums.yaml.gz.sig ADDED
Binary file
data.tar.gz.sig ADDED
Binary file
data/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ #Change Log
2
+ This project adheres to [Semantic Versioning](http://semver.org/).
3
+
4
+ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
+
6
+ ## Unreleased][unreleased]
7
+
8
+ ## [0.0.1] - 2015-06-27
9
+ ### Added
10
+ - initial release
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Sensu-Plugins
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ ## Sensu-Plugins-sidekiq
2
+
3
+ [![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-sidekiq.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-sidekiq)
4
+ [![Gem Version](https://badge.fury.io/rb/sensu-plugins-sidekiq.svg)](http://badge.fury.io/rb/sensu-plugins-sidekiq)
5
+ [![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-sidekiq/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-sidekiq)
6
+ [![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-sidekiq/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-sidekiq)
7
+ [![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-sidekiq.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-sidekiq)
8
+ [![Codeship Status for sensu-plugins/sensu-plugins-sidekiq](https://codeship.com/projects/807ab0e0-edcd-0132-0ba1-1efd3f886df2/status?branch=master)](https://codeship.com/projects/84126)
9
+
10
+ ## Functionality
11
+
12
+ Check varius metrics and checks for Sidekiq. Requires [sidekiq-monitor-stats](https://github.com/harvesthq/sidekiq-monitor-stats)
13
+ running on your application. Pass the `--url URL` option with the url to your monitor stats. Both scripts also accept a
14
+ `--auth USER:PASSWORD` option in case the monitor stats url sits behind basic authorization.
15
+
16
+ ### check-sidekiq.rb
17
+
18
+ Uses the maximum latency to figure out when to raise warnings. The latency is the time a job has been waiting in the queue (without
19
+ being processed). It's generally a good metric to know when there's trouble with Sidekiq. There are some options you can pass to this
20
+ script:
21
+
22
+ * `--warn SECONDS`: Warn after job has been SECONDS seconds in a queue. The default is 120.
23
+ * `--crit SECONDS`: Critical after job has been SECONDS seconds in a queue. The default is 300.
24
+
25
+ ### sidekiq-metrics.rb
26
+
27
+ Generates total concurrency (`concurrency`), total busy (`busy`) and maximum latency (`latency`) metrics for your sidekiq. A graph of
28
+ busy vs. concurrency is specially useful for capacity planning. The latency metric should let you know if something is wrong (or there
29
+ are spikes that don't trigger a warning or a critical). Accepts an `--scheme SCHEME` option to know what scheme to append to the
30
+ metrics (the default is `sidekiq`).
31
+
32
+ ## Files
33
+ * bin/check-sidekiq.rb
34
+ * bin/sidekiq-metris.rb
35
+
36
+ ## Usage
37
+
38
+ ## Installation
39
+
40
+ [Installation and Setup](https://github.com/sensu-plugins/documentation/blob/master/user_docs/installation_instructions.md)
41
+
42
+ ## Notes
@@ -0,0 +1,87 @@
1
+ #! /usr/bin/env ruby
2
+ # encoding: UTF-8
3
+
4
+ require 'sensu-plugin/check/cli'
5
+ require 'open-uri'
6
+ require 'json'
7
+
8
+ # check-sidekiq
9
+ #
10
+ # DESCRIPTION:
11
+ # Check sidekiq status from a sidekiq-monitor-stats enabled endpoint.
12
+ #
13
+ # https://github.com/harvesthq/sidekiq-monitor-stats
14
+ #
15
+ # Uses the maximum latency to check the status.
16
+ #
17
+ #
18
+ # PLATFORMS:
19
+ # Linux
20
+ #
21
+ # DEPENDENCIES:
22
+ # gem: sensu-plugin
23
+ # gem: open-uri
24
+ # gem: json
25
+ #
26
+ # LICENSE:
27
+ # Albert Llop albert@getharvest.com
28
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
29
+ # for details.
30
+ #
31
+ class SidekiqCheck < Sensu::Plugin::Check::CLI
32
+ option :url,
33
+ short: '-u URL',
34
+ long: '--url URL',
35
+ description: 'Url to query',
36
+ required: true
37
+
38
+ option :auth,
39
+ short: '-a USER:PASSWORD',
40
+ long: '--auth USER:PASSWORD',
41
+ description: 'Basic auth credentials if you need them',
42
+ proc: proc { |auth| auth.split(':') }
43
+
44
+ option :warn,
45
+ short: '-w SECONDS',
46
+ long: '--warn SECONDS',
47
+ description: 'Warn after job has been SECONDS seconds in a queue',
48
+ proc: proc { |seconds| seconds.to_i },
49
+ default: 120
50
+
51
+ option :crit,
52
+ short: '-c SECONDS',
53
+ long: '--crit SECONDS',
54
+ description: 'Critical after job has been SECONDS seconds in a queue',
55
+ proc: proc { |seconds| seconds.to_i },
56
+ default: 300
57
+
58
+ def run
59
+ begin
60
+ stats = JSON.parse(
61
+ if config[:auth]
62
+ open(config[:url], http_basic_authentication: config[:auth]).read
63
+ else
64
+ open(config[:url]).read
65
+ end
66
+ )
67
+
68
+ rescue => error
69
+ unknown "Could not load Sidekiq stats from #{config[:url]}. Error: #{error}"
70
+ end
71
+
72
+ maximum_latency = stats['queues'].map { |_name, data| data['latency'] }.max
73
+ total_concurrency = stats['processes'].map { |process| process['concurrency'] }.reduce(&:+) || 0
74
+
75
+ if total_concurrency.zero?
76
+ critical 'There are no Sidekiq workers'
77
+ end
78
+
79
+ if maximum_latency > config[:warn]
80
+ warning "A job has been in a queue longer than #{config[:warn]} seconds"
81
+ elsif maximum_latency > config[:crit]
82
+ critical "A job has been in a queue longer than #{config[:crit]} seconds"
83
+ end
84
+
85
+ ok "Maximum job latency #{maximum_latency}"
86
+ end
87
+ end
@@ -0,0 +1,74 @@
1
+ #! /usr/bin/env ruby
2
+ # encoding: UTF-8
3
+
4
+ require 'sensu-plugin/metric/cli'
5
+ require 'open-uri'
6
+ require 'json'
7
+
8
+ # sidekiq-metrics
9
+ #
10
+ # DESCRIPTION:
11
+ # Pull sidekiq metrics from a sidekiq-monitor-stats enabled endpoint.
12
+ #
13
+ # https://github.com/harvesthq/sidekiq-monitor-stats
14
+ #
15
+ # OUTPUT:
16
+ # metric data
17
+ #
18
+ # PLATFORMS:
19
+ # Linux
20
+ #
21
+ # DEPENDENCIES:
22
+ # gem: sensu-plugin
23
+ # gem: open-uri
24
+ # gem: json
25
+ #
26
+ # LICENSE:
27
+ # Albert Llop albert@getharvest.com
28
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
29
+ # for details.
30
+ #
31
+ class SidekiqMetrics < Sensu::Plugin::Metric::CLI::Graphite
32
+ option :url,
33
+ short: '-u URL',
34
+ long: '--url URL',
35
+ description: 'Url to query',
36
+ required: true
37
+
38
+ option :auth,
39
+ short: '-a USER:PASSWORD',
40
+ long: '--auth USER:PASSWORD',
41
+ description: 'Basic auth credentials if you need them',
42
+ proc: proc { |auth| auth.split(':') }
43
+
44
+ option :scheme,
45
+ description: 'Metric naming scheme, text to prepend to metric',
46
+ short: '-s SCHEME',
47
+ long: '--scheme SCHEME',
48
+ default: 'sidekiq'
49
+
50
+ def run
51
+ begin
52
+ stats = JSON.parse(
53
+ if config[:auth]
54
+ open(config[:url], http_basic_authentication: config[:auth]).read
55
+ else
56
+ open(config[:url]).read
57
+ end
58
+ )
59
+
60
+ rescue => error
61
+ unknown "Could not load sidekiq stats from #{config[:url]}. Error: #{error}"
62
+ end
63
+
64
+ total_concurrency = stats['processes'].map { |process| process['concurrency'] }.reduce(&:+) || 0
65
+ total_busy = stats['processes'].map { |process| process['busy'] }.reduce(&:+) || 0
66
+ maximum_latency = stats['queues'].map { |_name, data| data['latency'] }.max
67
+
68
+ output "#{config[:scheme]}.concurrency", total_concurrency
69
+ output "#{config[:scheme]}.busy", total_busy
70
+ output "#{config[:scheme]}.latency", maximum_latency
71
+
72
+ ok
73
+ end
74
+ end
@@ -0,0 +1 @@
1
+ require 'sensu-plugins-sidekiq/version'
@@ -0,0 +1,10 @@
1
+ module SensuPluginsSidekiq
2
+ # This defines the version of the gem
3
+ module Version
4
+ MAJOR = 0
5
+ MINOR = 0
6
+ PATCH = 1
7
+
8
+ VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
9
+ end
10
+ end
metadata ADDED
@@ -0,0 +1,234 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sensu-plugins-sidekiq
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Sensu-Plugins and contributors
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDgDCCAmigAwIBAgIBATANBgkqhkiG9w0BAQUFADBDMRIwEAYDVQQDDAltYXR0
14
+ am9uZXMxGDAWBgoJkiaJk/IsZAEZFgh5aWVsZGJvdDETMBEGCgmSJomT8ixkARkW
15
+ A2NvbTAeFw0xNTAxMjgyMTAyNTFaFw0xNjAxMjgyMTAyNTFaMEMxEjAQBgNVBAMM
16
+ CW1hdHRqb25lczEYMBYGCgmSJomT8ixkARkWCHlpZWxkYm90MRMwEQYKCZImiZPy
17
+ LGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyTSzVYnO
18
+ CLgyrIyT1mBQakArQyW8xhi6MlDqyzXHJGeERT790U6EgoBVeS4XoK0ptFZNR8Tf
19
+ zko0w+Nv47TarSCgkPOaxY+mxWnAVR10dOmfeLr7huiMyps+YD56/EF2FqQ3jf/+
20
+ qohENfKD91qy1ieEy+Fn7Pf74ltbNKUdkb9a9eFXQ0DQ4ip5vik7DzjQkUTj4lca
21
+ k6ArwnmHX4YDhZoYtrQJ8jVktN0/+NtA40M5qkCYHNe5tUW25b/tKVYuioxG6b2Z
22
+ oIzaZxRLxf6HVAWpCVRT/F5+/yjigkX4u++eYacfLGleXQzoK7BL65vHGMJygWEE
23
+ 0TKGqFOrl/L0AQIDAQABo38wfTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNV
24
+ HQ4EFgQUEf6a8Td7MrSZc8ImbLFZAENPbz0wIQYDVR0RBBowGIEWbWF0dGpvbmVz
25
+ QHlpZWxkYm90LmNvbTAhBgNVHRIEGjAYgRZtYXR0am9uZXNAeWllbGRib3QuY29t
26
+ MA0GCSqGSIb3DQEBBQUAA4IBAQBbzXAYA3BVGw8DZ0YYoY1VHPNEcH5qPIApmHO8
27
+ rvSmuUT0yMEi7u00H/5uHRFf4LleGT/+sTdyXKsNPGT9kdRuQEgwi+vf7Zfvd8aX
28
+ UF/+4VkEYf/8rV8Ere6u2QaWPgApdMV6JjKr1fAwCTd8AuGXNaWItiPPMseSQzLJ
29
+ JKP4hVvbc1d+oS925B1lcBiqn2aYvElbyNAVmQPywNNqkWmvtlqj9ZVJfV5HQLdu
30
+ 8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
31
+ HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
32
+ -----END CERTIFICATE-----
33
+ date: 2015-06-27 00:00:00.000000000 Z
34
+ dependencies:
35
+ - !ruby/object:Gem::Dependency
36
+ name: json
37
+ requirement: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '='
40
+ - !ruby/object:Gem::Version
41
+ version: 1.8.2
42
+ type: :runtime
43
+ prerelease: false
44
+ version_requirements: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '='
47
+ - !ruby/object:Gem::Version
48
+ version: 1.8.2
49
+ - !ruby/object:Gem::Dependency
50
+ name: sensu-plugin
51
+ requirement: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '='
54
+ - !ruby/object:Gem::Version
55
+ version: 1.1.0
56
+ type: :runtime
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '='
61
+ - !ruby/object:Gem::Version
62
+ version: 1.1.0
63
+ - !ruby/object:Gem::Dependency
64
+ name: codeclimate-test-reporter
65
+ requirement: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '0.4'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '0.4'
77
+ - !ruby/object:Gem::Dependency
78
+ name: rubocop
79
+ requirement: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - '='
82
+ - !ruby/object:Gem::Version
83
+ version: '0.30'
84
+ type: :development
85
+ prerelease: false
86
+ version_requirements: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - '='
89
+ - !ruby/object:Gem::Version
90
+ version: '0.30'
91
+ - !ruby/object:Gem::Dependency
92
+ name: rspec
93
+ requirement: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '3.1'
98
+ type: :development
99
+ prerelease: false
100
+ version_requirements: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: '3.1'
105
+ - !ruby/object:Gem::Dependency
106
+ name: bundler
107
+ requirement: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '1.7'
112
+ type: :development
113
+ prerelease: false
114
+ version_requirements: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - "~>"
117
+ - !ruby/object:Gem::Version
118
+ version: '1.7'
119
+ - !ruby/object:Gem::Dependency
120
+ name: rake
121
+ requirement: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '10.0'
126
+ type: :development
127
+ prerelease: false
128
+ version_requirements: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: '10.0'
133
+ - !ruby/object:Gem::Dependency
134
+ name: github-markup
135
+ requirement: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: '1.3'
140
+ type: :development
141
+ prerelease: false
142
+ version_requirements: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - "~>"
145
+ - !ruby/object:Gem::Version
146
+ version: '1.3'
147
+ - !ruby/object:Gem::Dependency
148
+ name: redcarpet
149
+ requirement: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - "~>"
152
+ - !ruby/object:Gem::Version
153
+ version: '3.2'
154
+ type: :development
155
+ prerelease: false
156
+ version_requirements: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - "~>"
159
+ - !ruby/object:Gem::Version
160
+ version: '3.2'
161
+ - !ruby/object:Gem::Dependency
162
+ name: yard
163
+ requirement: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - "~>"
166
+ - !ruby/object:Gem::Version
167
+ version: '0.8'
168
+ type: :development
169
+ prerelease: false
170
+ version_requirements: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - "~>"
173
+ - !ruby/object:Gem::Version
174
+ version: '0.8'
175
+ - !ruby/object:Gem::Dependency
176
+ name: pry
177
+ requirement: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - "~>"
180
+ - !ruby/object:Gem::Version
181
+ version: '0.10'
182
+ type: :development
183
+ prerelease: false
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - "~>"
187
+ - !ruby/object:Gem::Version
188
+ version: '0.10'
189
+ description: Sensu sidekiq plugins
190
+ email: "<sensu-users@googlegroups.com>"
191
+ executables:
192
+ - metrics-sidekiq.rb
193
+ - check-sidekiq.rb
194
+ extensions: []
195
+ extra_rdoc_files: []
196
+ files:
197
+ - CHANGELOG.md
198
+ - LICENSE
199
+ - README.md
200
+ - bin/check-sidekiq.rb
201
+ - bin/metrics-sidekiq.rb
202
+ - lib/sensu-plugins-sidekiq.rb
203
+ - lib/sensu-plugins-sidekiq/version.rb
204
+ homepage: https://github.com/sensu-plugins/sensu-plugins-sidekiq
205
+ licenses:
206
+ - MIT
207
+ metadata:
208
+ maintainer: sensu-plugin
209
+ development_status: active
210
+ production_status: unstable - testing recommended
211
+ release_draft: 'false'
212
+ release_prerelease: 'false'
213
+ post_install_message: You can use the embedded Ruby by setting EMBEDDED_RUBY=true
214
+ in /etc/default/sensu
215
+ rdoc_options: []
216
+ require_paths:
217
+ - lib
218
+ required_ruby_version: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: 1.9.3
223
+ required_rubygems_version: !ruby/object:Gem::Requirement
224
+ requirements:
225
+ - - ">="
226
+ - !ruby/object:Gem::Version
227
+ version: '0'
228
+ requirements: []
229
+ rubyforge_project:
230
+ rubygems_version: 2.4.6
231
+ signing_key:
232
+ specification_version: 4
233
+ summary: Sensu plugins for sidekiq
234
+ test_files: []
metadata.gz.sig ADDED
@@ -0,0 +1,3 @@
1
+
2
+ A7[��XD� �2$I7�)��D��� ����-ߥ���|C��J�Ys��JB,�
3
+ ��M��z��6�Yi$���G�U�i�0)p[(w�*^b�M��p����B��3$��fU����6q�!�zc+C��+娰 FȂm#��|W?�P�O�P�R���7�xN�-}h�*�D�eĿ��ʋL����"���aT�7�&�����-V�V0��x�fl��.xh�L�� ڷ5���B2��; M�