Use grafanalib to generate Grafana dashboards

This commit is contained in:
Arve Knudsen
2017-09-15 08:05:12 +02:00
parent 8bf449907c
commit d04cccc526
25 changed files with 3504 additions and 6831 deletions

View File

@@ -226,7 +226,7 @@ bin-pack-files() {
# the max size of the queue is limited by DATA_SIZE_LIMIT
# while there's room available in the queue we add files.
# when there's no room we create a configmap with the members of the queue
# before adding the file to a cleaned queue
# before adding the file to a cleaned queue
# Counters initialization is not in the scope of this function
local file=""
@@ -313,7 +313,7 @@ touch $GRAFANA_OUTPUT_FILE || { echo "ERROR: Unable to create or modify $GRAFANA
echo "# Starting execution of $SCRIPT_BASE on $DATE_EXEC"
echo "# Configured size limit: $DATA_SIZE_LIMIT bytes"
echo "# Grafna input dashboards and datasources will be read from: $DASHBOARDS_DIR"
echo "# Grafana input dashboards and datasources will be read from: $DASHBOARDS_DIR"
echo "# Grafana Dashboards ConfigMap will be created into file:"
echo "$OUTPUT_FILE"
echo "# Grafana Deployment manifest will be created into file:"

View File

@@ -1,13 +1,23 @@
#!/bin/bash
set -e
cat <<-EOF
apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-dashboards
name: grafana-dashboards-0
data:
EOF
virtualenv -p python3 .env
source .env/bin/activate
pip install -Ur requirements.txt
for f in assets/grafana/*.dashboard.py
do
JSON_FILENAME="$(pwd)/${f%%.*}-dashboard.json"
generate-dashboard $f -o $JSON_FILENAME 2>&1 > /dev/null
done
for f in assets/grafana/*-dashboard.json
do
echo " $(basename $f): |+"

View File

@@ -1,10 +1,11 @@
#!/bin/bash
set -e
# Generate Alert Rules ConfigMap
hack/scripts/generate-rules-configmap.sh > manifests/prometheus/prometheus-k8s-rules.yaml
# Generate Dashboard ConfigMap
#hack/scripts/generate-dashboards-configmap.sh > manifests/grafana/grafana-dashboards.yaml
hack/scripts/generate-dashboards-configmap.sh > manifests/grafana/grafana-dashboards.yaml
# Generate Dashboard ConfigMap with configmap-generator tool
# Max Size per ConfigMap: 240000