I really like Grafana. Not so long ago i had several (~10) dashboards, one for every host and this looked fine.
Also, i’m writing a Telegram bot with Grafana HTTP API integration, getting list of dashboards by /api/search and list of panels by /api/dashboards/db/<host>, and this is also OK.
Our company grows, number of hosts also increases, and i started to use templating and variables. Templating is cool.
But… How can i get list of available values for variable by HTTP API? And also, i use graphite.
In example below (python), i can only get metadata and only current value of variable:
in [54]: list_template = r’http://%grafana%/api/dashboards/db/%dashboard%’
In [55]: req = requests.get(list_template, headers={‘Authorization’: …}).json()
In [56]: req[‘dashboard’][‘templating’]
Out[56]:
{‘list’: [{‘allValue’: None,
‘current’: {‘text’: ‘prod-web-1’, ‘value’: ‘prod-web-1’},
‘datasource’: ‘graphite’,
‘hide’: 0,
‘includeAll’: False,
‘label’: ‘’,
‘multi’: False,
‘name’: ‘host’,
‘options’: ,
‘query’: ‘icinga2.*’,
‘refresh’: 1,
‘regex’: ‘/prod.*/’,
‘sort’: 3,
‘tagValuesQuery’: ‘’,
‘tags’: ,
‘tagsQuery’: ‘’,
‘type’: ‘query’,
‘useTags’: False}]}
I’m sorry, if i misposted or topic like that already existed (i tried to find!).