88import os
99import sys
1010sys .path .insert (0 , os .path .join (os .path .dirname (os .path .realpath (sys .argv [0 ])), '..' ))
11- from sdcclient import SdcClient
11+ from sdcclient import SdMonitorClient
1212
1313
1414#
@@ -39,7 +39,7 @@ def usage():
3939#
4040# Instantiate the SDC client
4141#
42- sdclient = SdcClient (sdc_token )
42+ sdclient = SdMonitorClient (sdc_token )
4343
4444
4545#
@@ -77,10 +77,10 @@ def usage():
7777panel_name = 'CPU Over Time'
7878panel_type = 'timeSeries'
7979metrics = [
80- {'id' : 'kubernetes.pod .name' },
80+ {'id' : 'proc .name' },
8181 {'id' : 'cpu.used.percent' , 'aggregations' : {'time' : 'avg' , 'group' : 'avg' }}
8282]
83- scope = 'kubernetes.namespace.name = "dev" and kubernetes.replicationController .name = "cassandra"'
83+ scope = 'proc .name = "cassandra"'
8484ok , res = sdclient .add_dashboard_panel (dashboard_configuration , panel_name , panel_type , metrics , scope = scope )
8585
8686# Check the result
@@ -101,9 +101,9 @@ def usage():
101101 {'id' : 'host.hostName' },
102102 {'id' : 'cpu.used.percent' , 'aggregations' : {'time' : 'avg' , 'group' : 'avg' }}
103103]
104- sort_by = { 'metric' : 'cpu.used.percent' , 'mode' : ' desc'}
104+ sort_direction = ' desc'
105105limit = 10
106- ok , res = sdclient .add_dashboard_panel (dashboard_configuration , panel_name , panel_type , metrics , sort_by = sort_by , limit = limit )
106+ ok , res = sdclient .add_dashboard_panel (dashboard_configuration , panel_name , panel_type , metrics , sort_direction = sort_direction , limit = limit )
107107
108108# Check the result
109109if ok :
@@ -137,7 +137,7 @@ def usage():
137137#
138138# Remove a panel
139139#
140- ok , res = sdclient .remove_dashboard_panel (dashboard_configuration , 'CPU' )
140+ ok , res = sdclient .remove_dashboard_panel (dashboard_configuration , 'CPU Over Time ' )
141141
142142# Check the result
143143if ok :
0 commit comments