sensu-plugins-kafka 0.8.0 → 0.8.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/bin/check-consumer-lag.rb +11 -23
- data/lib/sensu-plugins-kafka/version.rb +1 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 238d5d13127c16a53fd30c5a4dae4a05471547cf
|
4
|
+
data.tar.gz: 0d81d88567c829276fb5a9a11db4c9eae162f196
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41831c5fc35254acbf40b9cee04c8bf0735a9be6062f2a94f94b9552d8f85cd6fcfaa5356147ac369d7452965d7c1cba3c9a9dc2ea9478ee083a837f16cccc9c
|
7
|
+
data.tar.gz: 2eb96ee56a1888894765e8d28614bd185919a1542abd5ae028092506afc86b018cca1909041d3ac28dfbfd7a44d486f6563125f2a4d6b15878361e507cf11ae6
|
data/CHANGELOG.md
CHANGED
@@ -10,7 +10,12 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
10
10
|
### Fixed
|
11
11
|
### Changed
|
12
12
|
|
13
|
-
## [
|
13
|
+
## [0.8.1]
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
- check-consumer-lag: remove celluloid (temporary), fix data structure, fix partition_owner function
|
17
|
+
|
18
|
+
## [0.8.0]
|
14
19
|
|
15
20
|
### Breaking Changes
|
16
21
|
- Refactoring check-consumer-lag to remove shell/jvm execution
|
data/bin/check-consumer-lag.rb
CHANGED
@@ -27,17 +27,10 @@
|
|
27
27
|
|
28
28
|
require 'sensu-plugin/check/cli'
|
29
29
|
|
30
|
-
require 'celluloid-io'
|
31
30
|
require 'json'
|
32
31
|
require 'poseidon'
|
33
32
|
require 'zookeeper'
|
34
33
|
|
35
|
-
module Poseidon
|
36
|
-
class Connection
|
37
|
-
TCPSocket = Celluloid::IO::TCPSocket
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
34
|
class ConsumerLagCheck < Sensu::Plugin::Check::CLI
|
42
35
|
option :group,
|
43
36
|
description: 'Consumer group',
|
@@ -89,8 +82,8 @@ class ConsumerLagCheck < Sensu::Plugin::Check::CLI
|
|
89
82
|
zk.get(path: "/consumers/#{group}/offsets/#{topic}/#{partition}")[:data].to_i
|
90
83
|
end
|
91
84
|
|
92
|
-
def partition_owner(zk, group, partition)
|
93
|
-
zk.get(path: "/consumers/#{group}/
|
85
|
+
def partition_owner(zk, group, topic, partition)
|
86
|
+
zk.get(path: "/consumers/#{group}/owners/#{topic}/#{partition}")[:data]
|
94
87
|
end
|
95
88
|
|
96
89
|
def run
|
@@ -103,10 +96,10 @@ class ConsumerLagCheck < Sensu::Plugin::Check::CLI
|
|
103
96
|
|
104
97
|
consumers = {}
|
105
98
|
topics.each do |topic|
|
106
|
-
consumers[topic] =
|
99
|
+
consumers[topic] = []
|
107
100
|
|
108
101
|
topics_partitions(z, topic).each do |partition|
|
109
|
-
owner = partition_owner(z, group, partition)
|
102
|
+
owner = partition_owner(z, group, topic, partition)
|
110
103
|
|
111
104
|
leader = leader_broker(z, topic, partition)
|
112
105
|
consumer = Poseidon::PartitionConsumer.new('CheckConsumerLag', leader['host'], leader['port'], topic, partition, :latest_offset)
|
@@ -115,27 +108,22 @@ class ConsumerLagCheck < Sensu::Plugin::Check::CLI
|
|
115
108
|
offset = consumer_offset(z, group, topic, partition)
|
116
109
|
|
117
110
|
lag = logsize - offset
|
118
|
-
|
119
|
-
consumers[topic][:partition] = partition
|
120
|
-
consumers[topic][:logsize] = logsize
|
121
|
-
consumers[topic][:offset] = offset
|
122
|
-
consumers[topic][:lag] = lag
|
123
|
-
consumers[topic][:owner] = owner
|
111
|
+
consumers[topic].push(partition: partition, logsize: logsize, offset: offset, lag: lag, owner: owner)
|
124
112
|
end
|
125
113
|
end
|
126
114
|
|
127
115
|
[:offset, :logsize, :lag].each do |field|
|
128
|
-
consumers.
|
129
|
-
critical "Topic #{k} has
|
116
|
+
consumers.each do |k, v|
|
117
|
+
critical "Topic #{k} has #{field} < 0 '#{v[field]}'" unless v.select { |w| w[field].to_i < 0 }.empty?
|
130
118
|
end
|
131
119
|
end
|
132
120
|
|
133
|
-
consumers.
|
134
|
-
critical "Topic #{k} has partitions with no owner" unless v.select { |w| w[:owner] == 'none' }.empty?
|
121
|
+
consumers.each do |k, v|
|
122
|
+
critical "Topic #{k} has partitions with no owner '#{v[:owner]}'" unless v.select { |w| w[:owner] == 'none' }.empty?
|
135
123
|
end
|
136
124
|
|
137
|
-
lags =
|
138
|
-
Hash[k, v.inject(0) { |a, e| a + e[:lag]
|
125
|
+
lags = consumers.map do |k, v|
|
126
|
+
Hash[k, v.inject(0) { |a, e| a + e[:lag] }]
|
139
127
|
end
|
140
128
|
|
141
129
|
max_lag = lags.map(&:values).flatten.max
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-kafka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sensu-Plugins and contributors
|
@@ -9,22 +9,8 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain:
|
11
11
|
- certs/sensu-plugins.pem
|
12
|
-
date: 2017-02-
|
12
|
+
date: 2017-02-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: celluloid-io
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - "~>"
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: 0.17.3
|
21
|
-
type: :runtime
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - "~>"
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: 0.17.3
|
28
14
|
- !ruby/object:Gem::Dependency
|
29
15
|
name: poseidon
|
30
16
|
requirement: !ruby/object:Gem::Requirement
|