Git Product home page Git Product logo

grafana-sync's Introduction

Hi there ๐Ÿ‘‹

๐Ÿ‘ท Check out what I'm currently working on

๐Ÿ”ญ Latest releases I've contributed to

๐Ÿ“œ My recent blog posts

๐Ÿ“ซ How to reach me

grafana-sync's People

Contributors

avorima avatar bjhartin avatar dependabot[bot] avatar mpostument avatar runz0rd avatar skynet2 avatar taraspos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

grafana-sync's Issues

[feature request] support pulling and pushing alerts

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!

cannot unmarshal number into Go struct field

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

Docker image for grafana-sync

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.

Sync specific dashboards

@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

pull & push with datasource CloudWatch breaks dashboards

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:

  1. Create a new dashboard and add a metric that exists in CloudWatch.
  2. save & copy and paste "json model" to a file. before.json.txt
  3. Pull the dashboard to a json using grafana-sync, see README. Nothing special.
  4. Push the dashboard from the json using grafana-sync, see README. Nothing special.
  5. THE DASHBOARD IS BROKEN
  6. copy and paste "json model" to a file. after.json.txt

before.json.txt
after.json.txt

"Broken" is defined as: The panel just shows blank. See

after_dashboard

Also the Annotations seems to be duplicated.

after_annotations

Also some things have been removed when diffing.

before_after_diff

This can be "fixed" as follows:

  • Click on edit on panel.
  • Now "refresh dashboard".
  • Grafana seems to be doing something, as now, values start to appear.

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.

Missing `--folderId` option?

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 for basic auth

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!

Support grafana-sync push-dashboards with the same folder

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,

Recursive directory push

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

Allow to specify the user when running the docker

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

Connect to HTTPS encrypted source not working

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

Error when syncing: cannot unmarshal object into Go struct field Board.panels

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?

version misconfiguration

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?

Dashboard extraction failures do not result in a failure (non-zero) exit code

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.