Skip to content

Instantly share code, notes, and snippets.

@sortega
Created January 7, 2021 16:56
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 sortega/bc02b95806d90bc030ba05d4f8c2edbb to your computer and use it in GitHub Desktop.
Save sortega/bc02b95806d90bc030ba05d4f8c2edbb to your computer and use it in GitHub Desktop.
Export connect status to CSV
#!/bin/bash
CONNECT_URL=${1:-${CONNECT_URL:-http://localhost:8083}}
CONNECTOR_LIST=$(curl -s -L -X GET $CONNECT_URL/connectors | jq -r '.[]')
for CONNECTOR in $CONNECTOR_LIST; do
curl -s -L -X GET $CONNECT_URL/connectors/$CONNECTOR/status \
| jq -r "(.tasks[] | [\"task\", \"$CONNECTOR\", .id, .state, .worker_id]), [\"connector\", \"$CONNECTOR\", .type, .connector.state, .connector.worker_id] | @csv" &
done
wait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment