m110 / grafcli

Grafana CLI for quick and easy dashboards management.
MIT License
168 stars 20 forks source link

Bash *? wildcard support for remote resource export/import #20

Open jgoff opened 7 years ago

jgoff commented 7 years ago

hi Miłosz, So here is the basic working first version. No doubt there will be a bunch of stylistic concerns (in some cases I have steered clear of changing certain things that seem obvious to change, for example not hacking at 'list' rather just adding 'list_path').

Outside of the readme, I'll mention again my use case which is entirely batch mode. I use some dev machine to create dashboards, then export them out so they can be stored in SCM. Once in SCM (in the future will have a commit trigger to do this automagically), I push (import) them out to the production hosts, e.g.

` ./grafcli export remote/dev/* $SCMROOT/grafana/dashboards

for h in cat prod_hosts.txt; do ./grafcli import $SCMROOT/grafana/dashboards remote/$h done `

There are a few caveats listed in the Readme.md.

By all means suggest ways you would prefer to see this refactored or changed to fit your code base or code style, it's your project.

thx -jeff

damoun commented 6 years ago

Hi @m110, what's the state of this PR ? It would be great to have this feature.

m110 commented 6 years ago

Hey. Sorry for letting this hang so long. I had some plans to add the wildcard support for all commands at the time, but never found some time to work on it. I'll check if this still works as expected with master and we're good to go!