mpostument / grafana-sync Goto Github PK
View Code? Open in Web Editor NEWKeep your Grafana dashboards in sync
License: Apache License 2.0
Keep your Grafana dashboards in sync
License: Apache License 2.0
Hello @mpostument ! This tool looks quite exactly what I was looking for. I would like to use it in the k8s context and was wondering if you are interested in publishing a container?
If not, I'll build one myself (probably based on alpine), but maybe you want to contribute "an official" one.
Hello!
I want to pull Dashboards/Folders from an https encrypted source. Unfortunatly this is not working.
I'm getting this error when i pull-folders
Pull folders command failed invalid character '<' looking for beginning of value
Trying to pull from Home Assistant Grafana plugin.
The port is defined and forwarding is turned on.
When I open the URL https://example.tld:port
in my browser I get forwarded to https://example.tld:port/api/hassio_ingress/<something>/login
.
Cheers,
Matthias
Hi, I've been trying the following command:
grafana-sync pull-folders --apikey="eyJrIjoiOWJYTktGNFlCbFVMOG1LY3d6ekN4Mmw4MFgyYU44a1UiLCJuIjoiY29icmEiLCJpZCI6MX0=" --directory="folders" --url http://127.0.0.1:3000 --folderId=1
which returns this error:
Error: unknown flag: --folderId
Usage:
grafana-sync pull-folders [flags]
Flags:
-h, --help help for pull-folders
Global Flags:
-a, --apikey string Grafana api key
--config string config file (default is $HOME/.grafana-sync.yaml)
-d, --directory string Directory where to save dashboards (default ".")
-u, --url string Grafana Url with port (default "http://localhost:3000")
unknown flag: --folderId
Could the --folderId
option not be supported yet?
Thanks!
Support pulling and pushing Grafana alert definitions. Currently I'm hitting this endpoint /api/ruler/grafana/api/v1/rules/
on my Grafana installation directly, but it would be awesome to have this baked into grafana-sync
!
Let me know if it's something super easy that I can look into (golang noob here). Thank you!
Hi @mpostument ,
I'm trying to use your tool. The problem that all my dashboard want to sync have a tag ="sync" and put into the folder called "sync_folder"
I can pull all dashboards with tag==sync
./grafana-sync pull-dashboards --apikey="*******" --directory="dashboards" --url http://grafana-dev.dev.jpe2.net --tag=sync
All of them will save in folder dashboards/sync
I used this command to push them into stg env:
./grafana-sync push-dashboards --apikey="*****" --directory="dashboards/sync" --url http://grafana-stg.stg.jpe2.net
But they are in General folder not in "sync_folder"
I tried to create "sync_folder" in stg env but no luck.
Can we support this case?
Thank you,
When I run:
grafana-sync pull-dashboards --apikey=GRAFANA_API_KEY --directory=dashboards --url=GRAFANA_URL
Some dashboards cannot be retrieved (for which I may raise another issue). See:
2022/01/05 09:49:16 unmarshal board: json: cannot unmarshal object into Go struct field Board.panels of type string for db/dashboard1
The exit code is still 0, however. I had build an automated job to backup the dashboards and it has been 'green' despite these failures because the exit code from grafana-sync was 0. Can this be changed?
I download archive with 1.4.10 version, but if I run grafana-sync --version, I get version is 1.4.6
Is it just problem with version showing or in it real 1.4.6?
@mpostument
Can you help to implement the function to pull dashboards with specific folders? We'd like to pull some specific folders for the sync action.
Thank you
Current situation:
darwin_x86_64
is built (for mac)darwin_arm64
as architectureLet me know whether this is a 2 mins thing, whether it is super complicated and whether maybe I should look for myself :).
Looks like pull does not support "library-panels", from web ui it is separate flag during exporting "Export for sharing externally". Is it something that easy fix or not?
Hello,
I want support added for authenticating with username and password, so that people who don't have permissions to create API keys can still make use of this program in restricted Grafana instances.
Thanks!
Hello,
Thank you for Grafana-sync, but I faced this issue during sync my dashboards:
2021/03/05 11:46:32 unmarshal board: json: cannot unmarshal number into Go struct field Board.panels of type string for db/kubernetes-networking-namespace-pods
2021/03/05 11:46:32 unmarshal board: json: cannot unmarshal number into Go struct field Board.panels of type string for db/kubernetes-networking-pod
2021/03/05 11:46:34 unmarshal board: json: cannot unmarshal object into Go struct field TemplateVar.templating.list.query of type string for db/loki-quick-search
2021/03/05 11:46:36 unmarshal board: json: cannot unmarshal object into Go struct field TemplateVar.templating.list.query of type string for db/services-overview
Here is a gist with dashboards https://gist.github.com/ingvarch/51ef3022738d3b9011b2ce802a605aaf
I use :
Grafana v7.4.2 (29e75ad97b)
Grafana-sync - 1.1.0
To pull my dashboards, I use:
docker run --rm \
--volume "$(pwd)/grafana-dash:/data" \
--network "monitor-net" \
ghcr.io/mpostument/grafana-sync:1.4.10 \
pull-dashboards --apikey="<...>" --directory="/data" --url http://grafana:3000
But this creates a folder owned by root and require to chown it.
What I would like is to have the ability to specify the user as a parameter to the docker run, like:
$ docker run --rm \
--volume "$(pwd)/grafana-dash:/data" \
--network "monitor-net" \
--user 1000:1000 \
ghcr.io/mpostument/grafana-sync:1.4.10 \
pull-dashboards --apikey="<...>" --directory="/data" --url http://grafana:3000
2023/02/02 17:33:43 Pull dashboards command failed open /data/docker-containers.json: permission denied
We have more going on, but I am restricting this PR to the essence. What I am describing here works perfectly for the datasource Prometheus. Also copy & paste from "json model" via WebUI seems to work fine. It seems that some options (default options or so) are not synced correctly.
Steps to reproduce:
before.json.txt
after.json.txt
before.json.txt
after.json.txt
"Broken" is defined as: The panel just shows blank. See
Also the Annotations seems to be duplicated.
Also some things have been removed when diffing.
This can be "fixed" as follows:
Using Grafana v9.1.0. Deployed as part of prometheus-operator on k8s.
This could be an issue with Grafan itself, but could also be some "default value not sync"-optimization or so.
Would be great to get some insights, let me know where I can help.
Recursive directory push
Hello. Thanks a lot for you tool. I would like to see in it the ability to recursively push directories and maybe even dashboards.
Example:
grafana-sync pull-dashboards --apikey=${API_KEY} --directory="dashboards/*" --url http://127.0.0.1:3000
Structure directory:
|-dashboards
|---Database
|---Main
|---Service
In latest Grafana version, we longer has the API Keys
available. Was wondering if there is a hack/update to make this amazing tool to work with the alternative "ServiceAccounts bearer tokens"
Using grafana-sync I receive this error on a specific dashboard:
/ # grafana-sync pull-dashboards --apikey="..." --directory=dashboards --url https://emonitor1.place6.ungleich.ch
2022/02/05 12:08:18 unmarshal board: json: cannot unmarshal object into Go struct field Board.panels of type string for db/uplink-monitoring-2022
Does it help if I paste the dashboard json in here?
Hey!
I was wondering if there is an "official" docker image? Is it by any chance https://hub.docker.com/layers/eyalfirst/grafana-sync/1.4.4/images/sha256-105026f7c1564458824aabede70329784a0cf77d3ef50ca6a2aa1e393f145b9b?context=explore ?
If yes, can we document it in the repo?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.