Skip to content

Commit

Permalink
Downloading grafana dashboards from grafana central repo
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmayja committed Aug 27, 2024
1 parent 75b5517 commit 3943b0c
Show file tree
Hide file tree
Showing 19 changed files with 99 additions and 17,848 deletions.
4 changes: 2 additions & 2 deletions config/monitoring/alertmanager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ kind: Kustomization
labels:
- includeSelectors: true
pairs:
app.kubernetes.io/component: aerospike-alertmanager
app: aerospike-monitoring-stack-alertmanager
app.kubernetes.io/name: aerospike-alertmanager
app.kubernetes.io/component: alertmanager

resources:
- statefulset.yaml
Expand Down
2 changes: 1 addition & 1 deletion config/monitoring/alertmanager/service.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Service
metadata:
name: aerospike-monitoring-stack-alertmanager
name: alertmanager
spec:
ports:
- name: http
Expand Down
8 changes: 4 additions & 4 deletions config/monitoring/alertmanager/statefulset.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: aerospike-monitoring-stack-alertmanager
name: alertmanager
spec:
template:
spec:
Expand Down Expand Up @@ -32,12 +32,12 @@ spec:
name: alertmanager-data
securityContext:
fsGroup: 26
serviceAccountName: aerospike-monitoring-stack
serviceAccountName: aerospike-monitoring-stack-prometheus
volumes:
- name: alertmanager-data
persistentVolumeClaim:
claimName: alertmanager-data
claimName: aerospike-monitoring-stack-alertmanager-data
- name: alertmanager-conf
configMap:
defaultMode: 420
name: alertmanager-config
name: aerospike-monitoring-stack-alertmanager-config
30 changes: 30 additions & 0 deletions config/monitoring/grafana/config/download_files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh

# dashboards to download
# DASHBOARDS="<dashboard_id>:<revision> ..."
DASHBOARDS="16119:10 16115:7"

TARGET_DIR="/mnt/data"
mkdir -p "$TARGET_DIR"

for DASHBOARD in $DASHBOARDS; do
delimiter=':'

# Count the number of occurrences of the delimiter
count=$(echo "$DASHBOARD" | awk -F"$delimiter" '{print NF-1}')

if [ "$count" -eq 1 ]; then
# Split the string into two parts
ID=$(echo "$DASHBOARD" | cut -d"$delimiter" -f1)
REVISION=$(echo "$DASHBOARD" | cut -d"$delimiter" -f2)

URL=https://grafana.com/api/dashboards/$ID/revisions/$REVISION/download
FILENAME=$ID-"rev"$REVISION.json
curl -o "$TARGET_DIR/$FILENAME" "$URL"
else
echo "Error: The string must contain exactly one delimiter."
fi
done

echo "Downloaded files:"
ls -l "$TARGET_DIR"
Loading

0 comments on commit 3943b0c

Please sign in to comment.