Skip to content

Commit 2393482

Browse files
author
Phil Rzewski
committed
At Kini's request, revert "Enhanced restore capability". Too much original dashboard config was stripped.
This reverts commit a4caff7.
1 parent aff3b58 commit 2393482

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

examples/restore_dashboards.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,23 @@
2828

2929
zipf = zipfile.ZipFile(dashboard_state_file, 'r')
3030

31+
32+
dashboard_conf_items = ['showAsType', 'filterRoot', 'linkMetrics',
33+
'singleTimeNavigation', 'gridConfiguration', 'responsive',
34+
'nodesNoiseFilter', 'compareWith', 'format', 'linksNoiseFilter',
35+
'filterProcesses', 'isLegendExpanded', 'inhertitTimeNavigation',
36+
'schema', 'sortAscending', 'mapDataLimit', 'metrics', 'filterExtNodes',
37+
'sorting', 'name', 'sourceExploreView', 'items', 'showAs', 'eventsFilter',
38+
'timeMode', 'isShared', 'sourceDrilldownView']
39+
3140
for info in zipf.infolist():
3241
data = zipf.read(info.filename)
33-
dboard = json.loads(data)
34-
35-
dboard['timeMode'] = {'mode' : 1}
36-
dboard['time'] = {'last' : 2 * 60 * 60 * 1000000, 'sampling' : 2 * 60 * 60 * 1000000}
37-
38-
# Single filter support for all restored dashboards
39-
# TODO: add support to get filter from saved dashboard
40-
dashboardFilter = "proc.name = cassandra"
41-
res = sdclient.create_dashboard_from_template(dboard['name'] + '-restored', dboard, dashboardFilter)
42+
j = json.loads(data)
43+
k = {}
44+
for item in j.keys():
45+
if item in dashboard_conf_items:
46+
k[item] = j[item]
47+
48+
res = sdclient.create_dashboard_with_configuration(k)
4249
if res[0] == False:
4350
print "Dashboard creation failed for dashboard name %s with error %s" % (j['name'], res[1])

0 commit comments

Comments
 (0)