Skip to content

Instantly share code, notes, and snippets.

@mwmitchell
Created March 23, 2021 22:01
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 mwmitchell/143546096d8654c9bc4c28bb63029550 to your computer and use it in GitHub Desktop.
Save mwmitchell/143546096d8654c9bc4c28bb63029550 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
NS=$(kubectl config view --minify --output 'jsonpath={..namespace}')
>&2 echo "namespace: ${NS}"
BROKER=$(kubectl get pods | grep broker | head -n1 | cut -d" " -f1)
>&2 echo "broker: ${BROKER}"
TOPICS=$(kubectl exec -ti $BROKER -- ./bin/pulsar-admin topics list $NS/_connectors | xargs -I {} | tr -d '"')
>&2 echo "topics:
$TOPICS"
for topic in $TOPICS
do
>&2 echo "stats for topic: $topic"
kubectl exec -ti $BROKER -- ./bin/pulsar-admin topics stats $topic
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment