11 Replies Latest reply on Mar 25, 2016 11:50 AM by lag

    Is it possible to manage UnDP's with the SDK?

    lag

      I would like to add/remove custom pollers with the SDK. The only thread I found was from 2012, so I wanted to ask if it's possible now.

       

      Thanks!

        • Re: Is it possible to manage UnDP's with the SDK?
          madhavan

          Hi,

           

          You can assign custom pollers to nodes or interfaces. Sample provided below.

           

          New-SwisObject $swis –EntityType 'Orion.NPM.CustomPollerAssignmentOnNode' -Properties @{Description='Test';CustomPollerID='a519ce64-33c3-490c-b0f8-04982911cd3e';NodeID='1';}

           

          use Orion.NPM.CustomPollerAssignmentOnInterface for adding custom pollers to interfaces.

            • Re: Is it possible to manage UnDP's with the SDK?
              lag

              Thanks for pointing that out. I'll give it a go.

              • Re: Is it possible to manage UnDP's with the SDK?
                lag

                What version of Powershell are you using to execute this? I've tried with both version 2 & 3 using both the ISE and Non-ISE versions with no luck.

                 

                The script is able to Get-SwisData, but trying to trying New-SwisObject throws this:

                      New-SwisObject : Operation not supported on Orion.NPM.CustomPollerAssignmentOnNode

                 

                This is the meat and potatoes of how I'm trying to do this:

                 

                    $NodeID             = Get-SwisData $swis "Select NodeID FROM Orion.Nodes WHERE IP_Address = @NodeIP" @{NodeIP = $NodeIP}

                    $CustomPollerID     = Get-SwisData $swis "SELECT CustomPollerID FROM Orion.NPM.CustomPollers WHERE UniqueName = @UnDPName" @{UnDPName = $CustomPollerName}

                 

                    $NodeBag = @{

                        Description='Test';

                        CustomPollerID=[System.Guid]$CustomPollerID;

                        NodeID=[Int]$NodeID;

                    }

                    #New-SwisObject $swis –EntityType 'Orion.NPM.CustomPollerAssignmentOnNode' -Properties @{Description='Test';CustomPollerID='c58f3b64-b9bc-448f-8a82-4975758736f6';NodeID='4466';}

                     New-SwisObject $swis –EntityType 'Orion.NPM.CustomPollerAssignmentOnNode' -Properties $NodeBag

                  • Re: Is it possible to manage UnDP's with the SDK?
                    tdanner

                    The version of powershell wouldn't matter. What version of NPM are you using?

                      • Re: Is it possible to manage UnDP's with the SDK?
                        lag

                        10.7 at the moment. (I've been delaying the 11.5 upgrade until the next NCM is released.)

                          • Re: Is it possible to manage UnDP's with the SDK?
                            tdanner

                            This support was added in 11.5, so it will be waiting for you when you get there.

                              • Re: Is it possible to manage UnDP's with the SDK?
                                lag

                                Sounds like another mark for moving to 11.5. Thanks for the quick responses.

                                • Re: Is it possible to manage UnDP's with the SDK?
                                  lag

                                  Circling back to this finally after upgrading a couple of months ago. There seems to be something I'm still missing.

                                   

                                  function AssignUnDPToNode ($NodeIP, $UnDPName){

                                      [Int]$NodeID = Get-SwisData $swis "Select NodeID FROM Orion.Nodes WHERE IP_Address = @IP" @{IP = $NodeIP}

                                      [System.Guid]$CustomPollerID = Get-SwisData $swis "SELECT CustomPollerID FROM Orion.NPM.CustomPollers WHERE UniqueName = @UName" @{UName = $UnDPName}

                                    

                                      $UnDPProperties = @{

                                      Description = '';

                                      CustomPollerID = $CustomPollerID;

                                      NodeID = $NodeID;

                                      }

                                   

                                      New-SwisObject $swis –EntityType "Orion.NPM.CustomPollerAssignmentOnNode" -Properties $UnDPProperties

                                  }

                                  The error I get is:

                                   

                                  At C:\orionScripts\AssignUnDP\AssignUnDP.ps1:41 char:48

                                  +     Write-Output "$UnDPName assigned to $NodeIP"

                                  +                                                ~

                                  The string is missing the terminator: ".

                                  At C:\orionScripts\AssignUnDP\AssignUnDP.ps1:28 char:47

                                  + function AssignUnDPToNode ($NodeIP, $UnDPName){

                                  +                                               ~

                                  Missing closing '}' in statement block.

                                      + CategoryInfo          : ParserError: (:) [], ParseExcepti

                                      + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString

                                   

                                   

                                  If I comment out the New-SwisObject line, I can Write-Host my NodeID, IP, UnDP Name, and UnDP ID, so I know those are populating. It seems something is breaking or missing in the grab bag perhaps? Any thoughts?