sensu-plugins-apache 0.0.1.alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 70792aa9bfb2fb3ece3946cc1445a979beac70a6
4
+ data.tar.gz: 2cc6d37696a930cdc5432875e1779cc368342147
5
+ SHA512:
6
+ metadata.gz: 28c8dc63af1ca5a192d992fdb500bfac8211ee5470a8cd84f4ede652a507fdcf03acf68fc7ed6874e37811825414fcc99f426ed60a7c9b76c891b24d730ea9aa
7
+ data.tar.gz: 4328da783f0ea95c2c021a60bee2f87a24dcd70e2e0888700e9bf910d96a611997b012a9d0f0d9678e18f8f71cb185cb4d95fa02c5aa62544facfd630d2ad4f2
checksums.yaml.gz.sig ADDED
Binary file
data.tar.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ a�~�����_Ξ�D�S����#�N���/�!�o��Rc�\Ҟ������_��9���eh��d����?��Mh[�^o��B��?�tXD�����;F_\R�pl����t٫E�T
2
+ �𴀌xi��M+CJ�<H����y�G�������*�C��b�����?��� O`��)W����F�+6췖�άĞ4��� �$1^'k_�\nQ�P�S���G������R�P"���w3���Z�!������j'q
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ #### 0.0.1.alpha.1
2
+
3
+ * identical functionality to community repo
4
+
5
+ #### 0.0.1.alpha.2
6
+
7
+ * add chef integration for development env
8
+ * clean codebase to allow all tests to pass
9
+ * pin development dependencies
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-apache
2
+
3
+ [![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-apache.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-apache)
4
+ [![Gem Version](https://badge.fury.io/rb/sensu-plugins-apache.svg)](http://badge.fury.io/rb/sensu-plugins-apache)
5
+ [![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-apache/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-apache)
6
+ [![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-apache/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-apache)
7
+ [![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-apache.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-apache)
8
+
9
+ ## Functionality
10
+
11
+ ## Files
12
+ * bin/metrics-apache-graphite
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-apache -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-apache`
30
+
31
+ #### Bundler
32
+
33
+ Add *sensu-plugins-disk-checks* 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-apache' 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-apache' do
48
+ options('--prerelease')
49
+ version '0.0.1'
50
+ end
51
+ ```
52
+
53
+ ## Notes
@@ -0,0 +1,145 @@
1
+ #! /usr/bin/env ruby
2
+ # encoding: UTF-8
3
+ #
4
+ # apache-graphite
5
+ #
6
+ # DESCRIPTION:
7
+ # This plugin retrieves machine-readable output of mod_status, parses
8
+ # it, and generates Apache process metrics formatted for Graphite.
9
+ #
10
+ # OUTPUT:
11
+ # metric data
12
+ #
13
+ # PLATFORMS:
14
+ # Linux
15
+ #
16
+ # DEPENDENCIES:
17
+ # gem: sensu-plugin
18
+ # Apache module: mod_status
19
+ #
20
+ # USAGE:
21
+ # #YELLOW
22
+ #
23
+ # NOTES:
24
+ # enable extended mod_status
25
+ #
26
+ # LICENSE:
27
+ # Copyright 2014 Sonian, Inc. and contributors. <support@sensuapp.org>
28
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
29
+ # for details.
30
+ #
31
+
32
+ require 'sensu-plugin/metric/cli'
33
+ require 'net/http'
34
+ require 'net/https'
35
+
36
+ #
37
+ # Apache Metrics
38
+ #
39
+ class ApacheMetrics < Sensu::Plugin::Metric::CLI::Graphite
40
+ option :host,
41
+ short: '-h HOST',
42
+ long: '--host HOST',
43
+ description: 'HOST to check mod_status output',
44
+ default: 'localhost'
45
+
46
+ option :port,
47
+ short: '-p PORT',
48
+ long: '--port PORT',
49
+ description: 'Port to check mod_status output',
50
+ default: '80'
51
+
52
+ option :path,
53
+ short: '-path PATH',
54
+ long: '--path PATH',
55
+ description: 'PATH to check mod_status output',
56
+ default: '/server-status?auto'
57
+
58
+ option :user,
59
+ short: '-user USER',
60
+ long: '--user USER',
61
+ description: 'User if HTTP Basic is used'
62
+
63
+ option :password,
64
+ short: '-password USER',
65
+ long: '--password USER',
66
+ description: 'Password if HTTP Basic is used'
67
+
68
+ option :scheme,
69
+ description: 'Metric naming scheme, text to prepend to .$parent.$child',
70
+ long: '--scheme SCHEME',
71
+ default: "#{Socket.gethostname}"
72
+
73
+ option :secure,
74
+ short: '-s',
75
+ long: '--secure',
76
+ description: 'Use SSL'
77
+
78
+ def acquire_mod_status # rubocop:disable all
79
+ http = Net::HTTP.new(config[:host], config[:port])
80
+ if config[:secure]
81
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
82
+ http.use_ssl = true
83
+ end
84
+ req = Net::HTTP::Get.new(config[:path])
85
+ if !config[:user].nil? && !config[:password].nil?
86
+ req.basic_auth config[:user], config[:password]
87
+ end
88
+ res = http.request(req)
89
+ case res.code
90
+ when '200'
91
+ res.body
92
+ else
93
+ critical "Unable to get Apache metrics, unexpected HTTP response code: #{res.code}"
94
+ end
95
+ end
96
+
97
+ def run # rubocop:disable all
98
+ timestamp = Time.now.to_i
99
+ stats = {}
100
+ acquire_mod_status.split("\n").each do |line|
101
+ name, value = line.split(': ')
102
+ case name
103
+ when 'Total Accesses'
104
+ stats['total_accesses'] = value.to_i
105
+ when 'Total kBytes'
106
+ stats['total_bytes'] = (value.to_f * 1024).to_i
107
+ when 'CPULoad'
108
+ stats['cpuload'] = value.to_f * 100
109
+ when 'BusyWorkers'
110
+ stats['busy_workers'] = value.to_i
111
+ when 'IdleWorkers'
112
+ stats['idle_workers'] = value.to_i
113
+ when 'ReqPerSec'
114
+ stats['requests_per_sec'] = value.to_f
115
+ when 'BytesPerSec'
116
+ stats['bytes_per_sec'] = value.to_f
117
+ when 'BytesPerReq'
118
+ stats['bytes_per_req'] = value.to_f
119
+ when 'Scoreboard'
120
+ value = value.strip
121
+ stats['open'] = value.count('.')
122
+ stats['waiting'] = value.count('_')
123
+ stats['starting'] = value.count('S')
124
+ stats['reading'] = value.count('R')
125
+ stats['sending'] = value.count('W')
126
+ stats['keepalive'] = value.count('K')
127
+ stats['dnslookup'] = value.count('D')
128
+ stats['closing'] = value.count('C')
129
+ stats['logging'] = value.count('L')
130
+ stats['finishing'] = value.count('G')
131
+ stats['idle_cleanup'] = value.count('I')
132
+ stats['total'] = value.length
133
+ end
134
+ end
135
+ metrics = {
136
+ apache: stats
137
+ }
138
+ metrics.each do |parent, children|
139
+ children.each do |child, value|
140
+ output [config[:scheme], parent, child].join('.'), value, timestamp
141
+ end
142
+ end
143
+ ok
144
+ end
145
+ end
@@ -0,0 +1,7 @@
1
+ #
2
+ # Set gem version
3
+ #
4
+ module SensuPluginsApache
5
+ # Gem version
6
+ VERSION = '0.0.1.alpha.2'
7
+ end
metadata ADDED
@@ -0,0 +1,198 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sensu-plugins-apache
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-03-27 00:00:00.000000000 Z
34
+ dependencies:
35
+ - !ruby/object:Gem::Dependency
36
+ name: codeclimate-test-reporter
37
+ requirement: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ type: :development
43
+ prerelease: false
44
+ version_requirements: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ - !ruby/object:Gem::Dependency
50
+ name: rubocop
51
+ requirement: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '='
54
+ - !ruby/object:Gem::Version
55
+ version: 0.17.0
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '='
61
+ - !ruby/object:Gem::Version
62
+ version: 0.17.0
63
+ - !ruby/object:Gem::Dependency
64
+ name: rspec
65
+ requirement: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '3.1'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: '3.1'
77
+ - !ruby/object:Gem::Dependency
78
+ name: bundler
79
+ requirement: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ~>
82
+ - !ruby/object:Gem::Version
83
+ version: '1.7'
84
+ type: :development
85
+ prerelease: false
86
+ version_requirements: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ~>
89
+ - !ruby/object:Gem::Version
90
+ version: '1.7'
91
+ - !ruby/object:Gem::Dependency
92
+ name: rake
93
+ requirement: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ~>
96
+ - !ruby/object:Gem::Version
97
+ version: '10.0'
98
+ type: :development
99
+ prerelease: false
100
+ version_requirements: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ~>
103
+ - !ruby/object:Gem::Version
104
+ version: '10.0'
105
+ - !ruby/object:Gem::Dependency
106
+ name: github-markup
107
+ requirement: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ~>
110
+ - !ruby/object:Gem::Version
111
+ version: '1.3'
112
+ type: :development
113
+ prerelease: false
114
+ version_requirements: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ~>
117
+ - !ruby/object:Gem::Version
118
+ version: '1.3'
119
+ - !ruby/object:Gem::Dependency
120
+ name: redcarpet
121
+ requirement: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: '3.2'
126
+ type: :development
127
+ prerelease: false
128
+ version_requirements: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ~>
131
+ - !ruby/object:Gem::Version
132
+ version: '3.2'
133
+ - !ruby/object:Gem::Dependency
134
+ name: yard
135
+ requirement: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ~>
138
+ - !ruby/object:Gem::Version
139
+ version: '0.8'
140
+ type: :development
141
+ prerelease: false
142
+ version_requirements: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ~>
145
+ - !ruby/object:Gem::Version
146
+ version: '0.8'
147
+ - !ruby/object:Gem::Dependency
148
+ name: pry
149
+ requirement: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ~>
152
+ - !ruby/object:Gem::Version
153
+ version: '0.10'
154
+ type: :development
155
+ prerelease: false
156
+ version_requirements: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ~>
159
+ - !ruby/object:Gem::Version
160
+ version: '0.10'
161
+ description: ''
162
+ email: <sensu-users@googlegroups.com>
163
+ executables:
164
+ - metrics-apache-graphite.rb
165
+ extensions: []
166
+ extra_rdoc_files: []
167
+ files:
168
+ - bin/metrics-apache-graphite.rb
169
+ - lib/sensu-plugins-apache.rb
170
+ - LICENSE
171
+ - README.md
172
+ - CHANGELOG.md
173
+ homepage: https://github.com/sensu-plugins/sensu-plugins-apache
174
+ licenses:
175
+ - MIT
176
+ metadata: {}
177
+ post_install_message:
178
+ rdoc_options: []
179
+ require_paths:
180
+ - lib
181
+ required_ruby_version: !ruby/object:Gem::Requirement
182
+ requirements:
183
+ - - '>='
184
+ - !ruby/object:Gem::Version
185
+ version: 1.9.3
186
+ required_rubygems_version: !ruby/object:Gem::Requirement
187
+ requirements:
188
+ - - '>'
189
+ - !ruby/object:Gem::Version
190
+ version: 1.3.1
191
+ requirements: []
192
+ rubyforge_project:
193
+ rubygems_version: 2.0.14
194
+ signing_key:
195
+ specification_version: 4
196
+ summary: ''
197
+ test_files: []
198
+ has_rdoc:
metadata.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ P��*�1%�XҘ=�-0g����2��j�����n�����06�iWZ�������j�5O@����a��@! g����TV�v\�6�;�n��G�?-���q>܇h�E���!z��*ڷ��ِ��v�
2
+ ;:�gނ��k��B1�1#��-V�{0��xeh#u� ���퉒':v��`��M,�J���B¡X�EA��c�#M��'��?*z i0$�Plu�Ɠ`d���w�F�XoR��V�-�!��i*1�z�x|�D�