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.
|
Add-PSSnapin SwisSnapin
|
|
Get-Credential
|
|
Connect-Swis -Credential $creds -Hostname localhost
|
|
Get-SwisData $swis 'SELECT nodeID, Caption FROM Orion.Nodes Where Vendor=@v' @{v='Cisco'}
|
|
Invoke-SwisVerb $swis Orion.Nodes Unmanage @("N:1",$now,$later,"false")
|
|
choco install orionsdk -y
|
|
C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe 'C:\Program Files\SolarWinds\Orion SDK\SWQL Studio\SwisPowerShell.dll'
|
|
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe 'C:\Program Files (x86)\SolarWinds\Orion SDK\SWQL Studio\SwisPowerShell.dll'
|
|
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
|
|
Navigation Properties
|
|
SELECT I.Caption, I.Node.Contact FROM Orion.NPM.Interfaces I WHERE I.TypeName='ieee80211'
|
|
Row Windows
|
|
SELECT NodeID, Caption, IPAddress, Status FROM Orion.Nodes ORDER BY Caption WITH ROWS 100 TO 199
|
|
SELECT * FROM
|
You must list the actual properties you want to select.
|
|
UPDATE, INSERT, DELETE
|
You can only use SWQL to read data
|
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
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?
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.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.