Closed vsoch closed 2 years ago
Hi! I'm new to this project and Grafana, and I'm wondering if it's possible to reproduce:
generate-dashboard -o frontend.json example.dashboard.py
But from within Python. My use case is wanting to start with my data file, and have my own client to output the json file. E.g.,:
$ python myscript.py transform my-custom-input.cali # generates the final dashboard.json
Instead of needing to do:
$ python myscript.py transform my-custom-input.cali -> write temporary python file --> generate-dashboard
E.g., I can hack sys.argv and write my generated python file to a temporary location first (this bit)
... sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) sys.exit(generate_dashboard_script())
But it would be really nice to just generate that code, and then the json from the same script. Is this possible (and maybe I'm missing the docs for it somewhere?) thank you!
Yeah, there is an example of doing just that here:
https://github.com/weaveworks/grafanalib/blob/main/grafanalib/tests/examples/example.upload-dashboard.py
Perfect, thank you!
Hi! I'm new to this project and Grafana, and I'm wondering if it's possible to reproduce:
But from within Python. My use case is wanting to start with my data file, and have my own client to output the json file. E.g.,:
Instead of needing to do:
E.g., I can hack sys.argv and write my generated python file to a temporary location first (this bit)
But it would be really nice to just generate that code, and then the json from the same script. Is this possible (and maybe I'm missing the docs for it somewhere?) thank you!