Is it possible to do a command line (CLI) discovery of devices in Spectrum?
search cancel

Is it possible to do a command line (CLI) discovery of devices in Spectrum?

book

Article ID: 125433

calendar_today

Updated On:

Products

Spectrum Network Observability

Issue/Introduction

The following describes how to run a scripted discovery of multiple devices via the Spectrum vnmsh CLI

Environment

DX NetOps Spectrum all releases

Resolution

A command line discovery of devices would need to be scripted using a similar approach to the following:

  1. Create a list of IP addresses to discover, then write a script to discover each individual IP in the list.
    For example, the list of IP addresses would be one IP (or range) per line:

    192.x.x.4
    192.x.x.8
    192.x.x.10–192.x.x.23
    192.x.x.27
    192.x.x.32

  2. Let’s say the filename for this list is “ip_list.txt”. The script would look something like the following:

    #!/bin/sh

    ./connect

    for IP in ‘cat ip_list.txt’

    do

    ./create model ip=$IP comm=public

    done

    ./disconnect

  3. If the subsequently discovered devices need to be placed in a specific container, then modify the script to grab the model handle of the newly created device and add the create associationto associate the new model to the container:

    ./create association rel=staticGlobalCollects rmh=<mh of GlobalCollection> mh=<mh of device>

     

    For example:

    device model handle: 0x10000d1

    GC model handle:     0x100012d

     

    With the above two model handles the command would look like the following:

    ./create association rel=staticGlobalCollects rmh=0x100012d lmh=0x10000d1