I'm trying to run a SQL query against SolarWinds to obtain a list of BGP neighbors to be used in another report, and need to include the name of the neighbor in the output. I'm trying to accomplish this by joining Orion.Nodes with Orion.Routing.Neighbors, using Orion.Nodes.IPAddress as a common property with Orion.Routing.Neighbors.NeighborIP, and outputting a column containing Orion.Nodes.Caption. The issue persists whether I use Caption, NodeName, or any other field I've tried from Orion.Nodes.
The trouble I'm running into is that some of these are returning just fine, but others are giving a NULL value for the caption. Meanwhile, for these same neighbor relationships, the GUI returns results just fine.
Example (with fake names & IP addresses, for obvious reasons) - R2 has a BGP neighbor relationship with R1, with neighbor IP of 10.0.8.3. I can see this plainly in the Routing Neighbors section of the SolarWinds GUI. But the query output shows "NULL" for the NeighborDevice (Orion.Nodes.Caption) on this row.


I'm not sure if this is an issue where I'm pulling the wrong fields/tables to get the results I need, if I'm matching against the wrong field (maybe the GUI has some pointer other than NeighborIP to figure out what the node on the other end is) or if my Orion.Nodes table is missing data that should be there (but if that's the case, how is the GUI resolving these?). I reached out to support, and was informed that the SDK is community-supported with no official support from SolarWinds, so here we are. Help me Thwack, you are my only hope!
Query being used is written as follows:
SELECT TOP 1000 NeighborID, NodeID, TOUPPER(R.Caption) as Device, TOUPPER(No.Caption) as NeighborDevice,NeighborIP, ProtocolID, ProtocolStatus, LastChange, ProtocolName, ProtocolStatusDescription, N.Status
FROM Orion.Routing.Neighbors N
JOIN Orion.Routing.Router R on R.NodeID = N.Nodeid
Left JOIN Orion.Nodes No on No.IPAddress = N.NeighborIP
Where N.ProtocolID = 14
order by N.NodeID