sensu-plugins-druid 0.0.1

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 412715695f901086fccce41282ae9cbee33f2933
4
+ data.tar.gz: 830e7d5307de4ca7ef6d19e6b43ceac981ca2a1d
5
+ SHA512:
6
+ metadata.gz: 2aa793b8ce89ac19566ec216bc71aa62f445156681cfa824dd87acb49ca47a89198f9ab98193b4a6f0f370f144810fa94453468deb56857fe0c3fe3a9de75104
7
+ data.tar.gz: 6f725c7e690efa788dc67c0a46858efaba9a6438f59b766e6a3556d27a1eeed9d4818a34fa0c761c5e0d94c4ffdce335a36bc37e778bb328682b6ad21829a706
@@ -0,0 +1,6 @@
1
+ # Change Log
2
+
3
+ 0.0.1 - 2017-05-13
4
+ ---
5
+ ### Added
6
+ * initial release
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Yurii Rochniak
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.
@@ -0,0 +1,13 @@
1
+ # Sensu-Plugins-Druid
2
+
3
+ [![Build Status](https://travis-ci.org/grem11n/sensu-plugins-druid.svg?branch=master)](https://travis-ci.org/grem11n/sensu-plugins-druid)
4
+ ---
5
+ ![Logo image](http://i.imgur.com/Ouz7wcO.png "Logo")
6
+
7
+ ## Unreleased:
8
+ ### List of the checks:
9
+ * check-unavailable-segments.rb
10
+
11
+
12
+ ## TODO:
13
+ * check-historical-presence.rb
@@ -0,0 +1,80 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+ #
4
+ # check-unavailable-segments
5
+ #
6
+ # DESCRIPTION:
7
+ # Check if Druid has unavailable segments.
8
+ #
9
+ # Unavailable segments could indicate an issue with any Historical node
10
+ # or Coordinator.
11
+ # This check requests "loadstatus" from Coordinator API.
12
+ # Druid responds with JSON, which contain information regarding segments
13
+ # to load for each datasource.
14
+ #
15
+ # Druid documentation:
16
+ # http://druid.io/docs/latest/design/coordinator.html
17
+ #
18
+ # PLATFORMS:
19
+ # All
20
+ #
21
+ # DEPENDENCIES:
22
+ # gem: sensu-plugin
23
+ #
24
+ # USAGE:
25
+ # Check if amount of segments to load is not exceeding the threshold.
26
+ # ./check-unavailable-segments.rb # Equivalent to examples below
27
+ # ./check-unavailable-segments.rb -s localhost -p 8081 -c 0
28
+ # ./check-unavailable-segments.rb --server localhost --port 8081 --critical 0
29
+ #
30
+ # LICENCE:
31
+ # Yurii Rochniak <yrochnyak@gmail.com>
32
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
33
+ # for details.
34
+ #
35
+
36
+ require 'sensu-plugin/check/cli'
37
+ require 'net/http'
38
+ require 'json'
39
+
40
+ class CheckUnavailableSegments < Sensu::Plugin::Check::CLI
41
+ option :server,
42
+ description: 'Druid Coordinator node to connect to.',
43
+ short: '-s HOSTNAME',
44
+ long: '--server HOSTNAME',
45
+ default: 'localhost'
46
+
47
+ option :port,
48
+ description: 'Druid Coordinator API port.',
49
+ short: '-p PORT',
50
+ long: '--port PORT',
51
+ default: '8081'
52
+
53
+ option :critical,
54
+ description: 'Maximum amount of segments to load for each datasource.',
55
+ short: '-c CRITICAL',
56
+ long: '--critical CRITICAL',
57
+ proc: proc(&:to_i),
58
+ default: 0
59
+
60
+ def run
61
+ api = '/druid/coordinator/v1/loadstatus?simple'
62
+ issues = {}
63
+
64
+ begin
65
+ url = "http://#{config[:server]}:#{config[:port]}#{api}"
66
+ uri = URI(url)
67
+ response = Net::HTTP.get(uri)
68
+ rescue
69
+ critical %(Cannot connect to the Coordinator host on http://#{config[:server]}:#{config[:port]}#{api})
70
+ end
71
+
72
+ parsed = JSON.parse(response)
73
+ parsed.each do |datasource, segments|
74
+ issues[datasource] = segments if segments.to_i > config[:critical]
75
+ end
76
+
77
+ ok %(Amount of segments to load for each datasource is not greater than #{config[:critical]}) if issues.empty?
78
+ critical %(Druid has datasources with more than #{config[:critical]} segments to load: #{issues.to_json})
79
+ end
80
+ end
@@ -0,0 +1,11 @@
1
+ require 'sensu-plugins-druid/version'
2
+ #
3
+ # Default class
4
+ #
5
+ module SensuPluginsDruid
6
+ class << self
7
+ end
8
+
9
+ class << self
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ module SensuPluginsDruid
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
metadata ADDED
@@ -0,0 +1,213 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sensu-plugins-druid
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Yurii Rochniak
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-05-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sensu-plugin
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 1.8.6
34
+ - - '>='
35
+ - !ruby/object:Gem::Version
36
+ version: 1.8.6
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 1.8.6
44
+ - - '>='
45
+ - !ruby/object:Gem::Version
46
+ version: 1.8.6
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '1.7'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ~>
59
+ - !ruby/object:Gem::Version
60
+ version: '1.7'
61
+ - !ruby/object:Gem::Dependency
62
+ name: codeclimate-test-reporter
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ~>
66
+ - !ruby/object:Gem::Version
67
+ version: '0.4'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ~>
73
+ - !ruby/object:Gem::Version
74
+ version: '0.4'
75
+ - !ruby/object:Gem::Dependency
76
+ name: github-markup
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ~>
80
+ - !ruby/object:Gem::Version
81
+ version: '1.3'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ~>
87
+ - !ruby/object:Gem::Version
88
+ version: '1.3'
89
+ - !ruby/object:Gem::Dependency
90
+ name: pry
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ~>
94
+ - !ruby/object:Gem::Version
95
+ version: '0.10'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ~>
101
+ - !ruby/object:Gem::Version
102
+ version: '0.10'
103
+ - !ruby/object:Gem::Dependency
104
+ name: rake
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '10.5'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ~>
115
+ - !ruby/object:Gem::Version
116
+ version: '10.5'
117
+ - !ruby/object:Gem::Dependency
118
+ name: redcarpet
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ~>
122
+ - !ruby/object:Gem::Version
123
+ version: '3.2'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ~>
129
+ - !ruby/object:Gem::Version
130
+ version: '3.2'
131
+ - !ruby/object:Gem::Dependency
132
+ name: rubocop
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ~>
136
+ - !ruby/object:Gem::Version
137
+ version: 0.40.0
138
+ type: :development
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ~>
143
+ - !ruby/object:Gem::Version
144
+ version: 0.40.0
145
+ - !ruby/object:Gem::Dependency
146
+ name: rspec
147
+ requirement: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ~>
150
+ - !ruby/object:Gem::Version
151
+ version: '3.4'
152
+ type: :development
153
+ prerelease: false
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ~>
157
+ - !ruby/object:Gem::Version
158
+ version: '3.4'
159
+ - !ruby/object:Gem::Dependency
160
+ name: yard
161
+ requirement: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ~>
164
+ - !ruby/object:Gem::Version
165
+ version: '0.8'
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ~>
171
+ - !ruby/object:Gem::Version
172
+ version: '0.8'
173
+ description: Sensu plugin to monitor Druid DB
174
+ email: yrochnyak@gmail.com
175
+ executables:
176
+ - check-unavailable-segments.rb
177
+ extensions: []
178
+ extra_rdoc_files: []
179
+ files:
180
+ - CHANGELOG.md
181
+ - LICENSE
182
+ - README.md
183
+ - bin/check-unavailable-segments.rb
184
+ - lib/sensu-plugins-druid.rb
185
+ - lib/sensu-plugins-druid/version.rb
186
+ homepage: https://github.com/grem11n/sensu-plugins-druid
187
+ licenses:
188
+ - MIT
189
+ metadata:
190
+ maintainer: Yurii Rochniak
191
+ development_status: active
192
+ production_status: unstable - testing recommended
193
+ post_install_message:
194
+ rdoc_options: []
195
+ require_paths:
196
+ - lib
197
+ required_ruby_version: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - '>='
200
+ - !ruby/object:Gem::Version
201
+ version: 2.0.0
202
+ required_rubygems_version: !ruby/object:Gem::Requirement
203
+ requirements:
204
+ - - '>='
205
+ - !ruby/object:Gem::Version
206
+ version: '0'
207
+ requirements: []
208
+ rubyforge_project:
209
+ rubygems_version: 2.4.8
210
+ signing_key:
211
+ specification_version: 4
212
+ summary: Druid monitoring plugin
213
+ test_files: []