grafana-backup-tool
grafana-backup-tool copied to clipboard
Pretty JSON
For those of us who prefer text/json output (for example to use with source control) it would be useful for JSON files be prettified (and perhaps sorted somehow?) when written to disk.
I'm not too familiar with Python but my work around right now is to apply the json.tool (module?) to each file via a bash script, but I presume that means this can be rolled into the backup tool itself.
I've done just this in my own local copy of this tool. I should really fork the repo and do this properly as a pull request, but it was pretty simple if I remember correctly...
As the Grafana API is pretty decent I've since settled on a pure bash version of 15 lines. This is still a great tool for those who do not have access to curl and jq.
does the pretty_print option expect any python module to be present to work? i have it set to true in the conf file, and it doesn't create pretty_print output. using python 3.7 on a mac, did do 'pip install .' before running. not a big deal - could prettify with jq and not needed for post-processing, but would be nice for review.
{
"general": {
"debug": true,
"verify_ssl": true,
"backup_dir": "_OUTPUT_",
"backup_file_format": "%Y%m%d%H%M",
"pretty_print": true
},
The "pretty_print" option is working. May I humbly suggest adding it to the example config file and closing this issue?