else:
    print(res)
    sys.exit(1)

# Add a time series panel
panel_type = 'timeSeries'
metrics = [{
    'id': 'proc.name'
}, {
    'id': 'cpu.used.percent',
    'aggregations': {
        'time': 'avg',
        'group': 'avg'
    }
}]
ok, res = sdclient.add_dashboard_panel(dashboard_configuration, PANEL_NAME,
                                       panel_type, metrics)

# Check the result
if ok:
    print('Panel added successfully')
    dashboard_configuration = res['dashboard']
else:
    print(res)
    sys.exit(1)

# Remove the time series panel
ok, res = sdclient.remove_dashboard_panel(dashboard_configuration, PANEL_NAME)

# Check the result
if ok:
    print('Panel removed successfully')
示例#2
0
#
panel_name = 'CPU Over Time'
panel_type = 'timeSeries'
metrics = [{
    'id': 'proc.name'
}, {
    'id': 'cpu.used.percent',
    'aggregations': {
        'time': 'avg',
        'group': 'avg'
    }
}]
scope = 'proc.name = "cassandra"'
ok, res = sdclient.add_dashboard_panel(dashboard_configuration,
                                       panel_name,
                                       panel_type,
                                       metrics,
                                       scope=scope)

# Check the result
if ok:
    print('Panel added successfully')
    dashboard_configuration = res['dashboard']
else:
    print(res)
    sys.exit(1)

#
# Add a top bar chart
#
panel_name = 'CPU by host'