Skip to content

Instantly share code, notes, and snippets.

@jazzl0ver
Last active November 26, 2019 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jazzl0ver/144b8880ddcaee7f3f0095a448cbd5ed to your computer and use it in GitHub Desktop.
Save jazzl0ver/144b8880ddcaee7f3f0095a448cbd5ed to your computer and use it in GitHub Desktop.
Nagios plugin to check Apache Kafka for unavailable partitions
#!/bin/bash
#
# Nagios plugin to check Apache Kafka for unavailable partitions
# Zookeeper comma separated addresses are required as a 1st parameter
#
# https://gist.github.com/jazzl0ver
#
ZK=$1
count=$(/bin/docker run --rm --entrypoint /bin/bash -e KAFKA_HEAP_OPTS="-Xmx128M" jazzl0ver/firecamp-kafka:2.3 /kafka/bin/kafka-topics.sh --zookeeper "$ZK" --describe --unavailable-partitions | wc -l)
if [ $count -eq 0 ]; then
echo "OK: all partitions are available | count=$count"
exit 0
else
echo "CRITICAL: $count unavailable partitions found | count=$count"
exit 2
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment