3 Replies Latest reply on Mar 3, 2017 3:24 PM by Michael Halpin

    PowerShell Add Server Node - Details

    chrisagardner63

      I am playing with the CRUD.AddNode.PS1 Example script to get a Server added to SAM.  I can get my server added but, I am not getting the information in the Node Details pane.

       

      I wait for polling to happen, and hit "Poll Now", but the Node Details pane never fills in.  The only way I can get the Node Details to have information is when I goto 'Edit Node" and hit the Test Button in the Polling Method window.

      This is what I have for SNMP in CRUD.AddNode.PS1 and this corresponds to whats in the Polling Method window.

      # SNMP v2 specific

          ObjectSubType = "SNMP";

          SNMPVersion = 2;

        Community = "mystring";

       

       

       

      Thanks for any help.

       

      Chris

        • Re: PowerShell Add Server Node - Details
          tdanner

          Please post more of your code. It sounds like you are either missing the pollers or have the wrong ones assigned.

           

          Also, consider switching to the discovery API. It looks more intimidating (and it kind of is), but it will get you out of the business of having to know which pollers to add. See Discovery · solarwinds/OrionSDK Wiki · GitHub for docs.

            • Re: PowerShell Add Server Node - Details
              chrisagardner63

              I have only added my SNMP Community string to the CRUD.AddNode script.

              I will look at the Discovery API, I found the Poller list (Poller Types · solarwinds/OrionSDK Wiki · GitHub ), but I am not sure what I am looking at.....

              I did change the CPU and Memory Poller to Generic to see what happened.  Results were the same.

               

              $ip = "10.125.14.69"

               

               

              # add a node

              $newNodeProps = @{

                  IPAddress = $ip;

                  EngineID = 1;

               

                  # SNMP v2 specific

                  ObjectSubType = "SNMP";

                  SNMPVersion = 2;

                Community = "mystring"

                  # === default values ===

               

               

                  # EntityType = 'Orion.Nodes'

                  # Caption = ''

                  # DynamicIP = false

                  # PollInterval = 120

                  # RediscoveryInterval = 30

                  # StatCollection = 10 

              }

               

               

              $newNodeUri = New-SwisObject $swis -EntityType "Orion.Nodes" -Properties $newNodeProps

              $nodeProps = Get-SwisObject $swis -Uri $newNodeUri

               

               

              # register specific pollers for the node

              $poller = @{

                  NetObject="N:"+$nodeProps["NodeID"];

                  NetObjectType="N";

                  NetObjectID=$nodeProps["NodeID"];

              }

               

               

              # Status

              $poller["PollerType"]="N.Status.ICMP.Native";

              $pollerUri = New-SwisObject $swis -EntityType "Orion.Pollers" -Properties $poller

               

               

              # Response time

              $poller["PollerType"]="N.ResponseTime.ICMP.Native";

              $pollerUri = New-SwisObject $swis -EntityType "Orion.Pollers" -Properties $poller

               

               

              # Details

              $poller["PollerType"]="N.Details.SNMP.Generic";

              $pollerUri = New-SwisObject $swis -EntityType "Orion.Pollers" -Properties $poller

               

               

              # Uptime

              $poller["PollerType"]="N.Uptime.SNMP.Generic";

              $pollerUri = New-SwisObject $swis -EntityType "Orion.Pollers" -Properties $poller

               

               

              # CPU

              $poller["PollerType"]="N.Cpu.SNMP.Generic";

              $pollerUri = New-SwisObject $swis -EntityType "Orion.Pollers" -Properties $poller

               

               

              # Memory

              $poller["PollerType"]="N.Memory.SNMP.Generic";

              $pollerUri = New-SwisObject $swis -EntityType "Orion.Pollers" -Properties $poller

                • Re: PowerShell Add Server Node - Details
                  Michael Halpin

                  It looks like some of the pollers are missing. I wrapped the necessary ones in a "New-OrionNode" function, which you can call from the PowerOrion module in the SDK, that might be easier than trying to figure out the pollers, but for completeness you can see the SNMPv2 properties from that function (the defaults can be extracted from the default values in the parameters if needed).

                   

                  $newNodeProps = @{
                                      EntityType="Orion.Nodes";
                                      IPAddress=$IPAddress;
                                      IPAddressGUID=$ipGuid;
                                      Caption=$IPAddress;
                                      DynamicIP=$DynamicIP;
                                      EngineID=$engineid;
                                      Status=$status;
                                      UnManaged=$UnManaged;
                                      Allow64BitCounters=$Allow64BitCounters;
                                      Location = "";
                                      Contact = "";
                                      NodeDescription="";
                                      Vendor="";
                                      IOSImage="";
                                      IOSVersion="";
                                      SysObjectID="";
                                      MachineType="";
                                      VendorIcon="";
                                      # SNMP v2 specific
                                      ObjectSubType="SNMP";
                                      SNMPVersion=2;
                                      Community=$Community;
                                      BufferNoMemThisHour="-2";
                                      BufferNoMemToday="-2";
                                      BufferSmMissThisHour="-2";
                                      BufferSmMissToday="-2";
                                      BufferMdMissThisHour="-2";
                                      BufferMdMissToday="-2";
                                      BufferBgMissThisHour="-2";
                                      BufferBgMissToday="-2";
                                      BufferLgMissThisHour="-2";
                                      BufferLgMissToday="-2";
                                      BufferHgMissThisHour="-2";
                                      BufferHgMissToday="-2";
                                      PercentMemoryUsed="-2";
                                      TotalMemory="-2";                   
                                  }