Skip to content

Instantly share code, notes, and snippets.

@libkoi
Created January 14, 2023 22:18
Show Gist options
  • Save libkoi/40213d249e921befdde782ae7dcef82b to your computer and use it in GitHub Desktop.
Save libkoi/40213d249e921befdde782ae7dcef82b to your computer and use it in GitHub Desktop.
#!/bin/env bash
# Run this script everytime when modified the dashboard
# https://juejin.cn/post/7182369883462729783
url1=http://localhost:3000
url2=http://localhost:9090
key=[redacted]
mimirtool analyze grafana --address=$url1 --key=$key
mimirtool analyze prometheus --address=$url2 --grafana-metrics-file="metrics-in-grafana.json"
jq '.metricsUsed' metrics-in-grafana.json \
| tr -d '", ' \
| sed '1d;$d' \
| grep -v 'grafanacloud*' \
| paste -s -d '|' -
rm -f ./metrics-in-grafana.json ./prometheus-metrics.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment