Skip to content

Instantly share code, notes, and snippets.

View stfclv's full-sized avatar

Stef Clairville stfclv

View GitHub Profile
@idooo
idooo / publish-kafka-metrics.sh
Last active October 26, 2023 07:09
Script to publish JMX metrics from Kafka broker to AWS Cloudwatch
#!/usr/bin/env bash
# Kafka utilises JMX to provide an access to some useful data
# This script uses command line JMX client to retrieve those metrics from a Kafka broker
# and publish them to AWS Cloudwatch
# JMX Client: http://crawler.archive.org/cmdline-jmxclient/downloads.html
# Runtime dependencies: Java, AWS CLI, IAM role attached to the instance with permissions
# to put Cloudwatch metrics
@ursuad
ursuad / kafka-cheat-sheet.md
Last active March 12, 2025 10:08
Quick command reference for Apache Kafka

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Describe a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...

@crisidev
crisidev / grafana-dashboard-exporter
Created October 7, 2015 20:35
Command to export all grafana 2 dashboard to JSON using curl
KEY=XXXXXXXXXXXX
HOST="https://metrics.crisidev.org"
mkdir -p dashboards && for dash in $(curl -k -H "Authorization: Bearer $KEY" $HOST/api/search\?query\=\& |tr ']' '\n' |cut -d "," -f 5 |grep slug |cut -d\" -f 4); do
curl -k -H "Authorization: Bearer $KEY" $HOST/api/dashboards/db/$dash > dashboards/$dash.json
done