sensu-plugins-supervisor 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: c5d1c71168b4cd2a1176a8c30eb166b9607a451f
4
+ data.tar.gz: 3e3f0760352690c0d48f02111aaf18cd237f05ec
5
+ SHA512:
6
+ metadata.gz: c62cf25fbb3f044f6dd4205bc37182934d583842da58581fdccff6f82e1df8e1029e8579be4765342eb4e38bed4ac6a8d3ea5597b401e82ede8857e46b757763
7
+ data.tar.gz: d5b662211e9b174932063efad941fde74e179126c59f1c6b2cc96487b19cd805cf783cf3f43960777155f4c24cdba94d282cf5c510d5c36a7063597bbd42e78f
checksums.yaml.gz.sig ADDED
Binary file
data/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
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-05-29
9
+
10
+ ### Added
11
+ - initial release
12
+
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,22 @@
1
+ ## Sensu-Plugins-supervisor
2
+
3
+ [![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-supervisor.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-supervisor)
4
+ [![Gem Version](https://badge.fury.io/rb/sensu-plugins-supervisor.svg)](http://badge.fury.io/rb/sensu-plugins-supervisor)
5
+ [![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-supervisor/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-supervisor)
6
+ [![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-supervisor/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-supervisor)
7
+ [![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-supervisor.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-supervisor)
8
+ [![Codeship Status for sensu-plugins/sensu-plugins-supervisor](https://codeship.com/projects/9a0b39d0-e89f-0132-72f9-62885e5c211b/status?branch=master)](https://codeship.com/projects/82850)
9
+
10
+ ## Functionality
11
+
12
+ ## Files
13
+ * bin/check-supervisor.rb
14
+ * bin/check-supervisor-socket.rb
15
+
16
+ ## Usage
17
+
18
+ ## Installation
19
+
20
+ [Installation and Setup](https://github.com/sensu-plugins/documentation/blob/master/user_docs/installation_instructions.md)
21
+
22
+ ## Notes
@@ -0,0 +1,102 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # check-supervisor-socket
4
+ #
5
+ #
6
+ # DESCRIPTION:
7
+ # Check that all supervisor processes are running using its UNIX domain socket. See unix_http_server section in
8
+ # http://supervisord.org/configuration.html.
9
+ #
10
+ # OUTPUT:
11
+ # Plain text, 'All processes running' or eg. 'redis-server not running: FATAL'
12
+ #
13
+ # PLATFORMS:
14
+ # Linux
15
+ #
16
+ # DEPENDENCIES:
17
+ # gem: sensu-plugin
18
+ # gem: libxml-xmlrpc
19
+ #
20
+ # USAGE:
21
+ # check-supervisor-socket.rb
22
+ #
23
+ # LICENSE:
24
+ # Mathias Bogaert, mathias.bogaert@gmail.com
25
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
26
+ # for details.
27
+
28
+ require 'sensu-plugin/check/cli'
29
+
30
+ require 'net/http'
31
+ require 'socket'
32
+ require 'xml/libxml/xmlrpc'
33
+
34
+ class CheckSupervisorSocket < Sensu::Plugin::Check::CLI
35
+ option :socket,
36
+ description: 'Supervisor UNIX domain socket',
37
+ short: '-s SOCKET',
38
+ long: '--socket SOCKET',
39
+ default: '/var/run/supervisor.sock'
40
+
41
+ option :username,
42
+ description: 'Supervisor UNIX domain socket username',
43
+ short: '-u USERNAME',
44
+ long: '--username USERNAME'
45
+
46
+ option :password,
47
+ description: 'Supervisor UNIX domain socket password',
48
+ short: '-p PASSWORD',
49
+ long: '--password PASSWORD'
50
+
51
+ option :critical,
52
+ description: 'Supervisor states to consider critical',
53
+ short: '-c STATE[,STATE...]',
54
+ long: '--critical STATE[,STATE...]',
55
+ proc: proc { |v| v.upcase.split(',') },
56
+ default: ['FATAL']
57
+
58
+ option :help,
59
+ description: 'Show this message',
60
+ short: '-h',
61
+ long: '--help'
62
+
63
+ def run
64
+ if config[:help]
65
+ puts opt_parser
66
+ exit
67
+ end
68
+
69
+ begin
70
+ @super = Net::BufferedIO.new(UNIXSocket.new(config[:socket]))
71
+ rescue
72
+ critical "Tried to access UNIX domain socket #{config[:socket]} but failed"
73
+ end
74
+
75
+ begin
76
+ request = Net::HTTP::Post.new('/RPC2')
77
+ request.content_type = 'text/xml'
78
+ request.basic_auth config[:username], config[:password] if config[:username]
79
+ request.body = XML::XMLRPC::Builder.call('supervisor.getAllProcessInfo')
80
+ request.exec(@super, '1.1', '/RPC2')
81
+
82
+ # wait for and parse the http response
83
+ response = nil
84
+ loop do
85
+ response = Net::HTTPResponse.read_new(@super)
86
+ break unless response.is_a?(Net::HTTPContinue)
87
+ end
88
+
89
+ response.reading_body(@super, request.response_body_permitted?) {}
90
+ rescue => e
91
+ critical "Tried requesting XMLRPC 'supervisor.getAllProcessInfo' from UNIX domain socket #{config[:socket]} but failed: #{e}"
92
+ end
93
+
94
+ XML::XMLRPC::Parser.new(response.body).params.each do |param|
95
+ param.each do |process|
96
+ critical "#{process[:name]} not running: #{process[:statename].upcase}" if config[:critical].include?(process[:statename])
97
+ end
98
+ end
99
+
100
+ ok 'All processes running'
101
+ end
102
+ end
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # check-supervisor-socket
4
+ #
5
+ #
6
+ # DESCRIPTION:
7
+ # Check all supervisor processes are running#
8
+ #
9
+ # OUTPUT:
10
+ # Plain text, 'All processes running' or eg. 'redis-server not running: FATAL'
11
+ #
12
+ # PLATFORMS:
13
+ # Linux
14
+ #
15
+ # DEPENDENCIES:
16
+ # gem: sensu-plugin
17
+ # gem: uby-supervisor
18
+ #
19
+ # USAGE:
20
+ # check-supervisor-socket.rb
21
+ #
22
+ # LICENSE:
23
+ # Copyright (c) 2013 Double Negative Limited and Johan van den Dorpe
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 'ruby-supervisor'
29
+
30
+ class CheckSupervisor < Sensu::Plugin::Check::CLI
31
+ option :host,
32
+ description: 'Hostname to check',
33
+ short: '-H HOST',
34
+ long: '--host HOST',
35
+ default: 'localhost'
36
+
37
+ option :port,
38
+ description: 'Supervisor port',
39
+ short: '-p PORT',
40
+ long: '--port PORT',
41
+ default: 9001
42
+
43
+ option :critical,
44
+ description: 'Supervisor states to consider critical',
45
+ short: '-c STATE[,STATE...]',
46
+ long: '--critical STATE[,STATE...]',
47
+ proc: proc { |v| v.upcase.split(',') },
48
+ default: ['FATAL']
49
+
50
+ option :help,
51
+ description: 'Show this message',
52
+ short: '-h',
53
+ long: '--help'
54
+
55
+ def run
56
+ if config[:help]
57
+ puts opt_parser
58
+ exit
59
+ end
60
+
61
+ begin
62
+ @super = RubySupervisor::Client.new(config[:host], config[:port])
63
+ rescue
64
+ critical "Tried to access #{config[:host]} but failed"
65
+ end
66
+
67
+ @super.processes.each do |process|
68
+ critical "#{process['name']} not running: #{process['statename'].downcase}" if config[:critical].include?(process['statename'])
69
+ end
70
+
71
+ ok 'All processes running'
72
+ end # def run
73
+ end # class CheckSupervisor
@@ -0,0 +1,13 @@
1
+ require 'json'
2
+
3
+ # encoding: utf-8
4
+ module SensuPluginsSupervisor
5
+ # This defines the version of the gem
6
+ module Version
7
+ MAJOR = 0
8
+ MINOR = 0
9
+ PATCH = 1
10
+
11
+ VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
12
+ end
13
+ end
@@ -0,0 +1,2 @@
1
+
2
+ require 'sensu-plugins-supervisor/version'
data.tar.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ �����-�������ΐdy�l�<D ��[���F���xh`�5n���~�Z m��#�b���r�B�Sy��-�)����]Y�:��ίR
2
+ >3��v�2�\�wYr�I�9�p�Z8��׋퇷��gg�{�Wl�P!�|���g�����f9�kH�B�o��3�?t��� �ᦕ�,�BĒ���Q�0vn ��nk����*��i����!Nhx2,瘕�=�R���xmD��M���QȬs�VP�(Ɓ~�
metadata ADDED
@@ -0,0 +1,245 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sensu-plugins-supervisor
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
+ MIIDgDCCAmigAwIBAgIB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iPPMseSQzLJ
29
+ JKP4hVvbc1d+oS925B1lcBiqn2aYvElbyNAVmQPywNNqkWmvtlqj9ZVJfV5HQLdu
30
+ 8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
31
+ HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
32
+ -----END CERTIFICATE-----
33
+ date: 2015-05-31 00:00:00.000000000 Z
34
+ dependencies:
35
+ - !ruby/object:Gem::Dependency
36
+ name: libxml-xmlrpc
37
+ requirement: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '='
40
+ - !ruby/object:Gem::Version
41
+ version: 0.1.5
42
+ type: :runtime
43
+ prerelease: false
44
+ version_requirements: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '='
47
+ - !ruby/object:Gem::Version
48
+ version: 0.1.5
49
+ - !ruby/object:Gem::Dependency
50
+ name: ruby-supervisor
51
+ requirement: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '='
54
+ - !ruby/object:Gem::Version
55
+ version: 0.0.2
56
+ type: :runtime
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '='
61
+ - !ruby/object:Gem::Version
62
+ version: 0.0.2
63
+ - !ruby/object:Gem::Dependency
64
+ name: sensu-plugin
65
+ requirement: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '='
68
+ - !ruby/object:Gem::Version
69
+ version: 1.1.0
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - '='
75
+ - !ruby/object:Gem::Version
76
+ version: 1.1.0
77
+ - !ruby/object:Gem::Dependency
78
+ name: codeclimate-test-reporter
79
+ requirement: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '0.4'
84
+ type: :development
85
+ prerelease: false
86
+ version_requirements: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '0.4'
91
+ - !ruby/object:Gem::Dependency
92
+ name: rubocop
93
+ requirement: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '0.30'
98
+ type: :development
99
+ prerelease: false
100
+ version_requirements: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: '0.30'
105
+ - !ruby/object:Gem::Dependency
106
+ name: rspec
107
+ requirement: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '3.1'
112
+ type: :development
113
+ prerelease: false
114
+ version_requirements: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - "~>"
117
+ - !ruby/object:Gem::Version
118
+ version: '3.1'
119
+ - !ruby/object:Gem::Dependency
120
+ name: bundler
121
+ requirement: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '1.7'
126
+ type: :development
127
+ prerelease: false
128
+ version_requirements: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: '1.7'
133
+ - !ruby/object:Gem::Dependency
134
+ name: rake
135
+ requirement: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: '10.0'
140
+ type: :development
141
+ prerelease: false
142
+ version_requirements: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - "~>"
145
+ - !ruby/object:Gem::Version
146
+ version: '10.0'
147
+ - !ruby/object:Gem::Dependency
148
+ name: github-markup
149
+ requirement: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - "~>"
152
+ - !ruby/object:Gem::Version
153
+ version: '1.3'
154
+ type: :development
155
+ prerelease: false
156
+ version_requirements: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - "~>"
159
+ - !ruby/object:Gem::Version
160
+ version: '1.3'
161
+ - !ruby/object:Gem::Dependency
162
+ name: redcarpet
163
+ requirement: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - "~>"
166
+ - !ruby/object:Gem::Version
167
+ version: '3.2'
168
+ type: :development
169
+ prerelease: false
170
+ version_requirements: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - "~>"
173
+ - !ruby/object:Gem::Version
174
+ version: '3.2'
175
+ - !ruby/object:Gem::Dependency
176
+ name: yard
177
+ requirement: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - "~>"
180
+ - !ruby/object:Gem::Version
181
+ version: '0.8'
182
+ type: :development
183
+ prerelease: false
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - "~>"
187
+ - !ruby/object:Gem::Version
188
+ version: '0.8'
189
+ - !ruby/object:Gem::Dependency
190
+ name: pry
191
+ requirement: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - "~>"
194
+ - !ruby/object:Gem::Version
195
+ version: '0.10'
196
+ type: :development
197
+ prerelease: false
198
+ version_requirements: !ruby/object:Gem::Requirement
199
+ requirements:
200
+ - - "~>"
201
+ - !ruby/object:Gem::Version
202
+ version: '0.10'
203
+ description: Sensu plugins for working with supervisor
204
+ email: "<sensu-users@googlegroups.com>"
205
+ executables: []
206
+ extensions: []
207
+ extra_rdoc_files: []
208
+ files:
209
+ - CHANGELOG.md
210
+ - LICENSE
211
+ - README.md
212
+ - bin/check-supervisor-socket.rb
213
+ - bin/check-supervisor.rb
214
+ - lib/sensu-plugins-supervisor.rb
215
+ - lib/sensu-plugins-supervisor/version.rb
216
+ homepage: https://github.com/sensu-plugins/sensu-plugins-supervisor
217
+ licenses:
218
+ - MIT
219
+ metadata:
220
+ maintainer: ''
221
+ production_status: unstable - testing recommended
222
+ release_draft: 'false'
223
+ release_prerelease: 'false'
224
+ post_install_message: You can use the embedded Ruby by setting EMBEDDED_RUBY=true
225
+ in /etc/default/sensu
226
+ rdoc_options: []
227
+ require_paths:
228
+ - lib
229
+ required_ruby_version: !ruby/object:Gem::Requirement
230
+ requirements:
231
+ - - ">="
232
+ - !ruby/object:Gem::Version
233
+ version: 1.9.3
234
+ required_rubygems_version: !ruby/object:Gem::Requirement
235
+ requirements:
236
+ - - ">="
237
+ - !ruby/object:Gem::Version
238
+ version: '0'
239
+ requirements: []
240
+ rubyforge_project:
241
+ rubygems_version: 2.4.6
242
+ signing_key:
243
+ specification_version: 4
244
+ summary: Sensu plugins for working with supervisor
245
+ test_files: []
metadata.gz.sig ADDED
Binary file