-
What Grafana version and what operating system are you using?
Grafana OSS 11.0 -
What are you trying to achieve?
I am trying to sync two different grafana instances having different grafana.db. -
How are you trying to achieve it?
Export dashboards using HTTP API.
Check them in GIT
Merge to dev branch (PR closed)
From dev to prod (PR Opened)
Merge dev to prod
Trying to sync here Dev and Prod instances -
What happened?
-
What did you expect to happen?
-
Can you copy/paste the configuration(s) that you are having problems with?
-
Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
-
Did you follow any online instructions? If so, what is the URL?
i would go with provisioning
I tried this but I have some observations where your help can add to my knowledge.
Steps:
Exported JSON using UI
Placed exported json from Dev cluster to prod cluster provisioning folder. I was able to see msg=“saving new dashboard” in logs but when visualized in UI, nothing was displayed, NO KQL query from original exported json was imported. On further checking the logs, I found
msg=“failed to parse user ID” namespaceID=user userID=0 error=“identifier is not initialized”. I really don know what it means
Exported JSON using HTTP API
When I tried to provision dashboard using json exported using HTTP API, it never got into system and was throwing error as msg="failed to load dashboard from " file=/etc/grafana/provisioning/dashboards/Testing.json error=“Dashboard title cannot be empty”
My questions:
Is it expected to have different behavior for HTTP exported json and UI exported json?
My use case needs to use mix of both to automate process to some extent.
any best practices kind of document or any example project around provisioning can also help or anything related to possible reasons of different log messages can also help me keep exploring.
Sorry for long message, I am still trying to learn and exploring different different offerings by Grafana.
Did you fully read the linked documentation for provisioning?
I been through the Dashboard section of this link and trying to achieve provisioning from Dev to Prod Grafana instance but it does not work the way I expected, obliviously I am missing on something important here.
I been through documentation again and another thing of my interest is Data Sources but I did not try to provision these because in prod environment, I have these set already from UI. Since these will not change or changes will be very less frequent, I did not feel the need to provision them. Hope these thoughts are not the culprit in my scenario.
I still can see dashboard exported using REST API does not provision at all and fails with error file=/etc/grafana/provisioning/dashboards/Testing.json error=“Dashboard title cannot be empty”
I am sorry if I am asking for too much of help here but this is my current situation where I am stuck and really need guidance.
what does title look like in provision file
Grizzly seems to be a good option to explore
Thanks for the suggestion. I Just went through the introduction and seems like a solution to problem at hand. Let me explore it and do a POC around it.
Hi yosiasz,
can you please point out if there is an error in exported JSON file.
from docu
apiVersion: 1
providers:
# <string> an unique provider name. Required
- name: 'a unique provider name'
# <int> Org id. Default to 1
orgId: 1
# <string> name of the dashboard folder.
folder: ''
# <string> folder UID. will be automatically generated if not specified
folderUid: ''
# <string> provider type. Default to 'file'
type: file
# <bool> disable dashboard deletion
disableDeletion: false
# <int> how often Grafana will scan for changed dashboards
updateIntervalSeconds: 10
# <bool> allow updating provisioned dashboards from the UI
allowUiUpdates: false
options:
# <string, required> path to dashboard files on disk. Required when using the 'file' type
path: /var/lib/grafana/dashboards
# <bool> use folder names from filesystem to create folders in Grafana
foldersFromFilesStructure: true
does yours sort of is similar with sample from docu?
I could achieve the flow, I needed. Below are the steps:
- Data Sources: I updated data sources UID from one instance to match with another instances by using PUT HTTP API to update existing data sources.
- REST API Exported JSON needed some changes to work with provisioning. Changes are:
- Remove meta field from JSON and remove top level { }. I can automate this process using some scripting language. - Place updated JSON file in provisioning folder and it loads dashboard correctly.
Please close this thread.