Network Change & Configuration Management

Reply
Highlighted

Best practice for querying connected end hosts...

JMcConnell
Techie
Posts: 11
3759     0

It appears that the End Hosts Present query (/api/2.9/spm_end_hosts_default_grids/index) is the only way to retrieve connected end host information, such as MAC address and dotted IP, yet there is no way to limit the size of the result set for this query (ours returns at 10000+ hosts), which is very expensive (30+ seconds on average) over the wire, aside from paging logic, etc.  I feel that I must be doing something wrong.  I should at least be able to filter it down to a particular switch, yes?  Also, a hierarchical diagram of the various objects in use by NA would be helpful too, if this exists.

Looking for any guidance...

John McConnell

Have your tried adding "

Expert
Posts: 180
3760     0

Have your tried adding "?limit=" to your query?

/api/2.9/spm_end_hosts_default_grids/index?limit=5

Or for a specific device add "&InfraDeviceID=" then add a valid id to the end.

The API Index page should have a listing of all the available attributes.

-Lon.

Take a look at the "End Host

Adviser
Posts: 357
3760     0

Take a look at the "End Host Mac Addresses" API, that may server your purposes better. They only issue would be that you need to lookup the switch DeviceID before using that API.

 

Thanks...

JMcConnell
Techie
Posts: 11
3760     0

Good call, but the particular call doesn't support adding InfraDeviceID or anything like it.  As I read it, I can only pass the following params:

  • starttime Optional DateTime, Default: today
    endtime Optional DateTime, Default: tomorrow
    start Optional Integer, Default: 0
    limit Optional Integer, Default: 1000

    sort Optional String, Default: id
  • Which doesn't limit anything really.  I'm familiar with the limit param, but this just increases the result set size...

​J

End Host Mac Addresses

JMcConnell
Techie
Posts: 11
3760     0

Yeah, I tried that as well, but unfortunately, no matter which device ID I query I get this:

<response>
<total type="int">0</total>
<start type="int">0</start>
<limit type="int">1000</limit>
<current type="int">0</current>
<end_host_mac_addresses type="array"></end_host_mac_addresses>
</response>
 

Which looks like an empty response to me...thoughts?

 

J

Try filtering by

Adviser
Posts: 357
3760     0

Try filtering by InfraDeviceID. The DeviceID in this table is the DeviceID of the host, not the switch.

 

InfraDeviceID

JMcConnell
Techie
Posts: 11
3760     0

Sorry, I should have been more clear.  The query:

https://hostname/api/2.9/end_host_mac_addresses/search/?InfraDeviceID=3

results in

<response>
<total type="int">0</total>
<start type="int">0</start>
<limit type="int">1000</limit>
<current type="int">0</current>
<end_host_mac_addresses type="array"></end_host_mac_addresses>
</response>
 

I've substituted in several DeviceIDs for this and all are empty results...here's a sample query result for device 3:

<device>
<DataSourceID type="int">0</DataSourceID>
<DeviceAddlInfo nil="true"/>
<DeviceAssurance type="int">99</DeviceAssurance>
<DeviceChangedCols>DeviceName,DeviceDNSName</DeviceChangedCols>
<DeviceDNSName>someswitch.domain.org</DeviceDNSName>
<DeviceEndTime nil="true"/>
<DeviceFirstOccurrenceTime type="datetime">2014-01-11 02:27:35</DeviceFirstOccurrenceTime>
<DeviceID type="int">3</DeviceID>
<DeviceIPDotted>10.99.99.10</DeviceIPDotted>
<DeviceIPNumeric type="int">169947402</DeviceIPNumeric>
<DeviceMAC>00:12:80:FF:2A:42</DeviceMAC>
<DeviceModel>catalyst37xxStack</DeviceModel>
<DeviceName>someswitch.domain.org</DeviceName>
<DeviceNetBIOSName nil="true"/>
<DeviceOUI>Cisco</DeviceOUI>
<DeviceStartTime type="datetime">2014-01-11 02:43:48</DeviceStartTime>
<DeviceSysContact/>
<DeviceSysDescr>
Cisco IOS Software, C3750 Software (C3750-IPSERVICESK9-M), Version 12.2(55)SE6, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2012 by Cisco Systems, Inc. Compiled Mon 23-Jul-12 13:22 by prod_rel_team
</DeviceSysDescr>
<DeviceSysLocation/>
<DeviceSysName>someswitch.domain.org</DeviceSysName>
<DeviceTimestamp type="datetime">2014-06-24 12:17:43</DeviceTimestamp>
<DeviceType>Switch</DeviceType>
<DeviceVendor>Cisco</DeviceVendor>
<DeviceVersion>12.2(55)SE6</DeviceVersion>
<InfraDeviceInd type="bool">true</InfraDeviceInd>
<MgmtServerDeviceID type="int">0</MgmtServerDeviceID>
<NetworkDeviceInd type="bool">true</NetworkDeviceInd>
<ParentDeviceID type="int">0</ParentDeviceID>
<VirtualInd type="bool">false</VirtualInd>
<_class>Device</_class>
</device>

Like I said, I feel like I'm doing something wrong...

J

Strange. So, if you just

Adviser
Posts: 357
3760     0

Strange. So, if you just leave out any criteria at all, do you get any results?

any results...

JMcConnell
Techie
Posts: 11
3760     0

Sadly no, but I'm now looking at the switch_port_fwds/index/ call, which seems to pull the data I need and can be limited to a particular device.  Thanks!

J

That will include all

Adviser
Posts: 357
3760     0

That will include all downstream MACs from a given port. So, for switch-switch interconnects (whether trunks or not), there will be all the downstream MACs in there. I think instead you should use Switch Forward Neighbors, which prunes out that data by looking at the entire spanning tree (this is the source of the data in several of these different tables).

From that API you'll need to

Adviser
Posts: 357
3760     0

From that API you'll need to use the NeighborID to get the Neighbor object which will contain the DeviceID and InterfaceID. In this neighbor relationship, the source device is the switch (DeviceID/InterfaceID), the neighbor device is the host (if it is in the discovery ranges).

 

Will give it a shot...!

JMcConnell
Techie
Posts: 11
3760     0

Thanks!  I appreciate the helpful advice!

J

Showing results for 
Search instead for 
Do you mean 

Recommended for You