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 ##############################################################################
12 def customize_query(filename, rowtitle, panelname, expr):
13 with open(filename, 'r+') as f:
15 x = data['rows'] #this is an array of the rows of the dashboard
17 if y['title'] == rowtitle:
19 for i in range(len(pan)-1) :
21 if z['title'] == panelname:
25 f.seek(0) # <--- reset file position to start
26 json.dump(data, f, indent=4)
29 customize_query("/home/opnfv/bottlenecks/monitor/custom-query-dashboard.json",
30 "Dashboard Row", "Memory Usage per Container", "Sample Prometheus Query")