jmxexporter-prometheus-grafana/cfk/update-dashboards.sh
#!/bin/bash
OUTPUT_DIR=dashboards
mkdir -p $OUTPUT_DIR
sed 's/\${Prometheus}//g;s/Environment/Namespace/g;s/env/namespace/g;s/label_values(namespace)/label_values(zookeeper_version, namespace)/g' ../assets/grafana/provisioning/dashboards/zookeeper-cluster.json > $OUTPUT_DIR/zookeeper-cluster.json
sed 's/\${Prometheus}//g;s/Environment/Namespace/g;s/env/namespace/g;s/label_values(namespace)/label_values(kafka_server_kafkaserver_brokerstate, namespace)/g;s/Instance/Pod/g;s/instance/pod/g;s/kafka-broker/kafka/g' ../assets/grafana/provisioning/dashboards/kafka-cluster.json > $OUTPUT_DIR/kafka-cluster.json
sed 's/\${Prometheus}//g;s/Environment/Namespace/g;s/env/namespace/g;s/label_values(namespace)/label_values(kafka_log_log_size, namespace)/g;s/instance/pod/g;s/kafka-broker/kafka/g' ../assets/grafana/provisioning/dashboards/kafka-topics.json > $OUTPUT_DIR/kafka-topics.json
sed 's/\${Prometheus}//g;s/Environment/Namespace/g;s/env/namespace/g;s/label_values(namespace)/label_values(kafka_server_kafkaserver_brokerstate, namespace)/g;s/Instance/Pod/g;s/instance/pod/g;s/kafka-broker/kafka/g' ../assets/grafana/provisioning/dashboards/kafka-quotas.json > $OUTPUT_DIR/kafka-quotas.json
sed 's/\${Prometheus}//g;s/Environment/Namespace/g;s/env/namespace/g;s/label_values(namespace)/label_values(kafka_schema_registry_registered_count, namespace)/g;s/instance/pod/g;s/schema-registry/schemaregistry/g' ../assets/grafana/provisioning/dashboards/schema-registry-cluster.json > $OUTPUT_DIR/schema-registry-cluster.json
sed 's/\${Prometheus}//g;s/Environment/Namespace/g;s/env/namespace/g;s/label_values(namespace)/label_values(kafka_connect_app, namespace)/g;s/Instance/Pod/g;s/instance/pod/g;s/kafka-connect/connect/g;s/kafka_connect_cluster_id/container/g;s/label_values(container)/label_values(kafka_connect_app, container)/g' ../assets/grafana/provisioning/dashboards/kafka-connect-cluster.json > $OUTPUT_DIR/kafka-connect-cluster.json
sed 's/\${Prometheus}//g;s/Environment/Namespace/g;s/env/namespace/g;s/Instance/Pod/g;s/instance/pod/g' ../assets/grafana/provisioning/dashboards/ksqldb-cluster.json > $OUTPUT_DIR/ksqldb-cluster.json
sed 's/\${Prometheus}//g;s/Environment/Namespace/g;s/env/namespace/g;s/label_values(namespace)/label_values(kafka_producer_app, namespace)/g;s/instance/pod/g;s/Hostname/Pod/g;s/hostname/pod/g' ../assets/grafana/provisioning/dashboards/kafka-producer.json > $OUTPUT_DIR/kafka-producer.json
sed 's/\${Prometheus}//g;s/Environment/Namespace/g;s/env/namespace/g;s/label_values(namespace)/label_values(kafka_consumer_app, namespace)/g;s/instance/pod/g;s/Hostname/Pod/g;s/hostname/pod/g' ../assets/grafana/provisioning/dashboards/kafka-consumer.json > $OUTPUT_DIR/kafka-consumer.json
sed 's/\${Prometheus}//g;s/Environment/Namespace/g;s/env/namespace/g;s/label_values(namespace)/label_values(kafka_server_kafkaserver_brokerstate, namespace)/g;s/Instance/Pod/g;s/instance/pod/g;s/kafka-broker/kafka/g;s/schema-registry/schemaregistry/g;s/kafka-connect/connect/g' ../assets/grafana/provisioning/dashboards/confluent-platform.json > $OUTPUT_DIR/confluent-platform.json
sed 's/\${Prometheus}//g;s/Environment/Namespace/g;s/env/namespace/g;s/label_values(namespace)/label_values(kafka_log_log_size, namespace)/g;s/instance/pod/g;s/kafka-broker/kafka/g' ../assets/grafana/provisioning/dashboards/cluster-linking.json > $OUTPUT_DIR/cluster-linking.json