Learn How We Can Help You Keep Teleworkers Protected During the COVID-19 Crisis

API & Integration

Reply
Highlighted
Accepted Solution

REST Query - Network Gear to Hostname

Techie
Posts: 2
8068     0

Hi community, I am asked to extract if possible relationships between Network Gear to Server Hosts from InfoBlox NetMRI. Ideally, the REST response would provide the following information Switch name | Switch IP | Port Number | Hostname | Host IP. Is that doable? Thanks!

Highlighted

Re: REST Query - Network Gear to Hostname

Adviser
Posts: 353
8069     0
Yes, certainly. If you are just interested in switch ports, then you can use the switch port manager APIs. If you are interested in the uplinks and/or router connections, you need to use the topology APIs which are a little more complex.

See the following:

End Hosts Present
This is the data from Network Explorer > Switch Port Mgmt > End Hosts > End Hosts Present. This probably contains what you want. The only issue with this is it is prepared specially for those screens, so it collapses any changes for a given end host for the day into a single entry - that is, it shows the most recent port even if the thing changed ports a few times. Probably not an issue for servers Smiley Happy
https://your-netmri/api/3/spm_end_hosts_default_grids/docs

End Host MAC Addresses
This is raw data used to construct the above. It will contain every revision, but you have to follow the ID links to get the various details.
https://your-netmri/api/3/end_host_mac_addresses/docs

Neighbor Data
These are raw neighbor data used to construct above as well as all topology screens in the product.
https://your-netmri/api/3/neighbors/docs
https://your-netmri/api/3/switch_fwd_neighbors/docs
https://your-netmri/api/3/lldp_neighbors/docs
https://your-netmri/api/3/cdp_neighbors/docs
https://your-netmri/api/3/serial_neighbors/docs
https://your-netmri/api/3/rev_switch_fwd_neighbors/docs

John
Highlighted

Re: REST Query - Network Gear to Hostname

Techie
Posts: 2
8069     0
The spm_end_hosts_default_grids endpoint looks very promising in providing the data I was looking for. Thanks for sharing.
Highlighted

Re: REST Query - Network Gear to Hostname

Techie
Posts: 2
8069     0

Hi Belamaric,

 

We have tried using the below IP to get the details of the connceted host form Switch Port Manager.

 

https://netmri-host-name/api/3/spm_end_hosts_default_grids/index?start=0&limit=1&NeighborIPDotted=%22IPAddress1%22

 

Although the above URL gives the detailed information, it always results the same data irrespective of the supplied IP address in the URL.

 

https://netmri-host-name/api/3/spm_end_hosts_default_grids/index?start=0&limit=1&NeighborIPDotted=%22IPAddress2%22

 

 

Even I tried to remove/adjust the start and limit attributes, but resulted in whole set of data instead one record.

 

Would like how better, the API can be altered the to get the associated Host connected to Switch/Device details for the supplied specific Host IP.

 

Many thanks in advance.

 

Regards,

Mahesh.

 

 

Highlighted

Re: REST Query - Network Gear to Hostname

Adviser
Posts: 353
8069     0
Try using the "search" API call instead of "index".

John
Highlighted

Re: REST Query - Network Gear to Hostname

Techie
Posts: 2
8069     0

Hi Belamaric,

Thanks for the response.

 

I tried differrent combinations of 'search' API , though status code returns '200' but there is no actual result.

 

https://netmri-host-name/api/3/spm_end_hosts_default_grids/search

 

Resposne: {200: null}

 

I might be doing something wrong or not passing any additional expecetd parameters. Appreciate if you have any working use case. Thanks.

 

Regards,

Mahesh.

Highlighted

Re: REST Query - Network Gear to Hostname

Adviser
Posts: 353
8069     0

It looks like that object doesn't support search, only index; and the index doesn't really have any filtering available. A bit annoying. You should submit an RFE through your account team.

 

In the meantime, you will have to either filter out the results in your script, or use several APIs to get what you want:

 

1) Find the DeviceID for the server using the /api/3/devices

2) Find the Neighbor entry for the server using /api/3/neighbors/search?NeighborDeviceID=xyz

3) Lookup the Interface and Device for the switch port using the DeviceID/InterfaceID that come from #2.

 

John

 

Highlighted

Re: REST Query - Network Gear to Hostname

Techie
Posts: 6
8069     0

I'm trying to get the 'select=' parameter to limit the fields returned. E.g.,

 

curl -k -u userSmiley Tongueass -H "Content-Type: application/json" -X GET 'https://netmri-host/api/2.9/spm_end_hosts_default_grids/index?limit=10&start=1500&select=NeighborIPDotted,NeighborMAC,FirstSeen,LastSeen,Interface'

 

Regardless of what I put in the select I always get ALL fields returned for all records.

Any suggestions?

 

 

Highlighted

Re: REST Query - Network Gear to Hostname

Techie
Posts: 3
8069     0

There is no filtering possible on spm_end_hosts_default_grids. Really ? really ! As far as i know in the current API.

 

Only resolution is to pull all data once every hour or day, store it, and then do searches on this offline data....stupid but....it works. Data can be refreshed in the background.

If you really fancy programming, you can write your own API in Python which exposes that same data through a custom API ... not so difficult in fact.

Showing results for 
Search instead for 
Do you mean 

Recommended for You