Network

Query Arista EOS Devices

Query Arista EOS network devices with cnquery

Rely on cnquery to query configuration and operational data from Arista EOS network devices. Discover interfaces, users, VLANs, NTP settings, and more across your network infrastructure.

Requirements

To analyze and explore your Arista EOS devices with cnquery, you must have:

API setup instructions

Enable the Arista HTTPS API

If the API is not yet enabled, SSH to the device and configure it. For DEVICE_IP, substitute the IP address of the device:

ssh admin@DEVICE_IP

Then enable the management API. For NEW_SECRET, substitute a password of your choice:

localhost> enable
localhost# config t
localhost(config)# username admin secret NEW_SECRET
localhost(config)# management api http-commands
localhost(config-mgmt-api-http-cmds)# no shutdown
localhost(config-mgmt-api-http-cmds)# copy run start
Copy completed successfully.

For information on SSH key access to Arista devices, read SSH login without password in the Arista community.

Connect to an Arista EOS device

To connect to an Arista EOS device using password authentication:

cnquery shell arista admin@DEVICE_IP --ask-pass

To provide the password directly:

cnquery shell arista admin@DEVICE_IP --password 'your-password'

Connection options

OptionDescription
--password, -pPassword for authentication
--ask-passPrompt for the password

Example queries

Once connected to an Arista EOS device, you can query device configuration and state.

This query retrieves NTP synchronization status:

cnquery> arista.eos.ntp.status
arista.eos.ntp.status: "synchronised"

This query lists all configured VLANs:

cnquery> arista.eos.vlans { id name status }
arista.eos.vlans: [
  0: {
    id: 1
    name: "default"
    status: "active"
  }
  ...
]

This query lists local user accounts:

cnquery> arista.eos.users { username privilege }
arista.eos.users: [
  0: {
    username: "admin"
    privilege: 15
  }
  ...
]

This query retrieves interface information:

cnquery> arista.eos.interfaces { name bandwidth }
arista.eos.interfaces: [
  0: {
    name: "Ethernet1"
    bandwidth: 1000000000
  }
  ...
]

This query checks the running configuration for a specific setting:

cnquery> arista.eos.runningConfig.content.lines.one(_ == "logging on")
true

Exit the cnquery shell

To exit the cnquery shell, either press Ctrl + D or type exit.

Learn more

On this page