5 Replies Latest reply on Aug 7, 2014 7:00 AM by madhavan

    Adding pollers isn't adding all pollers correctly.

    dkeyser

      Hello all,

       

      I've been messing around with the SDK and I've hit an odd road block.

       

      I can add the node just fine and it'll even check the status for me. It's the other pollers I'm adding that don't seem to be enabling correctly or something. After adding my pollers to a target node I check the DB for those pollers. I not only see that it has all my pollers listed under the pollers table but it also has other pollers I've not assigned to it. These are for interfaces and volumes. I'm surprised these get added and I'm actually liking that they are getting added but the only things I can tell are polling correctly are status and response time.

       

      I'll stick to the first thing at hand, which is why all the pollers I've added are showing up but not polling anything aside from the aforementioned. Why would this be?

       

      Below is part of a very large script I'm developing for adding nodes automatically after a discovery has been run.

      And yes the format of the code is terrible. I've been told this from many an accomplished programmer...

       

      #function to add nodes to Orion

      ##############################################################

      function AddNode ($IPAddress, $IPAddressGUID, $Caption, $EngineID, $Community, $Pollers)

      {

          Write-Host "Entering AddNode Function"

      $AllNodePollers = Get-SwisData $swis "Select Distinct PollerType from Orion.Pollers Where NetObjectType = 'N'"

       

         

          # add a node

          $newNodeProps = @{

              EntityType="Orion.Nodes";

              IPAddress=$IPAddress;

              IPAddressGUID = $IPAddressGUID

              Caption=$Caption;

              DynamicIP=$False;

              EngineID=$EngineID;

              Status=1;

              UnManaged=$False;

              Allow64BitCounters=$False;

              ObjectSubType="SNMP";

              SysObjectID="";

              MachineType="";

              VendorIcon="";

              SNMPVersion="2";

              Community=$Community;

              RediscoveryInterval=5;

              PollInterval=120;

              StatCollection=10;

          }

                 

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

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

       

          $newNodeUri

       

      Write-Host "Entering Node Pollers section"

          ForEach ($PollerAdd in $Pollers)

          {

         

              If($AllNodePollers -contains $PollerAdd -and ($PollerAdd -ne "N.ResponseTime.SNMP.Native" -or $PollerAdd -ne "N.Status.SNMP.Native"))

              {

       

                   Write-Host "Found Poller $PollerAdd"

             

                      $poller = @{

                      PollerType="$PollerAdd";

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

                      NetObjectType="N";

                      NetObjectID=$nodeProps["NodeID"];

                     

                      }

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

                 

               }

       

              }

      Invoke-SwisVerb $swis Orion.Nodes PollNow @("N:" + $NodeID)

          Write-Host "Exiting AddNode Function"

       

      }