What do you mean by "prod.state"?
If you know what SQL query you would use, I can help you find an equivalent.
select prod_state from nodes
This may be an additional field that we added to the Nodes table, that we are populating to determine production vs. non production systems.
I was attempting to modify the query string in the GetOneAlert function supplied in the documentation.
Ok, in that case you will probably find it under CustomProperties. Like this:
FROM Orion.Nodes N
WHERE N.CustomProperties.prod_state = 'production'
I recommend you use the SWQL Studio application to work out your query, then update the program.
The issue isnt knowing what the query should be, the issue is the syntax needed in the vb.net application to obtain the data.
The example shows functions for GetOneAlert and a DataContract for AlertInfo, where can I find the same information for data from the Nodes table.
<DataContract(Name:="AlertInfo", [Namespace]:="http://schemas.solarwinds.com/2008/Orion")> _
<DataMember(Order:=1)> Public DefinitionId as String
<DataMember(Order:=2)> Public ObjectType as String
<DataMember(Order:=3)> Public ObjectId as String
Would I change "AlertInfo" to "Node" or "Nodes" and what is DefinitionId, ObjectType, etc
Where can I find what is available?
Sorry, I'm new to accessing data using services, normally I would just create a data connection object in the app, execute the query and go through the recordset.
That AlertInfo class is the parameter to the Orion.AlertStatus.Acknowledge verb. It is used for specifying which alerts you want to acknowledge, not parsing the query results.
In the GetOneAlert function, the query results are parsed by looking for the "data" result element, then the "A" element under that. The "data" element will always be present. The child element of data is "A" because that is the alias specified for Orion.AlertStatus in the query. There is only one "A" element because the query specifies "TOP 1" - if there were more result rows then there would be more "A" elements to iterate through.
Hope that helps.
I'm working with Josh (a001615) and I think the point he (and I) are trying to get to is understanding the more than just the usage flow.
For example: If I'm running the query "Select nodes.nodeid, nodes.caption, nodes.ip_address from nodes" and I get a particular resultset back, how do I iterate over each record and parse out the requested fields?
Does this process change if one of the fields I'm pulling is a custom field.
Thanks for your patience in the face of our frustration.
I think I could provide better assistance if you can post a partial script, i.e., we got this far and are not sure what to write next.
In this case, what we want is very simple (or at least, a simple example, which we can build from there):
I want to "select nodes.nodeid, nodes.caption, nodes.ip_address, nodes.city from nodes"
I'm including city because I want at least one custom property, because I know (from doing this in Perl) that custom properties don't show up in the same "space" in the result set as the regular node fields.
Once the record set is back, I want to print (to screen, to file, whatever) the sentence:
For node $nodeid, the name is $caption, ip is $ipaddress and the city is $city
Which is really just a way for me to see the structure of walking through a recordset and doing SOMETHING to it.
If you have that handy, I'd be appreciative and grateful.
Is this what are you seeking for?
$SWIS_Connection = Connect-Swis -Hostname "YOUR IP ADDRESS" -UserName "YOUR USERNAME" -Password "YOUR PASSWORD"
$SWIS_Data = Get-SwisData $SWIS_Connection "SELECT T1.NodeID, T1.IP_Address, T1.Caption, T2.City FROM Orion.Nodes as T1 JOIN Orion.NodesCustomProperties AS T2 ON T1.nodeid=T2.nodeid"
foreach ($Item in $SWIS_Data)
Write-Host ("For node " + $Item.NodeID + ", the name is " + $Item.Caption + ", ip is " + $Item.IP_Address + " and the city is " + $Item.City)