sensu-plugins-bluepill 0.0.1.alpha.2

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: cdf1afb494041fb2ccb4dadc11142f856a9fe3ad
4
+ data.tar.gz: f9b476f42a67b1ef5b8859e9a8401a2822e17919
5
+ SHA512:
6
+ metadata.gz: 00a17b8c561720b30c9691fd3ef5c059de92cec5ca6acb201af818db0219a60428fefe243b19196905b5d22dc9c7b4483f8fa2586935ed6523bec3ba84e2a89b
7
+ data.tar.gz: 57ad68698d01bef2200bfba986bae702e18304233d263fa169c295f47b1c2df62b97b0202709d033a03af54f319ac0a9f0ea1bad4b0c259bdf5daa785188e929
checksums.yaml.gz.sig ADDED
@@ -0,0 +1 @@
1
+ %�3��h9�˝�ɮ�����~�����g�!�lS�U�B�>b�`�.����0-����O�5YB���
data/CHANGELOG.md ADDED
@@ -0,0 +1,6 @@
1
+ #### 0.0.1.alpha.1
2
+ * same functionality as the community repo
3
+
4
+ #### 0.0.1.alpha.2
5
+ * add gem metadata
6
+ * add Vagrantfile to be provisioned by Chef
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 devops@yieldbot.com
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,53 @@
1
+ ## Sensu-Plugins-bluepill
2
+
3
+ [![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-bluepill.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-bluepill)
4
+ [![Gem Version](https://badge.fury.io/rb/sensu-plugins-bluepill.svg)](http://badge.fury.io/rb/sensu-plugins-bluepill)
5
+ [![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-bluepill/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-bluepill)
6
+ [![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-bluepill/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-bluepill)
7
+ [![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-bluepill.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-bluepill)
8
+
9
+ ## Functionality
10
+
11
+ ## Files
12
+ * bin/check-bluepill-procs
13
+
14
+ ## Usage
15
+
16
+ ## Installation
17
+
18
+ Add the public key (if you haven’t already) as a trusted certificate
19
+
20
+ ```
21
+ gem cert --add <(curl -Ls https://raw.githubusercontent.com/sensu-plugins/sensu-plugins.github.io/master/certs/sensu-plugins.pem)
22
+ gem install sensu-plugins-bluepill -P MediumSecurity
23
+ ```
24
+
25
+ You can also download the key from /certs/ within each repository.
26
+
27
+ #### Rubygems
28
+
29
+ `gem install sensu-plugins-bluepill`
30
+
31
+ #### Bundler
32
+
33
+ Add *sensu-plugins-bluepill* to your Gemfile and run `bundle install` or `bundle update`
34
+
35
+ #### Chef
36
+
37
+ Using the Sensu **sensu_gem** LWRP
38
+ ```
39
+ sensu_gem 'sensu-plugins-bluepill' do
40
+ options('--prerelease')
41
+ version '0.0.1'
42
+ end
43
+ ```
44
+
45
+ Using the Chef **gem_package** resource
46
+ ```
47
+ gem_package 'sensu-plugins-bluepill' do
48
+ options('--prerelease')
49
+ version '0.0.1'
50
+ end
51
+ ```
52
+
53
+ ## Notes
@@ -0,0 +1,157 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # check-bluepill-procs
4
+ #
5
+ # DESCRIPTION:
6
+ # This plugin monitors the status of applications and processes
7
+ # running under the bluepill process supervisor.
8
+ #
9
+ # Specify applications to monitor with -a [APP1,APP2]
10
+ # If this option is not provided, this check will monitor the processes
11
+ # of all the applications that bluepill has loaded.
12
+ #
13
+ # OUTPUT:
14
+ # plain text
15
+ # Returns CRITICAL if any process is down or if a manually specified
16
+ # application has no processes loaded
17
+ # Returns WARNING if any process is starting or unmonitored
18
+ # Returns OK if all processes for all specified applications are 'up'
19
+ # or bluepill is not in $PATH
20
+ #
21
+ # PLATFORMS:
22
+ # Linux
23
+ #
24
+ # DEPENDENCIES:
25
+ # gem: sensu-plugin
26
+ # gem: English
27
+ #
28
+ # USAGE:
29
+ #
30
+ # NOTES:
31
+ #
32
+ # LICENSE:
33
+ # James Legg mail@jameslegg.co.uk
34
+ # Matt Greensmith mgreensmith@cozy.co
35
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
36
+ # for details.
37
+ #
38
+
39
+ require 'sensu-plugin/check/cli'
40
+ require 'English'
41
+
42
+ #
43
+ # Check application processes running under bluepill control
44
+ #
45
+ class CheckBluepill < Sensu::Plugin::Check::CLI
46
+ # a single application to monitor, or multiple applications, comma-separated.
47
+ # check all applications if option not provided.
48
+ option :apps,
49
+ short: '-a [APPS]',
50
+ long: '--applications [APPS]'
51
+
52
+ option :debug,
53
+ long: '--debug',
54
+ description: 'Verbose output'
55
+
56
+ option :sudo,
57
+ short: '-s',
58
+ long: '--sudo',
59
+ description: 'exec bluepill with sudo (needs passwordless)'
60
+
61
+ def merge_output(orig, add)
62
+ orig.keys.each { |k| orig[k].push(*add[k]) }
63
+ orig
64
+ end
65
+
66
+ def bluepill_application_status(name) # rubocop:disable all
67
+ out = { name: [], ok: [], warn: [], crit: [], err: [] }
68
+ app_status = `#{config[:sudo] ? 'sudo ' : nil }bluepill #{name} status 2<&1`
69
+ name = 'Unknown' if name == ''
70
+ out[:name] << name
71
+ puts "***** DEBUG: bluepill #{name} status *****\n#{app_status}" if config[:debug]
72
+ processes_found = 0
73
+ # #YELLOW
74
+ app_status.each_line do |line| # rubocop:disable Style/Next
75
+ if line =~ /(pid:)/
76
+ processes_found += 1
77
+ case line
78
+ when /unmonitored$/
79
+ out[:warn] << "#{name}::#{line}".strip
80
+ next
81
+ when /starting$/
82
+ out[:warn] << "#{name}::#{line}".strip
83
+ next
84
+ when /down$/
85
+ out[:crit] << "#{name}::#{line}".strip
86
+ next
87
+ when /up$/
88
+ out[:ok] << "#{name}::#{line}".strip
89
+ next
90
+ end
91
+ end
92
+ end
93
+ out[:err] << name if processes_found == 0
94
+ puts "***** DEBUG: bluepill #{name} status parsed ******\n#{out.inspect}" if config[:debug]
95
+ out
96
+ end
97
+
98
+ def parse_output(out) # rubocop:disable all
99
+ puts "***** DEBUG: Full output hash ******\n#{out.inspect}" if config[:debug]
100
+ if !out[:crit].empty?
101
+ critical "Bluepill process(es) critical:\n#{out[:crit].join("\n")}"
102
+ elsif !out[:err].empty?
103
+ critical "Bluepill process(es) not found for applications: #{out[:err].join(',')}"
104
+ elsif !out[:warn].empty?
105
+ warning "Bluepill process(es) warning:\n#{out[:warn].join("\n")}"
106
+ else
107
+ ok "Bluepill normal, #{out[:name].count} application(s) with #{out[:ok].count} process(es) up."
108
+ end
109
+ end
110
+
111
+ def run # rubocop:disable all
112
+ # Check if Bluepill is installed
113
+ `which bluepill`
114
+ # #YELLOW
115
+ unless $CHILD_STATUS.success? # rubocop:disable IfUnlessModifier
116
+ ok 'bluepill not installed'
117
+ end
118
+
119
+ out = { name: [], ok: [], warn: [], crit: [], err: [] }
120
+
121
+ if config[:apps]
122
+ requested_apps = config[:apps].split(',').map(&:strip) || []
123
+ puts "***** DEBUG: requested applications: #{requested_apps }*****" if config[:debug]
124
+ requested_apps.each do |a|
125
+ out = merge_output(out, bluepill_application_status(a))
126
+ end
127
+ else
128
+ puts '***** DEBUG: checking all applications *****' if config[:debug]
129
+ bluepill_status = `#{config[:sudo] ? 'sudo ' : nil }bluepill status 2>&1`
130
+ if $CHILD_STATUS.success?
131
+ # we have only one application loaded and bluepill is
132
+ # 'helpfully' showing us only the status of that
133
+ # application's processes. We can't get the name of the
134
+ # application, however.
135
+ puts '***** DEBUG: bluepill status short-circuited to show status of a single unknown application *****' if config[:debug]
136
+ out = merge_output(out, bluepill_application_status(''))
137
+ else
138
+ # We either have multiple applications or no applications,
139
+ # or maybe bluepill is completely borked.
140
+ # (Returning non-zero when there are multiple applications
141
+ # loaded seems bizarre, but hey, that's just me.)
142
+ # We assume that no found applications is OK, since we only
143
+ # get here if -a option is unset.
144
+ # #YELLOW
145
+ bluepill_status.each_line do |line| # rubocop:disable Style/Next
146
+ if line =~ /^\s \d\.\s/
147
+ app_name = line.split(/^\s \d\.\s/)[1].strip
148
+ # #YELLOW
149
+ puts "***** DEBUG: found an application: #{app_name} *****" if config[:debug] # rubocop:disable BlockNesting
150
+ out = merge_output(out, bluepill_application_status(app_name))
151
+ end
152
+ end
153
+ end
154
+ end
155
+ parse_output(out)
156
+ end
157
+ end
@@ -0,0 +1,7 @@
1
+ #
2
+ # Set gem version
3
+ #
4
+ module SensuPluginsBluepill
5
+ # Gem version
6
+ VERSION = '0.0.1.alpha.2'
7
+ end
data.tar.gz.sig ADDED
Binary file
metadata ADDED
@@ -0,0 +1,228 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sensu-plugins-bluepill
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.alpha.2
5
+ platform: ruby
6
+ authors:
7
+ - Yieldbot, Inc. 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-04-07 00:00:00.000000000 Z
34
+ dependencies:
35
+ - !ruby/object:Gem::Dependency
36
+ name: english
37
+ requirement: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '='
40
+ - !ruby/object:Gem::Version
41
+ version: 0.6.3
42
+ type: :runtime
43
+ prerelease: false
44
+ version_requirements: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '='
47
+ - !ruby/object:Gem::Version
48
+ version: 0.6.3
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.17.0
84
+ type: :development
85
+ prerelease: false
86
+ version_requirements: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - '='
89
+ - !ruby/object:Gem::Version
90
+ version: 0.17.0
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: Bluepill process supervisor plugins
190
+ email: "<sensu-users@googlegroups.com>"
191
+ executables: []
192
+ extensions: []
193
+ extra_rdoc_files: []
194
+ files:
195
+ - CHANGELOG.md
196
+ - LICENSE
197
+ - README.md
198
+ - bin/check-bluepill-procs.rb
199
+ - lib/sensu-plugins-bluepill.rb
200
+ homepage: https://github.com/sensu-plugins/sensu-plugins-bluepill
201
+ licenses:
202
+ - MIT
203
+ metadata:
204
+ maintainer: ''
205
+ development_status: unmaintained
206
+ production_status: unstable - testing reccomended
207
+ post_install_message:
208
+ rdoc_options: []
209
+ require_paths:
210
+ - lib
211
+ required_ruby_version: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: 1.9.3
216
+ required_rubygems_version: !ruby/object:Gem::Requirement
217
+ requirements:
218
+ - - ">"
219
+ - !ruby/object:Gem::Version
220
+ version: 1.3.1
221
+ requirements: []
222
+ rubyforge_project:
223
+ rubygems_version: 2.2.2
224
+ signing_key:
225
+ specification_version: 4
226
+ summary: Bluepill process supervisor plugins
227
+ test_files: []
228
+ has_rdoc:
metadata.gz.sig ADDED
@@ -0,0 +1,3 @@
1
+ �$���~�Ѣ�r�x$\K��k����
2
+ �g�]N��Ω��U|�|9 6N���98����kc�p������R��G �EL�|+I���8OM�E����U{8B8�_kO&���N1$}��ŨYL]����TJx����P���z�#�8 .\: ��6�l#�
3
+ � ���u����O�р0)�4��Dz���+�Ќ�^