From 58e6d4ae5d3c3450281d5c5bce401a002c7f9b1c Mon Sep 17 00:00:00 2001 From: Olivier Bazoud Date: Thu, 16 Feb 2017 15:33:54 +0100 Subject: [PATCH] check-topic.rb: check isr --- .rubocop.yml | 2 +- CHANGELOG.md | 5 +++++ bin/check-topic.rb | 6 ++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index b21ab3f..9d5e1bc 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -6,7 +6,7 @@ LineLength: Max: 225 AbcSize: - Max: 125 + Max: 140 FileName: Enabled: false diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d6df7f..ac2e11a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,11 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang ### Fixed ### Changed +## [Unreleased] + +### Added +- check-topic.rb: check isr + ## [0.9.1] - 2017-02-16 ### Fixed diff --git a/bin/check-topic.rb b/bin/check-topic.rb index 71f83ca..2dfb8f4 100755 --- a/bin/check-topic.rb +++ b/bin/check-topic.rb @@ -106,8 +106,10 @@ def run partitions.each do |num, replica| state_json = z.get(path: "/brokers/topics/#{config[:name]}/partitions/#{num}/state")[:data] state = JSON.parse(state_json) - critical "Topic '#{config[:name]}', unknown leader #{state['leader']}" unless brokers.include? state['leader'] - critical "Topic '#{config[:name]}', partition #{num} preferred replica is not #{replica[0]}" unless replica[0] == state['leader'] + critical "Topic '#{config[:name]}', partition #{num}: unknown leader #{state['leader']}" unless brokers.include? state['leader'] + critical "Topic '#{config[:name]}', partition #{num}: preferred replica is not #{replica[0]}" unless replica[0] == state['leader'] + critical "Topic '#{config[:name]}', partition #{num}: isr is not consistent" unless (replica - state['isr']).empty? && (state['isr'] - replica).empty? + critical "Topic '#{config[:name]}', partition #{num}: unknown isr #{state['isr'] - brokers}" unless (state['isr'] - brokers).empty? end end