client health statistics
print('{0:25s}{1:1}{2:45s}{3:1}
{4:15s}'.format("Client Category", "|",\
"Number of Clients", "|", "Clients Score"))
print('-'* 95 )
for CLIENT in CLIENTS.response:
for score in CLIENT.scoreDetail:
print('{0:25s}{1:1}{2:<45d}{3:1}{4:
<15d}'.format(
score.scoreCategory.value, "|",
score.clientCount, "|", \
score.scoreValue))
print('-'* 95 )
First, this example imports the api class from
dnacentersdk. Next, it instantiates the api class and
creates a connection to the always-on Cisco DevNet
Sandbox DNA Center instance and stores the result of
that connection in a variable called DNAC. If the
connection was successfully established, the DNAC
object has all the API endpoints mapped to methods that
are available for consumption.
DNAC.devices.get_device_list() provides a list of all
the devices in the network and stores the result in the
DEVICES dictionary. The same logic applies to the
client health status.
DNAC.clients.get_overall_client_health(timesta
mp='1566506489000') returns a dictionary of health
statuses for all the clients at that specific time, which
translates to Thursday, August 22, 2019 8:41:29 PM
GMT. When the data is extracted from the API and
stored in the variables named DEVICES for all the
network devices and CLIENTS for all the client health
statuses, a rudimentary table is displayed in the console,
with select information from both dictionaries. For the
DEVICES variable, only the device name, device type,
and device uptime are displayed, and for the CLIENTS
variable, only the client health category, number of
clients, and client score for each category are displayed.