sensu-plugins-nginx 0.0.1 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a360d0bd2c831bb98e4603806125c05c3000f58b
4
- data.tar.gz: b974328c59089f53b7dfb540574c4dfad092225f
3
+ metadata.gz: e778dbeff021b21812d03b6a3f4cc0b612bc6708
4
+ data.tar.gz: 79ffe39c6dfb796ac2242edd2346e04578786eee
5
5
  SHA512:
6
- metadata.gz: f3104129a3815cd7fd33bb452ee1be8cc6d4831bea37d21c82107ac1dd5faf3694c033051858fe30a39d089d0b471b00178b9c5f281c755b86ba88b700ce7ebe
7
- data.tar.gz: f27402b300ba352eb307660d4e2de539a3c50d46bc6cfe7d88ff0d8df0c3f06eecb7797fdf358e3e786c7a91bfa134820d632de0213bf07b0a2699f2515bff43
6
+ metadata.gz: b9022ff5167a1311f7863de9c78157472e0e876a81e7554159d050b0d3fde0af8c3e65b6750f3614deaceee5a2d146b25c415d5a901d6285f31978595634ab7b
7
+ data.tar.gz: 73d0aba1c0e65ae5a26f1cf2898ce33f57fe09c46731fba709739970c574daa9b0f51bec1d57e034f559711d9e328b8cb363b5a6e8e24e700f9db6c140152fbf
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,19 +1,38 @@
1
- #### 0.1.0-alpha.1
1
+ #Change Log
2
+ This project adheres to [Semantic Versioning](http://semver.org/).
2
3
 
3
- * baseline release identical to **sensu-community-plugins** repo
4
- * basic yard coverage
5
- * pinned dependencies
6
- * built against 1.9.3, 2.0, 2.1
7
- * cryptographically signed
4
+ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
8
5
 
9
- #### 0.0.1-alpha.2
6
+ ## Unreleased
7
+ -nothing
10
8
 
11
- * bump Vagrant to Chef 6.6
12
- * update LICENSE and gemspec authors
13
- * update README
14
- * add required Ruby version *>= 1.9.3*
15
- * add test/spec_help.rb
16
9
 
17
- #### 0.0.1
10
+ ## [0.0.5] - 2015-07-15
11
+ - bump version due to wrong file name, no code changes
18
12
 
19
- * edit readme
13
+
14
+ ## [0.0.4] - 2015-07-14 **YANKED**
15
+ ### Changed
16
+ - updated sensu-plugin gem to 1.2.0
17
+
18
+ ## [0.0.3] - 2015-06-10 **YANKED**
19
+
20
+ ### Changed
21
+ - changed the name of nginx-metrics.rb to metrics-nginx.rb to conform to std naming
22
+ - nginx-metrics.rb is now depericiated and will be removed in a future release
23
+ - clean Rakefile
24
+ - put gem deps in alpha order in gemspec
25
+ - update doc links in README and CONTRIBUTING
26
+
27
+ ### Fixed
28
+ - add binstubs for ruby files only
29
+
30
+ ## [0.0.2] - 2015-06-03 **YANKED**
31
+ ### Fixed
32
+ - added binstubs
33
+
34
+ ### Changed
35
+ - removed cruft from /lib
36
+
37
+ ## [0.0.1] - 2015-02-11 **YANKED**
38
+ - initial stable release
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2015 devops@yieldbot.com
1
+ Copyright (c) 2015 Sensu-Plugins
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,10 +1,11 @@
1
1
  ## Sensu-Plugins-nginx
2
2
 
3
- [![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-nginx.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-nginx)
3
+ [ ![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-nginx.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-nginx)
4
4
  [![Gem Version](https://badge.fury.io/rb/sensu-plugins-nginx.svg)](http://badge.fury.io/rb/sensu-plugins-nginx)
5
5
  [![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-nginx/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-nginx)
6
6
  [![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-nginx/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-nginx)
7
7
  [![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-nginx.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-nginx)
8
+ [ ![Codeship Status for sensu-plugins/sensu-plugins-nginx](https://codeship.com/projects/cb4b6810-cb1c-0132-b746-0ab4e5d2e01d/status?branch=master)](https://codeship.com/projects/75658)
8
9
 
9
10
  ## Functionality
10
11
 
@@ -20,39 +21,6 @@ Get the nginx metrics from the status page url for use with Graphite
20
21
 
21
22
  ## Installation
22
23
 
23
- Add the public key (if you haven’t already) as a trusted certificate
24
-
25
- ```
26
- gem cert --add <(curl -Ls https://raw.githubusercontent.com/sensu-plugins/sensu-plugins.github.io/master/certs/sensu-plugins.pem)
27
- gem install sensu-plugins-nginx -P MediumSecurity
28
- ```
29
-
30
- You can also download the key from /certs/ within each repository.
31
-
32
- #### Rubygems
33
-
34
- `gem install sensu-plugins-nginx`
35
-
36
- #### Bundler
37
-
38
- Add *sensu-plugins-nginx* to your Gemfile and run `bundle install` or `bundle update`
39
-
40
- #### Chef
41
-
42
- Using the Sensu **sensu_gem** LWRP
43
- ```
44
- sensu_gem 'sensu-plugins-nginx' do
45
- options('--prerelease')
46
- version '0.0.1.alpha.1'
47
- end
48
- ```
49
-
50
- Using the Chef **gem_package** resource
51
- ```
52
- gem_package 'sensu-plugins-nginx' do
53
- options('--prerelease')
54
- version '0.0.1.alpha.1'
55
- end
56
- ```
24
+ [Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
57
25
 
58
26
  ## Notes
@@ -0,0 +1,115 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # nginx-metrics
4
+ #
5
+ # DESCRIPTION:
6
+ # Pull nginx metrics for backends through stub status module
7
+ #
8
+ # OUTPUT:
9
+ # metric data
10
+ #
11
+ # PLATFORMS:
12
+ # Linux
13
+ #
14
+ # DEPENDENCIES:
15
+ # gem: sensu-plugin
16
+ #
17
+ # USAGE:
18
+ # #YELLOW
19
+ #
20
+ # NOTES:
21
+ #
22
+ # LICENSE:
23
+ # Copyright 2012 Pete Shima <me@peteshima.com>
24
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
25
+ # for details.
26
+ #
27
+
28
+ require 'sensu-plugin/metric/cli'
29
+ require 'net/https'
30
+ require 'uri'
31
+ require 'socket'
32
+
33
+ #
34
+ # Nginx Metrics
35
+ #
36
+ class NginxMetrics < Sensu::Plugin::Metric::CLI::Graphite
37
+ option :url,
38
+ short: '-u URL',
39
+ long: '--url URL',
40
+ description: 'Full URL to nginx status page, example: https://yoursite.com/nginx_status This ignores ALL other options EXCEPT --scheme'
41
+
42
+ option :hostname,
43
+ short: '-h HOSTNAME',
44
+ long: '--host HOSTNAME',
45
+ description: 'Nginx hostname'
46
+
47
+ option :port,
48
+ short: '-P PORT',
49
+ long: '--port PORT',
50
+ description: 'Nginx port',
51
+ default: '80'
52
+
53
+ option :path,
54
+ short: '-q STATUSPATH',
55
+ long: '--statspath STATUSPATH',
56
+ description: 'Path to your stub status module',
57
+ default: 'nginx_status'
58
+
59
+ option :scheme,
60
+ description: 'Metric naming scheme, text to prepend to metric',
61
+ short: '-s SCHEME',
62
+ long: '--scheme SCHEME',
63
+ default: "#{Socket.gethostname}.nginx"
64
+
65
+ # Main function
66
+ #
67
+ def run # rubocop:disable all
68
+ found = false
69
+ attempts = 0
70
+ until found || attempts >= 10
71
+ attempts += 1
72
+ if config[:url]
73
+ uri = URI.parse(config[:url])
74
+ http = Net::HTTP.new(uri.host, uri.port)
75
+ if uri.scheme == 'https'
76
+ http.use_ssl = true
77
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
78
+ end
79
+ request = Net::HTTP::Get.new(uri.request_uri)
80
+ response = http.request(request)
81
+ if response.code == '200'
82
+ found = true
83
+ elsif !response.header['location'].nil?
84
+ config[:url] = response.header['location']
85
+ end
86
+ else
87
+ response = Net::HTTP.start(config[:hostname], config[:port]) do |connection|
88
+ request = Net::HTTP::Get.new("/#{config[:path]}")
89
+ connection.request(request)
90
+ end
91
+ end
92
+ end
93
+
94
+ # #YELLOW
95
+ response.body.split(/\r?\n/).each do |line| # rubocop:disable Style/Next
96
+ if line.match(/^Active connections:\s+(\d+)/)
97
+ connections = line.match(/^Active connections:\s+(\d+)/).to_a
98
+ output "#{config[:scheme]}.active_connections", connections[1]
99
+ end
100
+ if line.match(/^\s+(\d+)\s+(\d+)\s+(\d+)/)
101
+ requests = line.match(/^\s+(\d+)\s+(\d+)\s+(\d+)/).to_a
102
+ output "#{config[:scheme]}.accepts", requests[1]
103
+ output "#{config[:scheme]}.handled", requests[2]
104
+ output "#{config[:scheme]}.requests", requests[3]
105
+ end
106
+ if line.match(/^Reading:\s+(\d+).*Writing:\s+(\d+).*Waiting:\s+(\d+)/)
107
+ queue = line.match(/^Reading:\s+(\d+).*Writing:\s+(\d+).*Waiting:\s+(\d+)/).to_a
108
+ output "#{config[:scheme]}.reading", queue[1]
109
+ output "#{config[:scheme]}.writing", queue[2]
110
+ output "#{config[:scheme]}.waiting", queue[3]
111
+ end
112
+ end
113
+ ok
114
+ end
115
+ end
data/bin/nginx-metrics.rb CHANGED
@@ -64,7 +64,7 @@ class NginxMetrics < Sensu::Plugin::Metric::CLI::Graphite
64
64
 
65
65
  # Main function
66
66
  #
67
- def run
67
+ def run # rubocop:disable all
68
68
  found = false
69
69
  attempts = 0
70
70
  until found || attempts >= 10
@@ -99,9 +99,9 @@ class NginxMetrics < Sensu::Plugin::Metric::CLI::Graphite
99
99
  end
100
100
  if line.match(/^\s+(\d+)\s+(\d+)\s+(\d+)/)
101
101
  requests = line.match(/^\s+(\d+)\s+(\d+)\s+(\d+)/).to_a
102
- output "#{config[:scheme]}.accepted", requests[1]
102
+ output "#{config[:scheme]}.accepts", requests[1]
103
103
  output "#{config[:scheme]}.handled", requests[2]
104
- output "#{config[:scheme]}.handles", requests[3]
104
+ output "#{config[:scheme]}.requests", requests[3]
105
105
  end
106
106
  if line.match(/^Reading:\s+(\d+).*Writing:\s+(\d+).*Waiting:\s+(\d+)/)
107
107
  queue = line.match(/^Reading:\s+(\d+).*Writing:\s+(\d+).*Waiting:\s+(\d+)/).to_a
@@ -0,0 +1,9 @@
1
+ module SensuPluginsNginx
2
+ module Version
3
+ MAJOR = 0
4
+ MINOR = 0
5
+ PATCH = 5
6
+
7
+ VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
+ end
9
+ end
@@ -1,7 +1 @@
1
- #
2
- # Set gem version
3
- #
4
- module SensuPluginsNginx
5
- # Gem version
6
- VERSION = '0.0.1'
7
- end
1
+ require 'sensu-plugins-nginx/version'
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-nginx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
- - Yieldbot, Inc. and contributors
7
+ - Sensu-Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
@@ -30,7 +30,7 @@ cert_chain:
30
30
  8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
31
31
  HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
32
32
  -----END CERTIFICATE-----
33
- date: 2015-02-11 00:00:00.000000000 Z
33
+ date: 2015-07-15 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: sensu-plugin
@@ -38,161 +38,183 @@ dependencies:
38
38
  requirements:
39
39
  - - '='
40
40
  - !ruby/object:Gem::Version
41
- version: 1.1.0
41
+ version: 1.2.0
42
42
  type: :runtime
43
43
  prerelease: false
44
44
  version_requirements: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - '='
47
47
  - !ruby/object:Gem::Version
48
- version: 1.1.0
48
+ version: 1.2.0
49
49
  - !ruby/object:Gem::Dependency
50
- name: codeclimate-test-reporter
50
+ name: bundler
51
51
  requirement: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - '>='
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '0'
55
+ version: '1.7'
56
56
  type: :development
57
57
  prerelease: false
58
58
  version_requirements: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - '>='
60
+ - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: '0'
62
+ version: '1.7'
63
63
  - !ruby/object:Gem::Dependency
64
- name: rubocop
64
+ name: codeclimate-test-reporter
65
65
  requirement: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - ~>
67
+ - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: 0.17.0
69
+ version: '0.4'
70
70
  type: :development
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - ~>
74
+ - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: 0.17.0
76
+ version: '0.4'
77
77
  - !ruby/object:Gem::Dependency
78
- name: rspec
78
+ name: github-markup
79
79
  requirement: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - ~>
81
+ - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '3.1'
83
+ version: '1.3'
84
84
  type: :development
85
85
  prerelease: false
86
86
  version_requirements: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - ~>
88
+ - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: '3.1'
90
+ version: '1.3'
91
91
  - !ruby/object:Gem::Dependency
92
- name: bundler
92
+ name: pry
93
93
  requirement: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - ~>
95
+ - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: '1.7'
97
+ version: '0.10'
98
98
  type: :development
99
99
  prerelease: false
100
100
  version_requirements: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - ~>
102
+ - - "~>"
103
103
  - !ruby/object:Gem::Version
104
- version: '1.7'
104
+ version: '0.10'
105
105
  - !ruby/object:Gem::Dependency
106
106
  name: rake
107
107
  requirement: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - ~>
109
+ - - "~>"
110
110
  - !ruby/object:Gem::Version
111
111
  version: '10.0'
112
112
  type: :development
113
113
  prerelease: false
114
114
  version_requirements: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - ~>
116
+ - - "~>"
117
117
  - !ruby/object:Gem::Version
118
118
  version: '10.0'
119
119
  - !ruby/object:Gem::Dependency
120
- name: github-markup
120
+ name: redcarpet
121
121
  requirement: !ruby/object:Gem::Requirement
122
122
  requirements:
123
- - - '>='
123
+ - - "~>"
124
124
  - !ruby/object:Gem::Version
125
- version: '0'
125
+ version: '3.2'
126
126
  type: :development
127
127
  prerelease: false
128
128
  version_requirements: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - '>='
130
+ - - "~>"
131
131
  - !ruby/object:Gem::Version
132
- version: '0'
132
+ version: '3.2'
133
133
  - !ruby/object:Gem::Dependency
134
- name: redcarpet
134
+ name: rspec
135
135
  requirement: !ruby/object:Gem::Requirement
136
136
  requirements:
137
- - - '>='
137
+ - - "~>"
138
138
  - !ruby/object:Gem::Version
139
- version: '0'
139
+ version: '3.1'
140
140
  type: :development
141
141
  prerelease: false
142
142
  version_requirements: !ruby/object:Gem::Requirement
143
143
  requirements:
144
- - - '>='
144
+ - - "~>"
145
145
  - !ruby/object:Gem::Version
146
- version: '0'
146
+ version: '3.1'
147
+ - !ruby/object:Gem::Dependency
148
+ name: rubocop
149
+ requirement: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - '='
152
+ - !ruby/object:Gem::Version
153
+ version: '0.30'
154
+ type: :development
155
+ prerelease: false
156
+ version_requirements: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - '='
159
+ - !ruby/object:Gem::Version
160
+ version: '0.30'
147
161
  - !ruby/object:Gem::Dependency
148
162
  name: yard
149
163
  requirement: !ruby/object:Gem::Requirement
150
164
  requirements:
151
- - - '>='
165
+ - - "~>"
152
166
  - !ruby/object:Gem::Version
153
- version: '0'
167
+ version: '0.8'
154
168
  type: :development
155
169
  prerelease: false
156
170
  version_requirements: !ruby/object:Gem::Requirement
157
171
  requirements:
158
- - - '>='
172
+ - - "~>"
159
173
  - !ruby/object:Gem::Version
160
- version: '0'
161
- description: Sensu nginx checks
162
- email: <sensu-users@googlegroups.com>
174
+ version: '0.8'
175
+ description: Sensu plugins for the NGINX server
176
+ email: "<sensu-users@googlegroups.com>"
163
177
  executables:
164
178
  - nginx-metrics.rb
179
+ - metrics-nginx.rb
165
180
  extensions: []
166
181
  extra_rdoc_files: []
167
182
  files:
168
- - bin/nginx-metrics.rb
169
- - lib/sensu-plugins-nginx.rb
183
+ - CHANGELOG.md
170
184
  - LICENSE
171
185
  - README.md
172
- - CHANGELOG.md
186
+ - bin/metrics-nginx.rb
187
+ - bin/nginx-metrics.rb
188
+ - lib/sensu-plugins-nginx.rb
189
+ - lib/sensu-plugins-nginx/version.rb
173
190
  homepage: https://github.com/sensu-plugins/sensu-plugins-nginx
174
191
  licenses:
175
192
  - MIT
176
- metadata: {}
177
- post_install_message:
193
+ metadata:
194
+ maintainer: "@mattyjones"
195
+ development_status: active
196
+ production_status: unstable - testing recommended
197
+ release_draft: 'false'
198
+ release_prerelease: 'false'
199
+ post_install_message: You can use the embedded Ruby by setting EMBEDDED_RUBY=true
200
+ in /etc/default/sensu
178
201
  rdoc_options: []
179
202
  require_paths:
180
203
  - lib
181
204
  required_ruby_version: !ruby/object:Gem::Requirement
182
205
  requirements:
183
- - - '>='
206
+ - - ">="
184
207
  - !ruby/object:Gem::Version
185
208
  version: 1.9.3
186
209
  required_rubygems_version: !ruby/object:Gem::Requirement
187
210
  requirements:
188
- - - '>='
211
+ - - ">="
189
212
  - !ruby/object:Gem::Version
190
213
  version: '0'
191
214
  requirements: []
192
215
  rubyforge_project:
193
- rubygems_version: 2.0.14
216
+ rubygems_version: 2.4.6
194
217
  signing_key:
195
218
  specification_version: 4
196
- summary: Sensu nginx checks
219
+ summary: Sensu plugins for the NGINX server
197
220
  test_files: []
198
- has_rdoc:
metadata.gz.sig CHANGED
Binary file