It would be easy to write a script that scrapes kafka-topics.sh output and
compute the topic-partitions that are out of sync. However, in my
experience underreplicated partition count and topic-partitions out of sync
are both very noisy signals. There is also expandisrpersec and
shrinkisrpersec jmx means that can be useful but that is not very intuitive.

At least in 0.9.0.1, the way replicas are calculated to be out of sync is
based on time. Basically, it checks for the last time a given replicas' log
end offset were in sync with the leader and if it is more than some
threshold, kick the replica out of isr. The problem with this approach is
that if you have a lot of producers writing to a topic, there will never be
quiet time for replicas to catch up. The behavior you will get is, that the
replicas will constantly be kicked out and joined in.

--
MP

On Tue, Jul 19, 2016, 7:54 AM Tom Crayford <tcrayf...@heroku.com> wrote:

> Anderson,
>
> The metric `UnderReplicatedPartitions` gives you the number of partitions
> that are out of the ISR, but doesn't expose that per topic-partition. I'd
> welcome the addition of that metric to Kafka (it shouldn't be that much
> work in the source code I don't think), and I think others would as well.
> For now though, you can get this by crawling zookeeper to figure out the
> ISR.
>
> Thanks
>
> Tom
>
> On Tue, Jul 19, 2016 at 11:46 AM, Anderson Goulart <
> anderson.goul...@boxever.com> wrote:
>
> > Hi,
> >
> > I am trying to monitor under replicated partitions to create an alert
> > based on this metric. I want to get by topic,partition how many replicas
> > are out-of-sync, compared to the replication factor, instead of a boolean
> > value.
> > So someone can get an alert like:
> >
> > Topic A, partition 0, has 2/3 out of sync replicas
> >
> > 3 = replication factor
> >
> >
> > Is there anyway to get this info?
> >
> >
> > thanks, anderson
> >
> >
> >
>

Reply via email to