Page 1 of 1
Loading dashboards from json file
Posted: Thu Dec 12, 2019 12:57 pm
by klg
Hello,
I was configuring my LS dashboards, and I noticed that a the the bottom of the load menu, there is an advanced button which would allow me to load a json to the dashboards. I was wondering if I could just drop a json file on the backend and have it automatically load all of my custom dashboards? If I can, I need to know how to format the json, where to put the file and what configurations may need to be changed.
Thanks in advance,
K
Re: Loading dashboards from json file
Posted: Thu Dec 12, 2019 2:53 pm
by mbellerue
If you need to see the JSON format, you can export an existing dashboard and take a look at it that way. It says it is exporting a blob file, but it's JSON. However, I don't think these are actually stored on the file system. It's just generating the JSON from the dashboard configuration.
Re: Loading dashboards from json file
Posted: Sat Jan 11, 2020 10:42 pm
by Smithclr
It seems to work for me. I have the same dashboardProviders section. In addition, I have the following key set:
Code: Select all
dashboardsConfigMaps:
default: "grafana-dashboard"
The value grafana-dashboard is the name of a ConfigMap in the same namespace. The content looks like this:
Code: Select all
apiVersion: v1
data:
gain-dashboard.json: "cut out for brevity"
kind: ConfigMap
metadata:
creationTimestamp: "2019-04-01T08:14:07Z"
name: grafana-dashboard
namespace: monitoring
resourceVersion: "1039344"
selfLink: /api/v1/namespaces/monitoring/configmaps/grafana-dashboard
uid: 1ec73781-5456-11e9-bfc8-42010a9c00b0
After deploying, I can see the following on the grafana container:
Code: Select all
$ kubectl -n monitoring exec -it grafana-68cddfcf4-kq9s5 ls /var/lib/grafana/dashboards/default
gain-dashboard.json
The content of gain-dashboard.json corresponds to the content loaded into the ConfigMap.
In addition is the the dashboardProviders file in the following location:
Code: Select all
$ kubectl -n monitoring exec -it grafana-68cddfcf4-kq9s5 ls /etc/grafana/provisioning/dashboards
dashboardproviders.yaml
Re: Loading dashboards from json file
Posted: Mon Jan 13, 2020 9:58 pm
by Box293
Thanks for your follow up information with detailed examples
@Smithclr .