|
28 | 28 |
|
29 | 29 | zipf = zipfile.ZipFile(dashboard_state_file, 'r') |
30 | 30 |
|
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 | | - |
40 | 31 | for info in zipf.infolist(): |
41 | 32 | data = zipf.read(info.filename) |
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) |
| 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) |
49 | 42 | if res[0] == False: |
50 | 43 | print "Dashboard creation failed for dashboard name %s with error %s" % (j['name'], res[1]) |
0 commit comments