1 ##############################################################################
2 # Copyright (c) 2018 Huawei Tech and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
13 def customize_query(filename, rowtitle, panelname, expr):
14 with open(filename, 'r+') as f:
16 x = data['rows'] # this is an array of the rows of the dashboard
18 if y['title'] == rowtitle:
20 for i in range(len(pan) - 1):
22 if z['title'] == panelname:
26 f.seek(0) # <--- reset file position to start
27 json.dump(data, f, indent=4)
31 customize_query("/home/opnfv/bottlenecks/monitor/custom-query-dashboard.json",
32 "Dashboard Row", "Memory Usage per Container",
33 "Sample Prometheus Query")