kube-prometheus: remove duplication in grafana dashboards

Datasource links were duplicated in the grafana dashboads. This now also
allows exporting grafana dashboards from the UI and just dropping them
into the assets directory and they will be wrapped by the manifest
generation script.
This commit is contained in:
Frederic Branczyk
2017-03-13 12:08:30 +01:00
parent 9ed63f191f
commit d9086e9875
8 changed files with 6689 additions and 6714 deletions

View File

@@ -8,7 +8,13 @@ metadata:
data:
EOF
for f in assets/grafana/*
for f in assets/grafana/*-dashboard.json
do
echo " $(basename $f): |+"
hack/scripts/wrap-dashboard.sh $f | sed "s/^/ /g"
done
for f in assets/grafana/*-datasource.json
do
echo " $(basename $f): |+"
cat $f | sed "s/^/ /g"

View File

@@ -8,12 +8,10 @@
# has error.
# * Download dashboard specification as JSON file in Grafana:
# Share -> Export -> Save to file.
# * Wrap dashboard specification to make it digestable by kube-prometheus:
# ./hack/scripts/wrap-dashboard.sh Nodes-1488465802729.json
# * Replace dashboard specification:
# * Drop dashboard specification in assets folder:
# mv Nodes-1488465802729.json assets/grafana/node-dashboard.json
# * Regenerate Grafana configmap:
# ./hack/scripts/generate-configmaps.sh
# ./hack/scripts/generate-manifests.sh
# * Apply new configmap:
# kubectl -n monitoring apply -f manifests/grafana/grafana-cm.yaml
@@ -22,17 +20,16 @@ if [ "$#" -ne 1 ]; then
exit 1
fi
json=$1
temp=$(tempfile -m 0644)
dashboardjson=$1
cat >> $temp <<EOF
cat <<EOF
{
"dashboard":
EOF
cat $json >> $temp
cat $dashboardjson
cat >> $temp <<EOF
cat <<EOF
,
"inputs": [
{
@@ -46,5 +43,3 @@ cat >> $temp <<EOF
}
EOF
mv $temp $json