Hello,
Is there any way to query the Orion nodes with all the custom properties?
Thanks.
CluM09
Hi,
using the REST api you can perform a read on the node swis URI like so..
swis://hostname/Orion/Orion.Nodes/NodeID=1/CustomProperties
which will return all the possible custom properties and their values
more info is available here: REST · solarwinds/OrionSDK Wiki · GitHub
What was the end goal?
danofa,
Thank you for the quick response. I am sorry for being late in responding back to you.
Actually, I need to query all the nodes from SolarWinds including built-in and custom properties. I need this information to true up the SolarWinds inventory for my company.
I would assume that the syntax you provided is for one node only with a known NodeID. I am not familiar with SolarWinds REST api, and I have never used it. Do I need to use SwisSnapin snapin or I just use the Invoke-Webrequest or Invoke-RestMethod cmdlet from PowerShell or the curl utility?
Please give the actual syntax of the REST api command to perform the operation.
Thanks again.
Ah, well that changes a few things,
maybe the best bet in your case is to make a custom report, based on a SQL query
then you can do something like the following...
Select * FROM NodesCustomProperties cp
INNER JOIN NodesData nd on cp.NodeID = nd.NodeID
this will give you all the custom properties and all the data that applies to each node... if its too much information you can whittle it down with a SELECT IP_Address, Vendor, <insert column name here>, cp.* FROM ...
Hope this helps
You don't need to use a SQL query. If you want to do this in the reporting system, you can make a report for nodes that includes whatever properties you need, including custom properties, just by picking them from the list.
If you prefer to do this from a script, you can use a Query request to get a complete list of nodes including custom properties. In PowerShell this is done with the "Get-SwisData" cmdlet. See the REST API documentation page (linked earlier in this thread) for information about how to run a SWQL query through that channel.
tdanner,
What is the syntax for the Get-SwisData cmdlet to pull the node data including the custom properties? I tried danofa's code, but it generated an error below:
Get-SwisData $swis "Select * FROM NodesCustomProperties cp INNER JOIN NodesData nd on cp.NodeID = nd.NodeID"
which results in this error: Get-SwisData : no viable alternative at input '*' in Select clause
Can you give an example on how to do this?
I may be wrong, but here
clum09 написал(а): Get-SwisData $swis "Select * FROM NodesCustomProperties cp INNER JOIN NodesData nd on cp.NodeID = nd.NodeID"
clum09 написал(а):
you use SWQL , not SQL. SWQL does not support Select * from syntax, you have to specify columns/fields you need as result.
===================
Common SQL Constructs Not Supported
SWQL does not support the following common SQL constructs:
Note: You must use CRUD operations to create, read, update, or delete entities.
SELECT * FROM … (You must list the actual properties you want to select.)
UPDATE, INSERT, DELETE, etc. (You can only use SWQL to read data.)
====================
So try something like this : Get-SwisData $swis "Select NodeID FROM NodesCustomProperties cp INNER JOIN NodesData nd on cp.NodeID = nd.NodeID" , if it does not show any error just add columns you need in Select part of your query.
I tried: Get-SwisData $swis "Select City FROM NodesCustomProperties cp INNER JOIN NodesData nd on cp.NodeID = nd.NodeID", but I got the following error:
Get-SwisData : Source entity [NodesCustomProperties] not found in catalog
Use "Orion.NodesCustomProperties", not just "NodesCustomProperties".
Here is the equivalent SWSQL. This is pulling all nodes that have the name 'Cisco' and a custom property called Team that contains 'Telecommunications'
Select IP_Address, Caption, NodeID, _Group FROM Orion.NodesCustomProperties cp
INNER JOIN Orion.nodes nd on cp.NodeID = nd.NodeID
Where Caption Like '%Cisco%'AND Team Like 'Telecommunications'