sensu-plugins-couchdb 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,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZDZjNzA5M2I3OTM0MWU5ZjYyMmQzNmYyOTRmZmE1OTgzNDUxOGM4Yw==
5
+ data.tar.gz: !binary |-
6
+ MzZjMzAwZTg4YTQyZmY1MzRjZGI4ZDQyMGUxYTVmZjdiZTM4ZjZhYw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MTVjMzk2MzFlMWIxN2RjM2YzZDY0MzYyYTZmMGY2N2EzNmQ2YjBhZTgxMGU5
10
+ NDY4N2ViMjEzNzAxNDc3MTg0ZWMzYTQ5OThiN2U0OGFlNjk0OWU2ZThjODhj
11
+ YWRmMzEyMDQwYjk1ZTdiMDFjYzg2MTNjNDA1NDc0YTU3NjRjMjM=
12
+ data.tar.gz: !binary |-
13
+ NjcyYmY2Mzk3MzM2NjNiMjU0ZmU5MDk0NDUwODNlMzMxMjk3MzA5MjczYmUz
14
+ YjljNTIzZGVlNDc3ODk4M2MxZjFmNWFlZjBmNzQ2NzVlZjQ4M2E5NTUwZGYy
15
+ YWRhODAyNGQxYjFiNTQ1M2FkMzEzYTFmNTMxOTlhNWU0MTM5OWU=
checksums.yaml.gz.sig ADDED
Binary file
data/CHANGELOG.md ADDED
@@ -0,0 +1,18 @@
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]
7
+
8
+ ## 0.0.1 - 2016-02-04
9
+ ### Changed
10
+ - adjusted dependencies
11
+ - clean repo
12
+ - configure for new pipeline
13
+
14
+ ### Added
15
+ - update certs
16
+ - metrics-couchdb.rb
17
+
18
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-couchdb/compare/0.0.1...HEAD
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Sensu Community Plugins
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,22 @@
1
+
2
+ ## Sensu-Plugins-couchdb
3
+
4
+ [![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-couchdb.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-couchdb)
5
+ [![Gem Version](https://badge.fury.io/rb/sensu-plugins-couchdb.svg)](http://badge.fury.io/rb/sensu-plugins-couchdb)
6
+ [![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-couchdb/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-couchdb)
7
+ [![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-couchdb/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-couchdb)
8
+ [![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-couchdb.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-couchdb)
9
+
10
+ ## Functionality
11
+
12
+ ## Files
13
+
14
+ - metrics-couchdb.rb
15
+
16
+ ## Usage
17
+
18
+ ## Installation
19
+
20
+ [Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
21
+
22
+ ## Notes
@@ -0,0 +1,98 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # metrics-couchdb.rb
4
+ #
5
+ # DESCRIPTION:
6
+ #
7
+ # OUTPUT:
8
+ # metric data
9
+ #
10
+ # PLATFORMS:
11
+ # Linux
12
+ #
13
+ # DEPENDENCIES:
14
+ # gem: sensu-plugin
15
+ # gem: json
16
+ # gem: net
17
+ #
18
+ # USAGE:
19
+ # #YELLOW
20
+ #
21
+ # NOTES:
22
+ # Docs: https://wiki.apache.org/couchdb/Runtime_Statistics
23
+ # Based on:
24
+ # https://github.com/sensu-plugins/sensu-plugins-mongodb/blob/master/bin/metrics-mongodb.rb
25
+ # https://github.com/sensu-plugins/sensu-plugins-http/blob/master/bin/check-http-json.rb
26
+ # http://stackoverflow.com/a/17452062/49330
27
+ #
28
+ # LICENSE:
29
+ # Copyright 2015 Florin Andrei github.com/FlorinAndrei
30
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
31
+ # for details.
32
+ #
33
+
34
+ require 'sensu-plugin/metric/cli'
35
+ require 'json'
36
+ require 'net/http'
37
+
38
+ #
39
+ # CouchDB
40
+ #
41
+
42
+ class CouchDB < Sensu::Plugin::Metric::CLI::Graphite
43
+ option :host,
44
+ description: 'CouchDB host',
45
+ long: '--host HOST',
46
+ default: 'localhost'
47
+
48
+ option :port,
49
+ description: 'CouchDB port',
50
+ long: '--port PORT',
51
+ default: 5984
52
+
53
+ option :scheme,
54
+ description: 'Metric naming scheme',
55
+ long: '--scheme SCHEME',
56
+ short: '-s SCHEME',
57
+ default: "#{Socket.gethostname}.couchdb"
58
+
59
+ def run
60
+ http = Net::HTTP.new(config[:host], config[:port])
61
+ req = Net::HTTP::Get.new('/_stats')
62
+
63
+ begin
64
+ metrics = {}
65
+ res = http.request(req)
66
+ json = JSON.parse(res.body)
67
+
68
+ metrics.update(dot_it(json))
69
+ timestamp = Time.now.to_i
70
+ metrics.each do |k, v|
71
+ if k.end_with? '.description'
72
+ next
73
+ end
74
+ if v.nil?
75
+ next
76
+ end
77
+ output [config[:scheme], k].join('.'), v, timestamp
78
+ end
79
+ ok
80
+ rescue
81
+ exit(1)
82
+ end
83
+ end
84
+
85
+ def dot_it(object, prefix = nil)
86
+ if object.is_a? Hash
87
+ object.map do |key, value|
88
+ if prefix
89
+ dot_it value, "#{prefix}.#{key}"
90
+ else
91
+ dot_it value, key.to_s
92
+ end
93
+ end.reduce(&:merge)
94
+ else
95
+ { prefix => object }
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,9 @@
1
+ module SensuPluginsCouchdb
2
+ module Version
3
+ MAJOR = 0
4
+ MINOR = 0
5
+ PATCH = 1
6
+
7
+ VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
+ end
9
+ end
@@ -0,0 +1 @@
1
+ require 'sensu-plugins-couchdb/version'
data.tar.gz.sig ADDED
Binary file
metadata ADDED
@@ -0,0 +1,227 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sensu-plugins-couchdb
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
+ - !binary |-
12
+ LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURuakNDQW9hZ0F3SUJB
13
+ Z0lCQVRBTkJna3Foa2lHOXcwQkFRVUZBREJLTVJVd0V3WURWUVFEREF4elpX
14
+ NXoKZFMxd2JIVm5hVzR4SFRBYkJnb0praWFKay9Jc1pBRVpGZzF6Wlc1emRT
15
+ MXdiSFZuYVc1ek1SSXdFQVlLQ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jFMWEJzZFdkcGJrQnpaVzV6ZFMx
32
+ d2JIVm5hVzV6TG1sdk1BMEdDU3FHU0liM0RRRUJCUVVBQTRJQgpBUUNQZTZ0
33
+ RUJ0NS9uQzk1aFhvS2VLRmhrWVc5bTE2aU5YdWRKeEorZGRYcnpDc2tEMXk2
34
+ ajZjQXY0a1FlUDFmClBIbDE4aDVrOWtKeElQU1IrcUkrK2JJbDE3ZUVPU096
35
+ YXNMbXdzdGFNU25NN3U1UWZMcFdFWTJldVZXQkRzdGQKMmhrcG80VSswSzVT
36
+ d3ptZEphMFdLQXRmS3ZkdENROGk5MllJUCtIODNFdXZDU0xwZ29aaDYzRXJx
37
+ dVFVY25lbgphZmg1bHVUQkExaTFjcUJHNEFNSjBmTFdHeU9xSmFYOFA5WnN4
38
+ RERXUEVCbk5TaVd2WGIrSUttSkFWTzF1VzRrClFOODNielZXU1d1bFk4Qlk2
39
+ a1grSVFNd1lhelpBbEIvMTNkN2E4VTBoN0NyYjM2Sm5TUGF0aHVSemU0cUtY
40
+ RlEKM2YzVFVaV3d2UmZ0Y1N1K3Z0Y0JSa00wCi0tLS0tRU5EIENFUlRJRklD
41
+ QVRFLS0tLS0K
42
+ date: 2016-02-05 00:00:00.000000000 Z
43
+ dependencies:
44
+ - !ruby/object:Gem::Dependency
45
+ name: sensu-plugin
46
+ requirement: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ~>
49
+ - !ruby/object:Gem::Version
50
+ version: '1.2'
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ~>
56
+ - !ruby/object:Gem::Version
57
+ version: '1.2'
58
+ - !ruby/object:Gem::Dependency
59
+ name: bundler
60
+ requirement: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ~>
63
+ - !ruby/object:Gem::Version
64
+ version: '1.7'
65
+ type: :development
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ~>
70
+ - !ruby/object:Gem::Version
71
+ version: '1.7'
72
+ - !ruby/object:Gem::Dependency
73
+ name: codeclimate-test-reporter
74
+ requirement: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ~>
77
+ - !ruby/object:Gem::Version
78
+ version: '0.4'
79
+ type: :development
80
+ prerelease: false
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: '0.4'
86
+ - !ruby/object:Gem::Dependency
87
+ name: github-markup
88
+ requirement: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ~>
91
+ - !ruby/object:Gem::Version
92
+ version: '1.3'
93
+ type: :development
94
+ prerelease: false
95
+ version_requirements: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ~>
98
+ - !ruby/object:Gem::Version
99
+ version: '1.3'
100
+ - !ruby/object:Gem::Dependency
101
+ name: pry
102
+ requirement: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ~>
105
+ - !ruby/object:Gem::Version
106
+ version: '0.10'
107
+ type: :development
108
+ prerelease: false
109
+ version_requirements: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ~>
112
+ - !ruby/object:Gem::Version
113
+ version: '0.10'
114
+ - !ruby/object:Gem::Dependency
115
+ name: rake
116
+ requirement: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ~>
119
+ - !ruby/object:Gem::Version
120
+ version: '10.5'
121
+ type: :development
122
+ prerelease: false
123
+ version_requirements: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ~>
126
+ - !ruby/object:Gem::Version
127
+ version: '10.5'
128
+ - !ruby/object:Gem::Dependency
129
+ name: redcarpet
130
+ requirement: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ~>
133
+ - !ruby/object:Gem::Version
134
+ version: '3.2'
135
+ type: :development
136
+ prerelease: false
137
+ version_requirements: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ version: '3.2'
142
+ - !ruby/object:Gem::Dependency
143
+ name: rubocop
144
+ requirement: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - ~>
147
+ - !ruby/object:Gem::Version
148
+ version: '0.37'
149
+ type: :development
150
+ prerelease: false
151
+ version_requirements: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - ~>
154
+ - !ruby/object:Gem::Version
155
+ version: '0.37'
156
+ - !ruby/object:Gem::Dependency
157
+ name: rspec
158
+ requirement: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ~>
161
+ - !ruby/object:Gem::Version
162
+ version: '3.4'
163
+ type: :development
164
+ prerelease: false
165
+ version_requirements: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - ~>
168
+ - !ruby/object:Gem::Version
169
+ version: '3.4'
170
+ - !ruby/object:Gem::Dependency
171
+ name: yard
172
+ requirement: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ~>
175
+ - !ruby/object:Gem::Version
176
+ version: '0.8'
177
+ type: :development
178
+ prerelease: false
179
+ version_requirements: !ruby/object:Gem::Requirement
180
+ requirements:
181
+ - - ~>
182
+ - !ruby/object:Gem::Version
183
+ version: '0.8'
184
+ description: Sensu couchdb plugins
185
+ email: <sensu-users@googlegroups.com>
186
+ executables:
187
+ - metrics-couchdb.rb
188
+ extensions: []
189
+ extra_rdoc_files: []
190
+ files:
191
+ - CHANGELOG.md
192
+ - LICENSE
193
+ - README.md
194
+ - bin/metrics-couchdb.rb
195
+ - lib/sensu-plugins-couchdb.rb
196
+ - lib/sensu-plugins-couchdb/version.rb
197
+ homepage: https://github.com/sensu-plugins/sensu-plugins-couchdb
198
+ licenses:
199
+ - MIT
200
+ metadata:
201
+ maintainer: sensu-plugin
202
+ development_status: active
203
+ production_status: unstable - testing recommended
204
+ release_draft: 'false'
205
+ release_prerelease: 'false'
206
+ post_install_message: You can use the embedded Ruby by setting EMBEDDED_RUBY=true
207
+ in /etc/default/sensu
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: '0'
221
+ requirements: []
222
+ rubyforge_project:
223
+ rubygems_version: 2.4.5
224
+ signing_key:
225
+ specification_version: 4
226
+ summary: Sensu plugins for couchdb
227
+ test_files: []
metadata.gz.sig ADDED
Binary file