cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 10

How can I do a custom SWQL query with a node variable?

Jump to solution

Hi,

in Node Details I want to do a custom SWQL query with the NodeID or Name.

Something like "... WHERE NodeID = ${NodeID}" is that possible??

I want to display for every single Node it's own Node details the lldp descriptions for example.

Do you have an idea?

kind regatds,

Flo

Tags (2)
1 Solution

I think you've got it already, but remember that SWQL is not SQL.

To be more specific, go to the "Node Details" page, click on "Customize Page" in the upper right-hand corner.   You'll see the list of resources on your page, add a "Custom Query" resource to once of the columns and move it up or down to where you want it to be.  Then click on "Preview" so you see the page, go to the new resource box you added and click on "Edit".   It should bring up a box that says "Edit Resource: Custom Query".  Give your query a title and a subtitle if you want.  Put your query in the box, click submit and it should work.

I tried it with this query and it worked for me....

SELECT IPAddress, Caption, Description, Vendor, IOSVersion, NodeName

FROM Orion.Nodes

WHERE NodeID = ${NodeID}

It limited the results to the one node.

To prototype your query, use the SDK tool "SWQL Studio", which you should be able to download from Solarwinds.   I highly recommend if you have it "Generate a Select Statement" for you to be sure to go in and change it to "SELECT TOP 100" or something, otherwise by default it will query your entire database.   Once you have the query you want working, put it in your page and add your "WHERE NodeID = ${NodeID}" and you should be set...

If you had a different question, please clarify...

View solution in original post

2 Replies

I think you've got it already, but remember that SWQL is not SQL.

To be more specific, go to the "Node Details" page, click on "Customize Page" in the upper right-hand corner.   You'll see the list of resources on your page, add a "Custom Query" resource to once of the columns and move it up or down to where you want it to be.  Then click on "Preview" so you see the page, go to the new resource box you added and click on "Edit".   It should bring up a box that says "Edit Resource: Custom Query".  Give your query a title and a subtitle if you want.  Put your query in the box, click submit and it should work.

I tried it with this query and it worked for me....

SELECT IPAddress, Caption, Description, Vendor, IOSVersion, NodeName

FROM Orion.Nodes

WHERE NodeID = ${NodeID}

It limited the results to the one node.

To prototype your query, use the SDK tool "SWQL Studio", which you should be able to download from Solarwinds.   I highly recommend if you have it "Generate a Select Statement" for you to be sure to go in and change it to "SELECT TOP 100" or something, otherwise by default it will query your entire database.   Once you have the query you want working, put it in your page and add your "WHERE NodeID = ${NodeID}" and you should be set...

If you had a different question, please clarify...

View solution in original post

thanks yes i got it by myself but thanks for your help

I do something like that: SELECT interface.InterfaceName, interface.InterfaceAlias, interface.MACAddress, interface.AdminStatus, interface.OperStatus FROM Orion.Nodes node, Cirrus.NodeProperties node_id, Cirrus.Interfaces Interface WHERE node_id.CoreNodeID = node.NodeID AND node_id.NodeID = interface.NodeID AND interface.InterfaceName like '%Gi%' AND node.SysName = '${SysName}' order by Interface.InterfaceName;


And that's the result:

visa.PNGHi,

Kind regards & thanks,

Flo