Query Cisco Catalyst Center
Query Cisco Catalyst Center (formerly DNA Center) with cnquery
Rely on cnquery to discover network devices managed by Cisco Catalyst Center (formerly known as Cisco DNA Center).
Requirements
To analyze and explore your Cisco Catalyst Center with cnquery, you must have:
- cnquery installed on your workstation.
- Network access to the Catalyst Center management interface.
- Valid credentials (username and password) for API authentication.
- A user account with appropriate permissions to access the Catalyst Center APIs.
Connect to Cisco Catalyst Center
To connect to a Cisco Catalyst Center instance:
cnquery shell ciscocatalyst catalyst.example.com --user admin --ask-passTo connect with the password provided directly:
cnquery shell ciscocatalyst catalyst.example.com --user admin --password 'your-password'Connection options
| Option | Description |
|---|---|
--user | Username for API authentication |
--password, -p | Password for API authentication |
--ask-pass | Prompt for the password |
Example queries
Once connected, you can query information from Cisco Catalyst Center.
This query retrieves information about managed network devices:
cnquery> ciscocatalyst.devices
ciscocatalyst.devices: [
0: ciscocatalyst.device hostname="switch1.example.com"
1: ciscocatalyst.device hostname="router1.example.com"
...
]This query retrieves detailed information about devices:
cnquery> ciscocatalyst.devices { hostname managementIpAddress platformId softwareVersion }
ciscocatalyst.devices: [
0: {
hostname: "switch1.example.com"
managementIpAddress: "192.168.1.10"
platformId: "C9300-48P"
softwareVersion: "17.3.4"
}
...
]Exit the cnquery shell
To exit the cnquery shell, either press Ctrl + D or type exit.
Learn more
-
To learn more about how the MQL query language works, read Write Effective MQL.
-
For more information about Cisco Catalyst Center, see the Cisco Catalyst Center documentation.