print(
        'You can find your token at https://app.sysdigcloud.com/#/settings/user'
    )
    sys.exit(1)

sdc_token = sys.argv[1]

#
# Instantiate the SDC client
#
sdclient = SdMonitorClient(sdc_token)

#
# Create Dashboard.
#
ok, res = sdclient.create_dashboard("Sample dashboard - " + uuid.uuid4().hex)

#
# Check for successful creation
#
if not ok:
    print(res)
    sys.exit(1)

dashboard = res['dashboard']

#
# Get Dashboard.
#
ok, res = sdclient.get_dashboard(dashboard['id'])
if len(sys.argv) != 4:
    usage()

URL = sys.argv[1]
APIKEY = sys.argv[2]
GUID = sys.argv[3]
DASHBOARD_NAME = 'IBM Cloud IAM with Python Client Example'
PANEL_NAME = 'CPU Over Time'

# Instantiate the client with an IBM Cloud auth object
ibm_headers = IbmAuthHelper.get_headers(URL, APIKEY, GUID)
sdclient = SdMonitorClient(sdc_url=URL, custom_headers=ibm_headers)

# Create an empty dashboard
ok, res = sdclient.create_dashboard(DASHBOARD_NAME)

# Check the result
dashboard_configuration = None
if ok:
    print('Dashboard %d created successfully' % res['dashboard']['id'])
    dashboard_configuration = res['dashboard']
else:
    print(res)
    sys.exit(1)

# Add a time series panel
panel_type = 'timeSeries'
metrics = [{
    'id': 'proc.name'
}, {
Esempio n. 3
0
if len(args) != 1:
    usage()

sdc_token = args[0]

#
# Instantiate the SDC client
#
sdclient = SdMonitorClient(sdc_token)

#
# Create an empty dashboard
#
dashboard_configuration = None
ok, res = sdclient.create_dashboard(dashboard_name)

# Check the result
if ok:
    print('Dashboard %d created successfully' % res['dashboard']['id'])
    dashboard_configuration = res['dashboard']
else:
    print(res)
    sys.exit(1)

#
# Find a dashboard by name
#
ok, res = sdclient.find_dashboard_by(dashboard_name)

# Check the result