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

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 "Application Dependency Polling Enabled" checkbox for a node. These are all nodes that have the agent already installed.

  • Hi chadsikorra

    You can enable/disable Application Dependency Polling by invoking verb:

    Orion.ADM.NodeInventory.Enable and Orion.ADM.NodeInventory.Disable

    You need to pass array of ids of nodes. In order to pass an array of integers, the following xml must be constructed and passed as an argument:

    <ArrayOfint xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">

       <int>1</int>

    </ArrayOfint>

    Hope this helps

    pawelk

  • Note that the XML is only needed from PowerShell. From HTTPS, you can use the Json syntax, which is a little more concise:

    [ 1 ]

  • I think that's for the "Asset Inventory" section of the resource selection list for a server. The application dependency mapping seems to be referred to as "SAM.ADM" in most places. That's what I originally tried, and it ran successfully but did not change the "Application Dependency Polling Enabled" checkbox.

  • Hi chadsikorra

    can you please double-check. I verified on my SAM installation that verb 'Orion.ADM.NodeInventory.Enable' turns the checkbox 'Application Dependency Polling Enabled' on.

    Maybe it is problem with parameters, or we miss something else.

    Regards

    pawelk

  • Interesting, I will double check. Though I have had to completely disable the Application Dependency Mapping feature in SAM because it completely hoses our environment after a couple days of running. The SolarWinds.Collector.Service.exe doesn't stop consuming memory and eventually all of our monitoring components go into an unlicensed state (even though we have an unlimited license). So I will likely put this on the back-burner for now. I appreciate the response though.

  • I'm having issues with this.  Can you spot what I'm doing wrong?

    I tried it via the PowerShell module (with both 2.5.0.214 & 3.0.0.336), and found a method of constructing the arguments that gets accepted, but doesn't actually effect any change:

    2.5.0.214:

    SwisPowerShell 2.5.0.214

    3.0.0.336

    3.0.0.336

    The version of Orion is 20.20.2.6 HF1

    Here's the code I tried:

    <#
    #    These different methods didn't work
    $NodeIds = 2727
    
    $NodeIds = @(2727)
    
    $NodeIds = "<ArrayOfint xmlns:i=`"http://www.w3.org/2001/XMLSchema-instance`" xmlns=`"http://schemas.microsoft.com/2003/10/Serialization/Arrays`"><int>2727</int></ArrayOfint>"
    
    $NodeIds = @"
    {
      "nodeIds": [
        2727
      ]
    }
    "@
    #>
    
    #   This method is accepted, but doesn't make a change in the database
    $NodeIds = @{"nodeIds" = @(2727)}
    
    Invoke-SwisVerb -SwisConnection $swis -EntityName Orion.ADM.NodeInventory -Verb Disable -Arguments @($NodeIds)

    It works if I invoke it through SWQL Studio:

    So I tried using Postman to do pure HTTP/REST, but also didn't have success there:

    Am I doing it wrong?

  • Your PowerShell is a little off.  For the moment - completely ignore the nodeIds XML you are seeing in SWQL Studio. 

    If you look on the right-side of the invoke area, it says System.Int32[] which means an array of integers.  This means that the verb is expecting an integer array as the parameter.

    Your setup is correct - it does need to be a hashtable for the argument.

    $NodeIdsToChange = 1, 7, 11, 1052 # Build the integer array of Node IDs
    
    $NodeIdsToChange | Get-Member | Select-Object -Property TypeName -Unique # Shows the Types
    
    $NodeIdsToChange -is [Array] # Shows if it's an array
    
    $Arguments = @{ nodeIds = $NodeIdsToChange } # Build the arguments
    
    $Arguments | Get-Member | Select-Object -Property TypeName -Unique # Shows the Types
    
    $Arguments -is [Array] # shows that this is NOT an array, even though it contains an array
    

    When you are actually calling the verb, you are sending @( $thing ) as the parameter value.  The @() tells that I want to convert this $thing to an array... but we don't want that.  We want everything packaged up as a single object.

    Sorry for the long post, but Hashtables, Arrays, and PowerShell Custom Objects can get confusing.  I'm hoping this helps some other people as well.

    TL;DR: Remove the @( and ) from around your $NodeIds in the Invoke-SwisVerb line and you should be ok.

  • Thank you for the explanation, I actually thought the @() in -Arguments @($variable) was part of the SwisPowerShell syntax, so this really helped.

    Unfortunately, it doesn't work Disappointed

    I tried with:

    $Arguments = @{ nodeIds = @(2727, 2728)}  #First tried with only one node ID, added a second in case that was the problem
    Invoke-SwisVerb -SwisConnection $swis -EntityName Orion.ADM.NodeInventory -Verb Disable -Arguments $Arguments

    But the nodes still remain with Application Dependency enabled

    Could this be similar to the issue here? Unable to execute EnablePollingForNodes or DisablePollingForNodes - Orion SDK - The Orion Platform - THWACK (solarwinds.com)

  • Perhaps.  I'm assuming when you tweaked your PowerShell script, you didn't get any errors this time?

    I just tested and saw a similar thing.  Best bet is to log an issue on GitHub.  Drop a link to it here and I'll do my own test.  Be sure to outline a few details so that the developers can understand what's what.