#net-device-discovery-get-iter

1 messages · Page 1 of 1 (latest)

open turret
#

Hi all,

I am trying to get this data from harvest into a configuration file so that it creates the metrics with this data. I don't see anything in the GIT repo regarding this record or it's REST equivalent in any of the example configuration files.

Any pointers or examples of folks implementing this configuration?

Basically I am looking for what would I put into the config file to make this work for both ONTAPI and REST and have a consistent metric that won't change when we cut over to REST.

I plan to make a dashboard querying this data so that we can see all the upstream devices we connect too as well as which devices connect to which switches so we can track any changes and/or project work we will need to do based on this data (to retire old switches, upgrade switch OS versions, etc)

What I am most interested in is:

node, node port, protocol, remote device, remote device interface, remote device version, discovered device, platform.

Thanks,

desert wren
#

Hi @open turret we can certainly collect net-device-discovery-get-iter via ONTAPI. I don't see a REST equivalent though.

ecurity login role show-ontapi -ontapi "net-device-discovery-get-iter"

ONTAPI Name: net-device-discovery-get-iter
CLI Command: network device-discovery show
security login role show-rest -commands "network device-discovery"
There are no entries matching your query.

Might be worth asking in the #1063542514780475493 channel if there is a REST equivalent

#

ah! found this

open turret
#

do you have any examples of the REST data, so that I can compare it against what I should put into the zapi metric yaml?

#

something with a cluster switch as well

desert wren
#

Looks like the REST mapping for net-device-discovery-get-iter was introduced in 9.11

open turret
#

I can't run the curl command because we use a cert and not a login to authenticate to the cluster for REST and ONTAPI activities

desert wren
#

curl can work with the cert too. Have you done that before?

open turret
#

I haven't with curl, no

desert wren
#

hmm I'm getting results that contradict the swagger - swagger says that api/network/ethernet/ports should return discovered_devices as of 9.12. My cluster is 9.15 and I get no discovered_devices but ONTAPI net-device-discovery-get-iter to the same cluster returns records

#

for the REST side, we should be able to get what we need via private CLI. Let me check

desert wren
#

How does this look? Below is an example of an exported metric (new line separated to make it easier to read)

net_device_labels{
  chassis_id = "84:80:2d:31:99:4b",
  cluster = "umeng-aff300-01-02",
  datacenter = "dc-1⚡️",
  discovered_device = "RTP-LF01-41QQ20.rtp.eng.netapp.com (84:80:2d:31:99:4b)",
  interface = "Eth101/1/10",
  name = "RTP-LF01-41QQ20.rtp.eng.netapp.com",
  node = "umeng-aff300-02",
  port = "e0M",
  protocol = "lldp",
  version = "Cisco Nexus Operating System (NX-OS) Software 9.3(11)\\nTAC support: http://www.cisco.com/tac\\nCopyright (c) 2002-2023, Cisco Systems, Inc. All rights reserved.",
} 1.0
#

I've got a meeting in 8m, let me know what you think about the above and we can continue discussion tomorrow. If you want to try the zapi template, I've pasted it below

name:                       NetDeviceDiscovery
query:                      net-device-discovery-get-iter
object:                     net_device

counters:
  net-device-discovery-info:
    - ^^node                      => node
    - ^^port                      => port
    - ^^protocol                  => protocol
    - ^^discovered-device         => discovered_device
    - ^^interface                 => interface
    - ^system-name               => name
    - ^version                   => version

collect_only_labels: true

export_options:
  instance_keys:
    - node
    - port
    - protocol
    - discovered_device
    - interface
  instance_labels:
    - name
    - version
open turret
#

sorry, had to go to an appointment. This looks good. If we could get this same from REST and ONTAPI that would be great

#

if you send me the curl call (that uses certs) for REST, I can test that as well

wicked brook
#

$curl --cert client.crt --key client.key --cacert ca.crt https://cluster.local

#

REST Endpoint network/ethernet/ports is working for me. System is running 9.14.1P8, CDP and LLDP activated.

desert wren
#

thanks @wicked brook

#

network/ethernet/ports was not returning discovered_devices for me because the user did not have sufficient RBAC permission - it took me a bit to figure out since there are not errors and the endpoint returns the things the user does have permissions for. The only thing missing was the discovered_devices section

desert wren
#

Here's a REST template that exports metrics in the same format as the ZAPI template above

name:                       NetDeviceDiscovery
query:                      api/private/cli/network/device-discovery
object:                     net_device

counters:
    - ^^node                      => node
    - ^^port                      => port
    - ^^protocol                  => protocol
    - ^^discovered_device         => discovered_device
    - ^^interface                 => interface
    - ^system_name                => name
    - ^version                    => version

export_options:
  instance_keys:
    - node
    - port
    - protocol
    - discovered_device
    - interface
  instance_labels:
    - name
    - version
#

if you are using a least-privileged user to monitor your cluster, you will also need to add these permissons

security login role create -role harvest2-role -access readonly -cmddirname "network device-discovery show"
security login rest-role create -role harvest-rest-role -access readonly -api /api/private/cli/network/device-discovery
open turret
#

we have read-only enabled for the user on all api calls, no limitations