Quantcast
Channel: THWACK: All Content - Orion SDK
Viewing all 2677 articles
Browse latest View live

Group Link Different in Web Interface

$
0
0

Hello,

I have recently begun to write my own resources using SWQL queries, however, I have run into a bit of a snag.

 

I am working on creating a resource which shows the number of alerts per group and I was hoping to make it clickable however the group link in the web interface is different than that returned from swis.

 

The SWQL looks like this:

SELECT 
AO.Node.CustomProperties.Department as [Department],
C.WebUri.WebUri as [_LinkFor_Department],
Count(Distinct(AO.AlertActive.AlertObjectID)) as Alerts, 
sum(case when AO.AlertActive.AcknowledgedDateTime is Null then 1 else 0 end) as Unacknowledged, -- WHEN AA.Acknowledged is FALSE
max(AO.AlertActive.TriggeredDateTime) as [Newest Alert],
min(AO.AlertActive.TriggeredDateTime) as [Oldest Alert]
from  Orion.AlertObjects AO
inner join Orion.ContainerMemberSnapshots CMS on CMS.EntityID = AO.node.nodeID
inner join Orion.groups C on C.ContainerID = CMS.ContainerID  
Where 
AO.Node.CustomProperties.Service_Offering = 'TxDOT Business Network'
GROUP By(AO.Node.CustomProperties.Department )
HAVING Count(Distinct(AO.AlertActive.AlertObjectID)) > 0 
order by Alerts DESC

 

The problem is when I run this in SWQL Studio, or even in the web interface /Orion/Admin/swis.aspx, I get what I expect, unique links matching the group:(I am excluding Department to hide info)

But when I right click the link it generates in my resource every link is the same '/Orion/NetPerfMon/ContainerDetails.aspx?NetObject=C:40' this takes me to another group that all nodes are a member of.

 

Can someone please help me understand this, and what I can do to get the result I desire.

 

Thank you!

 

PS. If anyone has an idea how I can remove the duplicate records from Unacknowledged that would also be helpful. I tried Distinct there to no avail.


TC18: Creating and Updating Orion Custom Properties with PowerShell

$
0
0

THWACKcamp 2018

This script was featured during the There's an API for That: Introduction to the SolarWinds Orion SDK at THWACKcamp 2018

 

OVERVIEW / REFERENCES:

This is a small script I used as a demo during a wonderful experience that I was able to share with 2 of my favorite people ( KMSigma and adatole ). While I am not the most gifted scripter (reminder: Scripting != Coding), I was blessed to be invited to join my fellow MVPs in a session devoted to evangelizing the majesty of all things scripting.

 

While we obviously didn't have enough time to teach our session to granular detail, we did attempt to provide a decent amount of information in-session and all of the scripts are available here in the Orion SDK forum. Here are some good resources for the topics covered by my personal script:

  • GitHub: Orion SDK - THE place to start all of your API adventures!
  • Managing Custom Properties - The SDK Wiki entry that directly applies to the information in this post
  • Orion SDK (you've obviously already found this, but who can sleep at night without thanking THWACK?)
  • about_Functions - PowerShell documentation. It's a manual sure, but you'd be remiss to pass this one up. I constantly find myself going back there and learning a new thing (or 10)
  • Hey, Scripting Guy! blog - This blog is a goldmine of information for anyone new to PowerShell. While not always the most detailed, I can usually use the knowledge here as a starting point to get into the "Google-Rabbit Hole" of blogs and how-to's that surround the inter-webs.
  • Learn Windows PowerShell in a Month of Lunches - This seminal book has been a foundation of new beginnings into PowerShell, but some of us are a bit more visual learners. Luckily, Don Jones has us covered in video form as well!

 

THE PROBLEM:

Manually adding all of your custom properties back in after a net-new installation, manipulating thousands of records via automation, or even simply expanding your comfort level into scripting. All are valid reasons to get "hooked" (yeah, I went there) into the SolarWinds Orion API. In this session, I presented a small script that outlines some foundational concepts of API usage via PowerShell, as well as provides what I hope will become a real-world use-case for you!

More specifically, I am presenting a script that uses PowerShell functions to do the following:

  • Connect to the SolarWinds Information Services (SWIS)
  • Create a new Custom Property
  • Update the value of a Custom Property for an object

 

CHOICE OF LANGUAGE:

While the very essence of a REST API is surrounded by the beauty of being language-agnostic, at some point everyone has to choose a language. (at least per script) For ease of presentation, I decided to use PowerShell as it's Windows-native (just like the Orion platform), and has a LARGE amount of support for both the Orion Module, and modules that allow you to easily interact with a lot of other systems. (SQL Databases, Microsoft Excel, Amazon Web Services, Azure, etc.) The idea being that you may use posts like these to self-start into a journey of further discovery, and starting in a more complex language that has less built-in support and may require compilation can be daunting for your first jump into the pool. Enter PowerShell: No Muss, No Fuss.

 

AUTOMATE ALL THE THINGS:

I've been known to say time and again that the absolute best admins I have ever worked with in IT are L-A-Z-Y. IM(not so)HO, it is a waste of time/energy/resources to do anything manually that you can do with a script. There's always exceptions to the rule of course, but I cannot stress how much more effective my team is due to automation scripts. We have a team of 3 engineers handling the work of (from jbiggley's estimates) 15. That's in no small part directly attributed to our ability to utilize almost any platform's API to handle the mundane "Click Here, Enter Text, Next, Next, Submit" tasks that we all face every day in IT.

I could spend a lifetime posting articles and reasons to adopt scripting into your world, but I instead will challenge you to find one thing. Find one single task that you repeat more than 3 times per week. No matter what it is, try and create a script for it. Even if the end result is that you save yourself 5 minutes per task; that's 15 minutes per week; which is 13 hours annually that you can use to script other things, which then opens up more time to script even more things... Ever heard of compound interest? Let's apply that to life.

 

SCRIPT SUMMARY:

OK, so what we're doing with this script is basically outlined as such:

  • Create 3 functions for each of our tasks
  • Execute those functions

 

Sounds simple? Well, it somewhat is, but when I first started it seemed like I was trying to read and write sanskrit, and not even in one of the common dialects! Trust me that with time (and Google) it gets easier. Plus, you a member of the BEST ONLINE COMMUNITY OF IT PROFESSIONALS IN THE WORLD!!! If you can't find the answer on THWACK, it simply doesn't exist.

 

You may end up asking yourself, "But Zack, why are you making functions to do something so simple? I mean you've even thrown up the Wiki entry that shows precisely how to do all this, no functions necessary!" Well, the answer is twofold. First, I wanted to show you a small sample of how functions can create a great deal of manageability in a script as you can reduce the amount of times you need to enter the same syntax. Second, functions are, in their own way, a process of automating your script writing. #Scriptception

 

To be fair, I should REALLY find the time to take the 50-something Orion SDK functions I have built in my personal stores and roll them into something pretty like the PowerOrion module. That takes you even deeper into automation-vana by allowing you to call all of your "functions" (cmdlets in a module) with a single line at the top of your script. It's the golden snitch of the PowerShell scripter's world.

 

THE BACON BITS:

The most important parts of this script are within the functions themselves. You can find the full text of the script below, full of comments and tidbits of help.

  • Set-SwisConnection (Lines 30 and 269)
  • New-CustomProperty (Lines 62 and 272)
    • This creates a new custom property for either NPM or SAM. This could easily be expanded to any other module, I was sticking with these for simplicity.
  • Set-CustomPropertyValue (Lines 119 and 274)
    • This will update/set the value of an existing custom property for a target object (Node, Application Monitor, etc.)

 

THE SCRIPT:

#region Top of Script

#requires -version 2
<#
.SYNOPSIS     Examples of Functions to Create and Update Custom Properties via Orion SDK

.DESCRIPTION 
    https://github.com/solarwinds/OrionSDK/wiki/Managing-Custom-Properties

.NOTES
    Version:        1.0    Author:         Zack Mutchler    Creation Date:  March 21, 2018    Purpose/Change: Initial Script development.    Version:        1.1    Author:         Zack Mutchler    Creation Date:  May 28, 2018    Purpose/Change: Added Set-CustomPropertyValue Function
#>

#endregion

#####-----------------------------------------------------------------------------------------#####

#region Functions

# Create a function to connect to the SolarWinds Information Service (SWIS)
Function Set-SwisConnection {
        [ cmdletbinding() ]    Param(        [ Parameter( Mandatory = $true, HelpMessage = "What SolarWinds server are you connecting to (Hostname or IP)?" ) ] [ string ] $SolarWindsServer,        [ Parameter( Mandatory = $true, HelpMessage = "Do you want to use the credentials from PowerShell (Trusted), or a new login (Explicit)?" ) ] [ ValidateSet( 'Trusted', 'Explicit' ) ] [ string ] $ConnectionType    )    # Import the SolarWinds PowerShell Module    Import-Module SwisPowerShell    # Connect to SWIS    IF ( $ConnectionType -eq 'Trusted'  ) {        $swis = Connect-Swis -Trusted -Hostname $SolarWindsServer        }    ELSE {            $creds = Get-Credential -Message "Please provide a Domain or Local Login for SolarWinds"        $swis = Connect-Swis -Credential $creds -Hostname $SolarWindsServer    }

RETURN $swis

}

# Create a function to create a new Custom Property
Function New-CustomProperty {
        [ cmdletbinding() ]    Param(        [ Parameter( Mandatory = $true, HelpMessage = "Value from the Set-SwisConnection Function" ) ] [ object ] $SwisConnection,        [ Parameter( Mandatory = $true, HelpMessage = "What Object Type is this custom property for?" ) ] [ ValidateSet( 'Alerts', 'Applications', 'Groups', 'Interfaces', 'Nodes', 'Reports', 'Volumes' ) ] [ string ] $PropertyType,        [ Parameter( Mandatory = $true, HelpMessage = "What name would you like to give this custom property?" ) ] [ string[] ] $PropertyName,        [ Parameter( Mandatory = $true, HelpMessage = "What description would you like to give this custom property?" ) ] [ string ] $Description,        [ Parameter( Mandatory = $true, HelpMessage = "What data type should be used?" ) ] [ ValidateSet( 'string', 'integer', 'datetime', 'single', 'double', 'boolean' ) ] [ string ] $ValueType,        [ Parameter( Mandatory = $false, HelpMessage = "OPTIONAL: What is the maximum size, if using a 'string' data type? (Max 4000)" ) ] [ ValidateRange( 0,4000 ) ] [ int ] $Size,        [ Parameter( Mandatory = $false, HelpMessage = "OPTIONAL: What values would you like to set for the drop down?" ) ] [ string[] ] $DropDown    )

# Example: New-CustomProperty -SwisConnection $swis -PropertyType "string" -PropertyName "array" -Description "string" -ValueType "string" -Size "optional integer" -DropDown "optional array" -Mandatory <adding this argument = $true> -Default "optional string"        # Set the Custom Property Usages to all available options so you're not limited    # IsForEntityDetail is required to utilize new popover options in Orion Platform 2018.2 (https://thwack.solarwinds.com/docs/DOC-194255)    $Usages = @{ 'IsForAlerting' = $true; 'IsForAssetInventory' = $true; 'IsForEntityDetail' = $true; 'IsForFiltering' = $true; 'IsForGrouping' = $true; 'IsForReporting' = $true }    # Set the Entity Object to be used to create your Custom Property    # Note these options are going to be based on the SolarWinds modules you have installed    # The below options reflect NPM and SAM        If( $PropertyType -eq "Alerts" ) {            $Entity = "Orion.AlertConfigurationsCustomProperties"        }        If( $PropertyType -eq "Applications" ) {            $Entity = "Orion.APM.ApplicationCustomProperties"        }        If( $PropertyType -eq "Groups" ) {            $Entity = "Orion.GroupCustomProperties"        }        If( $PropertyType -eq "Interfaces" ) {            $Entity = "Orion.NPM.InterfacesCustomProperties"        }        If( $PropertyType -eq "Nodes" ) {            $Entity = "Orion.NodesCustomProperties"        }        If( $PropertyType -eq "Reports" ) {            $Entity = "Orion.ReportsCustomProperties"        }        If( $PropertyType -eq "Volumes" ) {            $Entity = "Orion.VolumesCustomProperties"        }    # Create the new custom properties    Foreach( $n in $PropertyName ) {        Invoke-SwisVerb $SwisConnection $Entity CreateCustomPropertyWithValues @( $n, $Description, $ValueType, $Size, $null, $null, $null, $null, $null, $null, $DropDown, $Usages )        Write-Host "Creating Custom Property: $( $n ) for Entity Type: $( $Entity )" -ForegroundColor Yellow    }
}

# Create a function to modify/set object values on existing Custom Property
# https://github.com/solarwinds/OrionSDK/blob/master/Samples/PowerShell/CRUD.SettingCustomProperty.ps1
# This could be enhanced in several ways, most notably by using Dynamic Parameters for the ID and Value entries based on the $NodeCP parameter
Function Set-CustomPropertyValue {

    [ cmdletbinding() ]    Param (        [ Parameter( Mandatory = $true, HelpMessage = "Value from the Set-SwisConnection Function" ) ] [ object ] $SwisConnection,        [ Parameter( Mandatory = $true, HelpMessage = "Primary Polling Engine Name" ) ] [ string ] $PrimaryPoller,        [ Parameter( Mandatory = $true, HelpMessage = "Custom Property Name" ) ] [ string ] $CustomProperty,        [ Parameter( Mandatory = $true, HelpMessage = "Is this a NODE Custom Property?" ) ] [boolean] $NodeCP,        [ Parameter( HelpMessage = "NodeID for Custom Property assignment, REQUIRED for Nodes/Applications/Interfaces/Volumes" ) ] [ int ] $NodeID,        [ Parameter( ParameterSetName = 'AlertID' ) ] [ int ] $AlertID,        [ Parameter( ParameterSetName = 'ReportID' ) ] [ int ] $ReportID,        [ Parameter( ParameterSetName = 'ApplicationID' ) ] [ int ] $ApplicationID,        [ Parameter( ParameterSetName = 'InterfaceID' ) ] [ int ] $InterfaceID,        [ Parameter( ParameterSetName = 'VolumeID' ) ] [ int ] $VolumeID,        [ Parameter( ParameterSetName = 'StringValue' ) ] [ string ] $StringValue,        [ Parameter( ParameterSetName = 'IntegerValue' ) ] [ int ] $IntegerValue,        [ Parameter( ParameterSetName = 'DateTimeValue' ) ] [ datetime ] $DateTimeValue,        [ Parameter( ParameterSetName = 'SingleValue' ) ] [ single ] $SingleValue, #Float with 7 digits of precision        [ Parameter( ParameterSetName = 'DoubleValue' ) ] [ double ] $DoubleValue, #Float with 15-16 digits of precision        [ Parameter( ParameterSetName = 'BooleanValue' ) ] [ boolean ] $BooleanValue # $true|$false    )<# Examples:    Node CP: Set-CustomPropertyValue -SwisConnection $swis -PrimaryPoller <> -CustomProperty <> -NodeCP $true -NodeID <> [ $StringValue|$IntegerValue|$DateTimeValue|$SingleValue|$DoubleValue|$BooleanValue ]    Alert CP: Set-CustomPropertyValue -SwisConnection $swis -PrimaryPoller <> -CustomProperty <> -NodeCP $false -AlertID <> [ $StringValue|$IntegerValue|$DateTimeValue|$SingleValue|$DoubleValue|$BooleanValue ]     Report CP: Set-CustomPropertyValue -SwisConnection $swis -PrimaryPoller <> -CustomProperty <> -NodeCP $false -ReportID <> [ $StringValue|$IntegerValue|$DateTimeValue|$SingleValue|$DoubleValue|$BooleanValue ]    Application CP: Set-CustomPropertyValue -SwisConnection $swis -PrimaryPoller <> -CustomProperty <> -NodeCP $false -NodeID <> -ApplicationID <> [ $StringValue|$IntegerValue|$DateTimeValue|$SingleValue|$DoubleValue|$BooleanValue ]    Interface CP: Set-CustomPropertyValue -SwisConnection $swis -PrimaryPoller <> -CustomProperty <> -NodeCP $false -NodeID <> -InterfaceID <> [ $StringValue|$IntegerValue|$DateTimeValue|$SingleValue|$DoubleValue|$BooleanValue ]    Volume CP: Set-CustomPropertyValue -SwisConnection $swis -PrimaryPoller <> -CustomProperty <> -NodeCP $false -NodeID <> -VolumeID <> [ $StringValue|$IntegerValue|$DateTimeValue|$SingleValue|$DoubleValue|$BooleanValue ]
#>

# Set your object URI
If ( $NodeCP -eq $true ) {
    $uri = 'swis://' + $PrimaryPoller + '/Orion/Orion.Nodes/NodeID=' + $NodeID + '/CustomProperties'    Write-Host "Setting URI from Node Custom Property" -ForegroundColor Yellow
}
If ( $NodeCP -eq $false -and $AlertID ) {    $uri = 'swis://' + $PrimaryPoller + 'Orion/Orion.AlertConfigurations/AlertID=' + $AlertID + '/CustomProperties'    Write-Host "Setting URI from Alert Custom Property" -ForegroundColor Yellow
}
If ( $NodeCP -eq $false -and $ReportID ) {    $uri = 'swis://' + $PrimaryPoller + 'Orion/Orion.Report/ReportID=' + $ReportID + '/CustomProperties'    Write-Host "Setting URI from Report Custom Property" -ForegroundColor Yellow
}
If ( $NodeCP -eq $false -and $ApplicationID -and $NodeID ) {    $uri = 'swis://' + $PrimaryPoller + '/Orion/Orion.Nodes/NodeID=' + $NodeID + '/Applications/ApplicationID=' + $ApplicationID + '/CustomProperties'    Write-Host "Setting URI from Application Custom Property" -ForegroundColor Yellow
}
If ( $NodeCP -eq $false -and $InterfaceID -and $NodeID ) {    $uri = 'swis://' + $PrimaryPoller + '/Orion/Orion.Nodes/NodeID=' + $NodeID + '/Interfaces/InterfaceID=' + $InterfaceID + '/CustomProperties'    Write-Host "Setting URI from Interface Custom Property" -ForegroundColor Yellow
}
If ( $NodeCP -eq $false -and $VolumeID -and $NodeID ) {    $uri = 'swis://' + $PrimaryPoller + '/Orion/Orion.Nodes/NodeID=' + $NodeID + '/Volumes/VolumeID=' + $VolumeID + '/CustomProperties'    Write-Host "Setting URI from Volume Custom Property" -ForegroundColor Yellow
}
If ( $NodeCP -eq $false -and (!( $NodeID ) ) -and ( $ApplicationID -or $InterfaceID -or $VolumeID ) ) {    Write-Warning "Missing NodeID Parameter for Application, Interface, or Volume Custom Property"
}
If ( $NodeCP -eq $true -and (!( $NodeID ) ) ) {    Write-Warning "Missing NodeID Parameter for Node Custom Property"
}

# Set the Custom Property Value
If ( $StringValue ) {
    $cp = @{        $CustomProperty=$StringValue    }    Write-Host "String Value = $( $cp.Values )" -ForegroundColor Yellow
}
If ( $IntegerValue ) {    $cp = @{        $CustomProperty=$IntegerValue    }    Write-Host "Integer Value = $( $cp.Values )" -ForegroundColor Yellow
}
If ( $DateTimeValue ) {    $cp = @{        $CustomProperty=$DateTimeValue    }    Write-Host "DateTime Value = $( $cp.Values )" -ForegroundColor Yellow
}
If ( $SingleValue ) {    $cp = @{        $CustomProperty=$SingleValue    }    Write-Host "Single Value = $( $cp.Values )" -ForegroundColor Yellow
}
If ( $DoubleValue ) {    $cp = @{        $CustomProperty=$DoubleValue    }    Write-Host "Double Value = $( $cp.Values )" -ForegroundColor Yellow
}
If ( $BooleanValue ) {    $cp = @{        $CustomProperty=$BooleanValue    }    Write-Host "Boolean Value = $( $cp.Values )" -ForegroundColor Yellow
}

# Set the Custom Property Value
Write-Host "Setting Custom Property '$( $CustomProperty )':`n    $( $uri )`n    $( $cp.Keys )`n    $( $cp.Values )" -ForegroundColor Yellow

Set-SwisObject -SwisConnection $SwisConnection -Uri $uri -Properties $cp 

}

#endregion Functions


#####-----------------------------------------------------------------------------------------#####

#region Variables

# Set the SolarWinds server to connect to
$hostname = Read-Host -Prompt "Which SolarWinds server would you like to connect to?"

# Create a Name for the Custom Properties you want to create
$nodeCP = 'dark_theme_is_life'

# CP Description
$description = 'Should this object be presented in a glorious #DarkTheme?'

# CP Value Type
$valueType = 'string'

# CP String Size (ignored for non-string Value Types)
$size = 4000

# CP Drop Down Values
$dropDown = New-Object string[] 4
    $dropDown[0] = 'Go Sign Up for a UX session!'    $dropDown[1] = 'http://thwack.ux-group.sgizmo.com/s3/'    $dropDown[2] = 'Dark Theme All The Things'    $dropDown[3] = 'Kevin made me use 4 options...'

# Target NodeID
$nodeID = 10

$nodeCPString = 'Dark Theme All The Things'

#endregion Variables

#####-----------------------------------------------------------------------------------------#####

#region Execution

# Connect to SWIS
$swis = Set-SwisConnection -SolarWindsServer $hostname -ConnectionType Explicit

# Example: New-CustomProperty
New-CustomProperty -SwisConnection $swis -PropertyType Nodes -PropertyName $nodeCP -Description $description -ValueType string -Size $size -DropDown $dropDown

#Example: Set-CustomPropertyValue
Set-CustomPropertyValue -SwisConnection $swis -PrimaryPoller $hostname -CustomProperty $nodeCP -NodeCP $true -NodeID $nodeID -StringValue $nodeCPString

#endregion Execution

 

 

Enjoy, and have fun challenging yourselves! If you have any questions about this, or any other scripts, please feel free to ask! Happy Thwacking!

 

ZackM

 

#DarkThemeIsLife

 

The SolarWinds trademarks, service marks, and logos are the exclusive property of SolarWinds Worldwide, LLC or its affiliates.  All other trademarks are the property of their respective owners.

Unmanaging and suppressing alerts for applications - Scheduled recurring maintenance windows

$
0
0

Here's my take on a recurring, scheduled maintenance window for applications. We've got a hot/cold environment for one of our big in-house applications that rotates every two weeks.

 

Unmanage:

Add-Pssnapin swissnapin
$start = (Get-Date).ToUniversalTime() 
$end = $start.AddDays(14)
$swis = Connect-Swis -Hostname ORIONSERVER -Username username -Password password


$applist = Get-SwisData -SwisConnection $swis -Query @"
SELECT ID
FROM Orion.APM.Application 
WHERE Name LIKE '%KEYWORD%'
"@


Foreach( $a in $applist ) {
    $appid = @( $a | ForEach-Object { [string]( $_  ) } )    Invoke-SwisVerb -SwisConnection $swis -EntityName Orion.APM.Application -Verb Unmanage -Arguments @( "AA:$appid", $start, $end, "false" )
}

 

Suppress alerts:

Add-Pssnapin swissnapin
$start = (Get-Date).ToUniversalTime()
$end = $start.AddDays(14) #two week release cycle
$swis = Connect-Swis -Hostname ORIONSERVER -Username username -Password password


$apps = Get-SwisData -SwisConnection $swis -Query @"
SELECT Uri
FROM Orion.APM.Application 
WHERE Name LIKE '%KEYWORD%'
"@

Foreach( $a in $apps ) {
    $uri = @( $apps | ForEach-Object { [string]( $_  ) } )    Invoke-SwisVerb -SwisConnection $swis -EntityName Orion.AlertSuppression -Verb SuppressAlerts -Arguments @( $uri, $start, $end )    
}

 

Just set these Powershell scripts to run on a Scheduled Task and you're all set!

 

Special thanks to zackmKMSigma and aLTeReGo for lots of patience while I learn this API thing.

Using API to update IPAM.Subnet ParentID -- not reflected immediately in web console?

$
0
0

I want to reorganize the subnets into the needed subnet groups and supernets, and using the Get-SwisData, I was able to query the IPAM.Subnet data, and from that I got the subnetid and parentid, and other data.

 

I used the following commands to update the subnets' ParentId information:

 

Set-swisobject $swis  "swis://Thanos.ter.teradyne.com/Orion/IPAM.Subnet/SubnetId=221,ParentId=2357" -Properties @{ParentId='2398'}

Set-swisobject $swis  "swis://Thanos.ter.teradyne.com/Orion/IPAM.Subnet/SubnetId=227,ParentId=2357" -Properties @{ParentId='2398'}

Set-swisobject $swis  "swis://Thanos.ter.teradyne.com/Orion/IPAM.Subnet/SubnetId=228,ParentId=2357" -Properties @{ParentId='2398'}

Set-swisobject $swis  "swis://Thanos.ter.teradyne.com/Orion/IPAM.Subnet/SubnetId=237,ParentId=2357" -Properties @{ParentId='2398'}

 

When I use the Get-SwisData to query the data or use SWQL Studio to check the IPAM.Subnet data, I can see that the ParentId did change, but on the web console, the subnet is not in the correct group according to what I moved it to.

 

The way I have found to get it updated was to reboot the SolarWinds server, and then in the web console, about 2 or 3 minutes after it is up, then I see that the subnets are in the group that I wanted it to be in -- initially after SolarWinds is up, and when I check in at the beginning, it still is not there, but after some time, something refreshes and the subnets are moved to the correct place.

 

What is the process that is re-reading from the IPAM.Subnet database to figure out a subnet's details has been updated through the API?  How often does this run?  Would the subnet eventually get moved if I don't do anything?  Else, how can I force an update quickly, besides rebooting the server to restart all the IPAM services?

 

Any help on this is much appreciated.  Thank you.

Adding values to an existing custom property using curl.

$
0
0

Hi

I´m new to using json and curl, and any help would be greatly appreciated, I've been reading through the github page and forums but still I am very confused because all of this is very new to me.

My goal is to use curl to add new values to an existing custom property list of values.

So... I have two Custom Properties called Customer and Customer Billed. My ultimate goal is the get our ticketing system to send a string with curl to the solarwinds api, and that string would be added as a custom property value under these two custom properties (Customer and Customer Billed).

So I thought I would try this in baby steps and tried to create a new Custom Property called CarrierName, and tried to update the value list, using the example below with postman:

Adding values to an existing custom property
But whenever I run this this with postman, it overwrites the existing values with the ones defined in the brackets (aaaTest, bbbTest and cccTest), but I need to add them to the existing list.

https://<servername>:<port>/SolarWinds/InformationService/v3/Json/Invoke/Orion.NodesCustomProperties/ModifyCustomProperty

 

[

          "CarrierName",

         "This is a test carrier",

         4000,

         [

              "aaaTest",

              "bbbTest",

              "cccTest"

         ]

]

 

 

If I can get this to work, my plan is to convert this code, with postman, to curl that would hopefully be usable to add a new value to the the value list for that custom property. Then figure out a way how to do that with both custom properties (Customer and Customer Billed).

And again.... Any help would be greatly appreciated.

SolarWinds Orion API & SDK: Authenticating with the application API key

$
0
0

Is there a way to authenticate a call with an  ApiKey or UserName/ApiKey method?

Create WMI Node via API Request

$
0
0

When attempting to create a new WMI node I am running into an issue where the node is created but its not receiving a value for the WMICredential field in "Orion.NodeSettings" which I am attempting to update after the node is created with the output of the NodeID I am getting in the return sting. The host shows up under manage hosts, but when you click on edit node properties it returns the exact error below:

 

 

So to run through the steps I am taking to get this issue:

1. I pass a JSON string to create the new node: REST to '/SolarWinds/InformationService/v3/Json/Create/Orion.Nodes' with json string {"EntityType":"Orion.Nodes", "IPAddress":"'+ip+'", "IPAddressGUID":"nnnnnnnn-0000-0000-0000-000000000000", "Caption":"'+newHostname+'", "DynamicIP": false, "EngineID": 2, "Status": 0, "UnManaged": false, "Allow64BitCounters": false, "SysObjectID": "", "MachineType": "", "VendorIcon": "", "ObjectSubType": "WMI"}

 

2. Grab the NodeID from the json API return and pass it to the "Node.NodeSettings"

 

3. Update the "Node.NodeSettings" value for "WMICredntial": REST to '/SolarWinds/InformationService/v3/Json/swis://orion/Orion/Orion.NodeSettings'; with json sting '{"EntityType":"Orion.NodeSettings", "NodeID":"11006" "SettingName":"WMICredential", "SettingValue": 22}'

 

4. Result is 200. Which would lead me to believe that field is being updated, but the error still exists.

 

Could anyone point me in the right direction of updating that "WMICredential" value for the specific Node after its been created?

 

I've looked at a few different threads but this one had some good info it and its where I got the idea of updating the node after its been created >> Create node with credential set

This is the document that points out the WMICredential value is missing which is causing the issue >> Given key is not present in the dictionary - SolarWinds Worldwide, LLC. Help and Support

 

Thanks!

SWQL: Where is the table to find the SQL port number

$
0
0

Hi,

Can you show me how to find the port of the APM SQL port on SWQL?

 

When I try to link the component port number, it's showing '0' or NULL.

 

SELECT DISTINCT n.caption, sc.NodeName as [Clustered Node], sc.Current as [Active Node], sq.InstanceName, sq.ProductVersion, sq.ProductLevel, sq.Edition, sa.Components.CurrentStatistics.ComponentPortNumber

FROM Orion.APM.SqlServerApplicationAlert sq

left join orion.apm.SqlServerApplication sa on sa.ApplicationID = sq.ApplicationID

left join orion.nodes n on sq.nodeid = n.NodeID

left join orion.NodesCustomProperties cp on sq.NodeID = cp.NodeID

left join orion.apm.SqlClusterNode sc on sc.ApplicationID = sq.ApplicationID

left join orion.apm.SqlDatabaseAlert sd on sd.ApplicationID = sq.ApplicationID   


AD Authentication with Curl

$
0
0

Hey tdanner,
We have been noticing a 403 error when we try to run a Curl Command with a AD Account, but if we use a local Orion account it passes.
Is that a known limitation with the API or could I be missing a setting?

Thanks!

How to Get a List of Down Devices and the Time They Went Down?

$
0
0

I have found several permutations of this question, but could never track down a solid answer for my specific question. I need to run an SQL Query via the reporting Resource. I am a network admin so my SQL knowledge is rather limited, but I do have a background in coding. Below is my attempt at a basic start to this mess:

 

     SELECT Nodes.Caption as Name,  Nodes.Status as Status, Nodes.Monitoring_CAT as Is_CAT, EventTime as Events

     FROM [dbo].[Nodes], [dbo].[Events]

     WHERE Nodes.Monitoring_CAT=1 AND (Status=0 OR Status=2)

     ORDER BY Nodes.Caption

 

This query above does work. So, down to the root of my issues...

    1. I need to be able to get the Last event from EventTime, but have no clue how to do that. I suspect there some crazy INNER JOIN stuff for that one.

 

I was using the Query below for reference from another Thwack post, but there is very little I can understand from it once you get into the event time section:

 

SELECT * FROM (

    SELECT

    Nodes.StatusLED,

    Nodes.Caption,

    Nodes.NodeID,

    Nodes.MachineType,

    StartTime.Message,

    StartTime.EventTime AS DownEventTime,

    Monitoring_CCM,

    (

        SELECT TOP 1 EventTime

    ) AS UpEventTime,

DATEDIFF(Mi, StartTime.EventTime,(

            SELECT TOP 1 EventTime FROM Events AS Endtime

            where EndTime.EventTime > StartTime.EventTime AND EndTime.EventType = 5 AND EndTime.NetObjectType = 'N'

                AND EndTime.NetworkNode = StartTime.NetworkNode ORDER BY EndTime.EventTime)

        ) AS OutageDurationInMinutes

    FROM Events StartTime

    INNER JOIN Nodes ON StartTime.NetworkNode = Nodes.NodeID

    WHERE (StartTime.EventType = 1)

) AS UpTimeTable

where outageDurationInMinutes IS NOT NULL AND outageDurationInMinutes >= '15'

AND datepart(hour, DownEventTime) >= 8

AND datepart(hour, UpEventTime) >= 8

AND datepart(hour, DownEventTime) <= 17

AND datepart(hour, UpEventTime) <= 17

ORDER BY Caption ASC, DownEventTime DESC

 

 

All help is appreciated, Thanks!

How to use API to connect agents

$
0
0

I'm trying to automate the creation of agents.  The following successfully creates an agent:

 

 

  #!/bin/bash

 

  data='{

  "Name"                 : "ahost",

  "Hostname"             : "ahost",

  "DNSName"               : "ahost.internal.qorvo.com",

  "IP"                   : "10.1.2.3",

  "OSVersion"             : "6.6",

  "PollingEngineId"       : 9,

  "ConnectionStatus"     : 0,

  "ConnectionStatusMessage"  : "Initial API insertion - connection pending",

  "AgentStatus"              : 0,

  "AgentStatusMessage"       : "Unknown",

  "Mode"                     : 0,

  "AutoUpdateEnabled"        : true

  }'

  curl --netrc --insecure -H "Content-Type: application/json" -d "$data" 'https://solarwinds.internal.qorvo.com:17778/SolarWinds/InformationService/v3/Json/Create/Orion.AgentManagement.Agent'

 

I've a vague feeling that I now need to use the "Deploy" verb where "Create" is above, but I can't find the data that needs to be posted (if I'm even guessing correctly).  Where should I look?  I started trying to read the powershell and C# code, but I don't speak either language, and it may take me a long time to learn both.

Invoke-SwisVerb to Enable Application Dependency Polling for a Node?

$
0
0

I've been sifting through the available verbs for this, but I'm not sure if there is one. Basically I'm looking for a way to automate checking the "

SDK Permissions issue

$
0
0

I have a query  I'm posting to get the first free IP address using the SDK and powershell:

 

get-swisdata $swis 'SELECT TOP 1 N.DisplayName, N.Status, N.IPNodeId, I.Client_Name, I.Customer_Account_Name, I.Target_UEB_IP FROM IPAM.IPNode N LEFT JOIN IPAM.IPNodeAttr I On N.IpNodeId=I.IPNodeId WHERE N.Status = 2 AND N.Subnet.DisplayName = @subnet AND I.Client_Name is null AND I.Customer_Account_Name is null AND I.Target_UEB_IP is null' @{subnet="$subnet"}

If I feed the admin password into $swis it works just fine, but if I use my AD account in $swis is gives nothing.  My account is Admin on solarwinds and on IPAM.  Any idea what permission I need to tweek to allow db lookups?

New Alerting - Deprecated OIDs Property, PropertyValue, Severity (Critical, Clear)

$
0
0

Hi,

 

In the throes of integrating Solarwinds with a Manager of Managers 3rd party using 11307.10 OIDs to pass traps. Being getting deprecated messages saying some OIDs are no longer available and to use 'New Alerting'.

 

Can find no information on 'New Alerting' and how to pass trap info like netObjectType, especially for Node - Hardware Types i.e. Fans and Power Supplies on Juniper equipment.

 

Also need to know how to pass Up / Down info, apparently Severity OID conveyed this information. Is Status the new Severity? Have the OIDs changed.

 

Any assistance appreciated. Google'd to exhaustion but no clear answers.

 

Thanks.

Changing a Performance Counter Instance Name, Overriding a Template

$
0
0

Hey all,

 

I currently have a template that is applied to multiple servers to collect windows performance counter information for some custom software.  The issue is, the instance names changes on a server, and there can be more than one instance of the counters on each server (each with a unique name).  I'm looking for a way to override the template's instance name setting and update each individual component's Instance.  Alternatively, I suppose I could use PowerShell to retrieve which counters and instances exist on each server (Already have the ability to obtain that information via script) and then hopefully use Invoke-SwisVerb to create individual templates, applications and components - but I'm not sure where to start with scripting the creation of solarwinds portion.

 

From enacting the change manually via the web console and then running a SWQL query, I can see that the overriding setting is held in Orion.APM.ComponentSetting with a Key of "Instance" and a "Value" of the instance name I entered (Along with ComponentID for the individual component of the application, as well as ValueType = 0 and Required = False)

 

I'm not finding any Swis Verbs to invoke in order to update a specific component like this - does anyone have any guidance?

 

I know the above is rather vague - if I can provide more information to facilitate a solution, please let me know.


Import Template using SwisPowershell

$
0
0

Hi there,

 

I am currently automating the installation and configuration of solarwinds with the help of the SwisPowershell module. I have managed to fully install solarwinds orion, agents on the nodes and can assign templates to each node easy enough with 0 touch. However, I am wanting to create new custom application templates using the GUI in advance, export them and include them in my automated install. The idea is to import these custom templates in to Orion and then assign nodes to them all using Powershell code.

 

In SWQL Studio I noticed methods in Orion.APM.ApplicationTemplate for "Delete Template" and "UpdateApplication Template Settings" but nothing for importing.

 

Is this possible through the API at all? Can I use New-SwisObject to achieve this?

 

thanks in advance.

Powershell for solarwind configured on Linux server

$
0
0

we have our infra with Linux server, but i am working with powershell scripts only.

how to use powershell in this case?

and how can autoamte the jobs for this?

SWQL: Location of SRM, Map Server Volumes data

$
0
0

Hi,

 

Can you point out, what table on SWQL I will find this information?

 

 

Help converting SQL to SWIS

$
0
0
  • We are trying to convert the following query to SWIS and quite frankly having trouble finding examples that utilize joins like this.  We built the query using the Orion Report Writer.

 

  • Query:

 

SELECT  TOP 10000 Nodes.Caption AS NodeName,

Case InBandwidth

            When 0 Then 0

            Else (In_Averagebps/InBandwidth) * 100

            End AS Recv_Percent_Utilization,

Case OutBandwidth

            When 0 Then 0

            Else (Out_Averagebps/OutBandwidth) * 100

            End AS Xmit_Percent_Utilization,

Interfaces.Caption AS Interface_Caption,

InterfaceTraffic.DateTime AS DateTime,

Interfaces.InterfaceID AS InterfaceID

 

FROM

(Nodes INNER JOIN Interfaces ON (Nodes.NodeID = Interfaces.NodeID))  INNER JOIN InterfaceTraffic ON (Interfaces.InterfaceID = InterfaceTraffic.InterfaceID AND InterfaceTraffic.NodeID = Nodes.NodeID)

 

WHERE

( DateTime BETWEEN 43406.5833333333 AND 43407.625 )

AND 

(

  (Nodes.Caption LIKE 'rtr1.dc5024%') AND

  (Interfaces.Caption LIKE '%AT&T%') AND

  (Nodes.area = 'remote_distributioncenter_rdc')

)

 

 

  • It would be really nice to have a SWIS converter as our customers are requesting more and more to pull data from the Solarwinds API without having to write in the SWQL/SWIS langauge.

Bug that allows user with no NCM access to pull from config archives

$
0
0

We have a local account that is configured in NCM as:  None No access to NCM functionality.

 

We validated no NCM access when invoking ConfigSearch like this:

 

swis.invoke('Cirrus.ConfigArchive', 'ConfigSearch',...)

 

HOWEVER, when doing a swis.query("SELECT ... FROM Cirrus.ConfigArchive"), this user is actually able to view configs.

 

This is an application design flaw, correct? (a security flaw)

Viewing all 2677 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>