Show Menu

SolarWinds SWIS API Cheat Sheet by

SolarWinds exposes Information Service (SWIS) to customers. The service is accessible from PowerShell and this cheat sheet aims to simplify using it. Information within this cheat sheet is based on SolarWinds Orion SDK 1.5.
development     solarwinds     powershell     swql

Query SWIS with PowerShell

Add-­PSS­napin SwisSnapin
Get-­Cre­den­tial
Conn­ect­-Swis -Crede­ntial $creds -Hostname localhost
Get-­Swi­sData $swis 'SELECT nodeID, Caption FROM Orion.N­odes Where Vendor=@v' @{v='C­isco'}
Invo­ke-­Swi­sVerb $swis Orion.N­odes Unmanage @("N­:1",­$no­w,$­lat­er,­"­fal­se")
The Invo­ke-­Swi­sVerb cmdlet argument lists support XmlElement objects from Orion SDK 1.5. If your scripts rely on the original behavior, update them to use the Inne­rText property of the returned element.

Installing SWIS PowerShell

choco install orionsdk -y
C:\Win­dow­s\M­icr­oso­ft.N­ET­\Fr­ame­wor­k\v­4.0.30­319­\In­sta­llU­til.exe 'C:\Pr­ogram Files­\Sol­arW­ind­s\Orion SDK\SWQL Studio­\Sw­isP­owe­rSh­ell.dll'
C:\Win­dow­s\M­icr­oso­ft.N­ET­\Fr­ame­wor­k64­\v4.0.3­03­19­\Ins­tal­lUt­il.exe 'C:\Pr­ogram Files (x86)­\Sol­arW­ind­s\Orion SDK\SWQL Studio­\Sw­isP­owe­rSh­ell.dll'
If you installed the Orion SDK to a different folder, adjust the path to Swis­Pow­erS­hel­l.dll accord­ingly.
The same DLL works in both 32- and 64-bit shells, but you have to register it separately for each context.
Don't forget that you need to run the Powershell as Admini­str­ator.
 

SWQL supported constructs

SELECT ... FROM ...
WHERE
GROUP BY ... HAVING ...
ORDER BY
INNER JOIN
LEFT/RIGHT OUTER JOIN
UNION
UNION ALL
SELECT TOP n
SELECT DISTINCT
Subqueries in SELECT
Subqueries in FROM/JOIN
Aggregates SUM, MAX, MIN, AVG, COUNT
Functions ISNULL, ABS

Credit

The cheat sheet was created in conformity with SolarWinds Orion SDK 1.5.
 

SWQL unique

Navi­gation Proper­ties
SELECT I.Caption, I.Node.Co­ntact FROM Orion.N­PM.In­ter­faces I WHERE I.Type­Nam­e='­iee­e80211'
Row Windows
SELECT NodeID, Caption, IPAddress, Status FROM Orion.N­odes ORDER BY Caption WITH ROWS 100 TO 199

SWQL - NOT SUPPORTED

SELECT * FROM
You must list the actual properties you want to select.
UPDATE, INSERT, DELETE
You can only use SWQL to read data
You must use CRUD operations to create, read, update, or delete entities.

Download the SolarWinds SWIS API Cheat Sheet

1 Page
//media.cheatography.com/storage/thumb/ernest_solarwinds-swis-api.750.jpg

PDF (recommended)

Alternative Downloads

Share This Cheat Sheet!

 

Comments

AK AK, 13:50 30 Sep 15

SWQL - NOT SUPPORTED says You must list the actual properties you want to select.
How do you get a list of all available properties? Apparently, not all table column names work.

Brian McMahon Brian McMahon, 09:53 18 Oct 15

Yes, a major short coming of the SW PowerShell "integration" is the lack of metadata information for valid properties for a given node. This will give you a full listing of properties, but about half of the returned list are invalid for a Windows node: $allProps = Get-SwisData $swis "SELECT Name FROM Metadata.Property where EntityName = 'Orion.Nodes'" It appears that depending on the node type, certain properties are valid, others aren't. I don't know if there is a way to return only the valid properties for a node type without trial and error. This means you end up with a select statement like this: $nodeInfo = Get-SwisData $swis "SELECT NodeID, ObjectSubType, IPAddress, IPAddressType, DynamicIP, Caption, NodeDescription, Description, DNS, SysName, Vendor, SysObjectID, Location, Contact, VendorIcon, Icon, IOSImage, IOSVersion, GroupStatus, StatusIcon, LastBoot, SystemUpTime, ResponseTime, PercentLoss, AvgResponseTime, MinResponseTime, MaxResponseTime, CPULoad, MemoryUsed, MemoryAvailable, PercentMemoryUsed, PercentMemoryAvailable, LastSync, LastSystemUpTimePollUtc, MachineType, Severity, ChildStatus, Allow64BitCounters, AgentPort, TotalMemory, CMTS, CustomPollerLastStatisticsPoll, CustomPollerLastStatisticsPollSuccess, SNMPVersion, PollInterval, EngineID, RediscoveryInterval, NextPoll, NextRediscovery, StatCollection, External, Community, RWCommunity, IP, IP_Address, IPAddressGUID, NodeName, BlockUntil, BufferNoMemThisHour, BufferNoMemToday, BufferSmMissThisHour, BufferSmMissToday, BufferMdMissThisHour, BufferMdMissToday, BufferBgMissThisHour, BufferBgMissToday, BufferLgMissThisHour, BufferLgMissToday, BufferHgMissThisHour, BufferHgMissToday, OrionIdPrefix, OrionIdColumn, MinutesSinceLastSync, EntityType, DetailsUrl FROM Orion.Nodes order by nodeid" Pretty ridiculous, huh?

Mark Roberts Mark Roberts, 15:35 11 Jan 16

I would suggest you install the SWQL Studio application, which has just been upgraded to v2. This will allow you to view all of the SWQL column names for all of the supported entities in Orion.

SolarWinds have created a GitHub site for the SDK so new versions will be available via that resource - https://github.com/solarwinds/OrionSDK

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Regular Expressions Cheat Sheet
          JavaScript Cheat Sheet