sensu-plugins-sidekiq-donotuse 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6239fe800e383290df13a793af86f75258ed135d
4
+ data.tar.gz: b7bdc502783b493553f212348a75db66151a7454
5
+ SHA512:
6
+ metadata.gz: 8c9fede9d4874419194ec0ca3d66443f04c90870d4e45f9a9ac825a33416435211b5555a3f9697422fffafe193fd905a95cc3169b69190b0f6888866a728ea22
7
+ data.tar.gz: b2893ab4fee20b340c6ca48e9fdf4ea5de88fcdf33514684bbc2e3c06c88d2c892c9f018113e2f6f60fc0be664c8f7d92919bd3665857e18fa5b5e7b455e3a71
@@ -0,0 +1,19 @@
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
+
9
+ ## [0.0.3] - 2015-11-04
10
+ ### Added
11
+ - new script `check-sidekiq-dead-queue.rb`
12
+
13
+ ## [0.0.2] - 2015-07-14
14
+ ### Changed
15
+ - updated sensu-plugin gem to 1.2.0
16
+
17
+ ## [0.0.1] - 2015-06-27
18
+ ### Added
19
+ - 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.
@@ -0,0 +1,61 @@
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.
13
+ The following scripts:
14
+
15
+ * bin/check-sidekiq.rb
16
+ * bin/sidekiq-metrics.rb
17
+
18
+ require [sidekiq-monitor-stats](https://github.com/harvesthq/sidekiq-monitor-stats)
19
+ running on your application. Pass the `--url URL` option with the url to your monitor stats. Both scripts also accept a
20
+ `--auth USER:PASSWORD` option in case the monitor stats url sits behind basic authorization.
21
+
22
+ * bin/check-sidekiq-dead-queue.rb
23
+ uses the native sidekiq JSON dashboard under `<mount point>/dashboard/stats`
24
+ [More info](https://github.com/mperham/sidekiq/wiki/Monitoring#using-the-built-in-dashboard)
25
+
26
+
27
+ ### check-sidekiq.rb
28
+
29
+ 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
30
+ 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
31
+ script:
32
+
33
+ * `--warn SECONDS`: Warn after job has been SECONDS seconds in a queue. The default is 120.
34
+ * `--crit SECONDS`: Critical after job has been SECONDS seconds in a queue. The default is 300.
35
+
36
+ ### sidekiq-metrics.rb
37
+
38
+ Generates total concurrency (`concurrency`), total busy (`busy`) and maximum latency (`latency`) metrics for your sidekiq. A graph of
39
+ busy vs. concurrency is specially useful for capacity planning. The latency metric should let you know if something is wrong (or there
40
+ are spikes that don't trigger a warning or a critical). Accepts an `--scheme SCHEME` option to know what scheme to append to the
41
+ metrics (the default is `sidekiq`).
42
+
43
+
44
+ ### check-sidekiq-dead-queue.rb
45
+ Checks the dead queue and raises a CRITICAL if it's not empty. Jobs in the dead queue have failed over 25 times. Some organisations might consider this an issue to address and could benefit from this check.
46
+
47
+
48
+ ## Files
49
+ * bin/check-sidekiq.rb
50
+ * bin/sidekiq-metrics.rb
51
+ * bin/check-sidekiq-dead-queue.rb
52
+
53
+ ## Usage
54
+
55
+ ## Installation
56
+
57
+ [Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
58
+
59
+ ## Notes
60
+
61
+ Thanks to [xxxxxx]() for contributing.
@@ -0,0 +1,55 @@
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
+ # DESCRIPTION:
9
+ # Check that the sidekiq dead queue size is 0 using the sidekiq
10
+ # stats JSON page under
11
+ # /sidekiq/dashboard/stats
12
+ #
13
+ # DEPENDENCIES:
14
+ # gem: sensu-plugin
15
+ # gem: open-uri
16
+ # gem: json
17
+ #
18
+ # LICENSE:
19
+ # by https://github.com/bennythejudge
20
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
21
+ # for details.
22
+ class SidekiqCheck < Sensu::Plugin::Check::CLI
23
+ option :url,
24
+ short: '-u URL',
25
+ long: '--url URL',
26
+ description: 'Url to query',
27
+ required: true
28
+
29
+ option :auth,
30
+ short: '-a USER:PASSWORD',
31
+ long: '--auth USER:PASSWORD',
32
+ description: 'Basic auth credentials if you need them',
33
+ proc: proc { |auth| auth.split(':') }
34
+
35
+ def run
36
+ begin
37
+ stats = JSON.parse(
38
+ if config[:auth]
39
+ open(config[:url], http_basic_authentication: config[:auth]).read
40
+ else
41
+ open(config[:url]).read
42
+ end
43
+ )
44
+ rescue => error
45
+ unknown "Could not load Sidekiq stats from #{config[:url]}. Error: #{error}"
46
+ end
47
+ dead_queue_size = stats['sidekiq']['dead']
48
+ if !dead_queue_size.zero?
49
+ entry_or_entries = dead_queue_size > 1 ? 'entries' : 'entry'
50
+ critical 'dead queue not empty (' + dead_queue_size.to_s + ' ' + entry_or_entries + ')'
51
+ else
52
+ ok 'sidekiq dead queue is empty'
53
+ end
54
+ end
55
+ end
@@ -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 = 3
7
+
8
+ VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
9
+ end
10
+ end
metadata ADDED
@@ -0,0 +1,215 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sensu-plugins-sidekiq-donotuse
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ platform: ruby
6
+ authors:
7
+ - Sensu-Plugins and contributors
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-11-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: json
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.8.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.8.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: sensu-plugin
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 1.2.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 1.2.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: codeclimate-test-reporter
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.4'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.4'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 0.32.1
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 0.32.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.1'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.1'
83
+ - !ruby/object:Gem::Dependency
84
+ name: bundler
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.7'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.7'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '10.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '10.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: github-markup
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '1.3'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '1.3'
125
+ - !ruby/object:Gem::Dependency
126
+ name: redcarpet
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '3.2'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '3.2'
139
+ - !ruby/object:Gem::Dependency
140
+ name: yard
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '0.8'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '0.8'
153
+ - !ruby/object:Gem::Dependency
154
+ name: pry
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '0.10'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '0.10'
167
+ description: Sensu sidekiq plugins
168
+ email: "<sensu-users@googlegroups.com>"
169
+ executables:
170
+ - check-sidekiq-dead-queue.rb
171
+ - check-sidekiq.rb
172
+ - metrics-sidekiq.rb
173
+ extensions: []
174
+ extra_rdoc_files: []
175
+ files:
176
+ - CHANGELOG.md
177
+ - LICENSE
178
+ - README.md
179
+ - bin/check-sidekiq-dead-queue.rb
180
+ - bin/check-sidekiq.rb
181
+ - bin/metrics-sidekiq.rb
182
+ - lib/sensu-plugins-sidekiq.rb
183
+ - lib/sensu-plugins-sidekiq/version.rb
184
+ homepage: https://github.com/sensu-plugins/sensu-plugins-sidekiq
185
+ licenses:
186
+ - MIT
187
+ metadata:
188
+ maintainer: sensu-plugin
189
+ development_status: active
190
+ production_status: unstable - testing recommended
191
+ release_draft: 'false'
192
+ release_prerelease: 'false'
193
+ post_install_message: You can use the embedded Ruby by setting EMBEDDED_RUBY=true
194
+ in /etc/default/sensu
195
+ rdoc_options: []
196
+ require_paths:
197
+ - lib
198
+ required_ruby_version: !ruby/object:Gem::Requirement
199
+ requirements:
200
+ - - ">="
201
+ - !ruby/object:Gem::Version
202
+ version: 1.9.3
203
+ required_rubygems_version: !ruby/object:Gem::Requirement
204
+ requirements:
205
+ - - ">="
206
+ - !ruby/object:Gem::Version
207
+ version: '0'
208
+ requirements: []
209
+ rubyforge_project:
210
+ rubygems_version: 2.4.8
211
+ signing_key:
212
+ specification_version: 4
213
+ summary: Sensu plugins for sidekiq
214
+ test_files: []
215
+ has_rdoc: