Loading dashboards from json file

This support forum board is for support questions relating to Nagios Log Server, our solution for managing and monitoring critical log data.
Locked
klg
Posts: 6
Joined: Mon Jul 22, 2019 7:57 am

Loading dashboards from json file

Post 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
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: Loading dashboards from json file

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Smithclr
Posts: 1
Joined: Sun Jan 05, 2020 10:08 pm

Re: Loading dashboards from json file

Post 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
fontvilla is a fancy text generator that provides you with several cute fonts
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Loading dashboards from json file

Post by Box293 »

Thanks for your follow up information with detailed examples @Smithclr .
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked