Alex Krzos e7f2e5c2cb Add cfme general performance dashboard, break apart openstack vs generic dashboards.
+ Added Grafana Port to install vars
+ Parameterized Per Process component of General Dashboard to allow much faster deployment of Dashboarding Per process components on machine types.
+ Graph Graphite/Carbon Metrics in Graphite Dashboard
+ Added a few more workers for CFME to collect on in collectd

Change-Id: I6cf0488332cc0aa9816f11e34fc7f0429ee17eb7
2016-03-14 13:23:09 -04:00

31 lines
1.0 KiB
Python
Executable File

#!/usr/bin/env python
import argparse
import json
def main():
"""Script used to fix panel ids in static dashboards. Typically adding a new panel or row into
a static dashboard will involve re-ordering all subsequent panels. This script automates that.
"""
parser = argparse.ArgumentParser(description="Fix panel ids in grafana json dashboard.")
parser.add_argument('inputfile', help='Input json file')
parser.add_argument('outputfile', help='Output json file')
args = parser.parse_args()
with open(args.inputfile) as data_file:
data = json.load(data_file)
index = 0
for row in data['dashboard']['rows']:
for panel in row['panels']:
index += 1
if index != panel['id']:
print "Found error in panel({}): {}".format(index, panel['title'])
panel['id'] = index
with open(args.outputfile, 'w') as outputfile:
json.dump(data, outputfile, sort_keys=True, indent=2, separators=(',', ': '))
if __name__ == "__main__":
main()