| select value from "{series}" |
| host='{host}' and device='{device}' |
| def make_dashboard_file(config): |
| series = ['writes_completed', 'sectors_written'] |
| dashboard = dict(title=serie, type='graph', |
| span=12, fill=1, linewidth=2, |
| tooltip={'shared': True}) |
| for ip, devs in config.items(): |
| query=query.replace("\n", " ").format(**params).strip(), |
| alias="{0} io {1}".format(ip, device), |
| dashboard['targets'] = targets |
| dashboards.append(dashboard) |
| fc = open("grafana_template.js").read() |
| return fc % (json.dumps(dashboards),) |
| print make_dashboard_file({'192.168.0.104': ['sda1', 'rbd1']}) |