7 Replies Latest reply on Aug 31, 2012 2:25 PM by MichaelKnee

    JobExecutionException

    MichaelKnee

      Hi - I have a PowerShell script to discover interfaces which has been working fine but is now suddenly throwing .Net exceptions, I wondered if anyone had any ideas what is going on or how I can fix it?

       

      Code is as follows:

       

      This bit works fine & I get the nodeID back:

       

      # Ensure Machine exists in Solar Winds

      $myNodeID = Get-SwisData $swis "SELECT NodeID FROM Orion.Nodes WHERE NodeID='$nodeID'"

      if ($nodeID -eq $null) {

          Write-Output "Error - device NodeID $nodeID does not exist in Solar Winds"

          exit 0

      }

      Write-Output "nodeID: $myNodeID"

       

      This throws an exception:

       

      # Discover interfaces on the node

      $discovered = Invoke-SwisVerb $swis Orion.NPM.Interfaces DiscoverInterfacesOnNode $nodeId

      if ($discovered.Result -ne "Succeed") {

        Write-Host "Error - Interface discovery failed."

      }

       

      Exception:

       

      Invoke-SwisVerb : SolarWinds.JobEngine.WorkerProcess.JobExecutionException: System.ArgumentNullException: Value cannot be null.

      Parameter name: credentials

         at SolarWinds.Orion.Pollers.Framework.SettingsHelper.ValidateCredentials[TCredentials](Credential credentials)

         at SolarWinds.Orion.Pollers.Framework.SNMP.SnmpInventoryBase.DoInventory(GlobalSettingsBase globalSettings, SettingsBase nodeSettings, InventorySettingsBase inventorySettings, Credential credentials)

         at SolarWinds.NPM.DiscoveryPlugin.Activities.InterfacesSnmpInventoryStep.DoNpmDiscovery(NpmDiscoveryConfiguration cfg)

         at SolarWinds.NPM.DiscoveryPlugin.NPMLiteDiscoveryPlugin.<DoDiscovery>d__0.MoveNext()

         at System.Linq.Buffer`1..ctor(IEnumerable`1 source)

         at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)

         at SolarWinds.NPM.Jobs.DiscoveryJob.Execute(IJobExecutionHost host)

         at SolarWinds.JobEngine.WorkerProcess.Job2Adapter.Execute(IInternalJobExecutionHost host)

         at SolarWinds.JobEngine.WorkerProcess.Job2Adapter.Execute(IInternalJobExecutionHost host)

         at SolarWinds.JobEngine.WorkerProcess.JobDecorator.Execute(IInternalJobExecutionHost host)

         at SolarWinds.JobEngine.WorkerProcess.AgentDispatcher.ExecuteJobSynchronously(ActiveJob activeJob)

         at SolarWinds.JobEngine.WorkerProcess.AgentDispatcher.ExecuteJob(ActiveJob activeJob)

         at SolarWinds.JobEngine.WorkerProcess.AgentDispatcher.WorkItemDispatched(Object state)

         at SolarWinds.JobEngine.WorkerProcess.Job2Adapter.Execute(IInternalJobExecutionHost host)

         at SolarWinds.JobEngine.WorkerProcess.JobDecorator.Execute(IInternalJobExecutionHost host)

         at SolarWinds.JobEngine.WorkerProcess.AgentDispatcher.ExecuteJobSynchronously(ActiveJob activeJob)

         at SolarWinds.JobEngine.WorkerProcess.AgentDispatcher.ExecuteJob(ActiveJob activeJob)

         at SolarWinds.JobEngine.WorkerProcess.AgentDispatcher.WorkItemDispatched(Object state)

      At D:\AegisScripts\SolarWinds\DiscoverInterfaces.ps1:38 char:30

      + $discovered = Invoke-SwisVerb <<<<  $swis Orion.NPM.Interfaces DiscoverInterfacesOnNode $nodeId

          + CategoryInfo          : InvalidOperation: (:) [Invoke-SwisVerb], FaultException`1

          + FullyQualifiedErrorId : SwisError,SwisPowerShell.InvokeSwisVerb

        • Re: JobExecutionException
          Bohumil Klimek

          Hello MichaelKnee,

           

          I just tried it, and seems to me that it's working correctly. I used this piece of script (with Node ID = 1):

               [System.Management.Automation.PSCredential] $SWIS_Credentials = Get-Credential

           

               $SWIS_Connection = Connect-Swis -Hostname "YOURHOSTNAME/IP ADDRESS" -Credential $SWIS_Credentials

           

               Invoke-SwisVerb $SWIS_Connection "Orion.NPM.Interfaces" "DiscoverInterfacesOnNode" 1

           

          However, to identify your problem, can you tell me what version of product(s), do you have installed? And also, how you get "$swis" variable in your script?

           

          Thanks,

          Bohumil

          1 of 1 people found this helpful
            • Re: JobExecutionException
              MichaelKnee

              Hi Bohumil - thanks for your reply, my $swis code is as follows though I'm pretty sure it's OK as the "SELECT NodeID" ... bit works OK & I get the nodeID back.

               

              We have two Solar Winds rigs by the way & the code works fine on the other one, I have tried a reboot of the problem rig but I still get the JobEngine error on any nodeID I try to discover interfaces on, though it used to work OK...

               

              Version information is:

               

              Orion Core 2012.1.1, IPAM 3.0, NCM 7.1, NPM 10.3.1, NTA 3.10.0, UDT 2.5.0, IVIM 1.3.0, VNQM 4.0

               

              $password = ConvertTo-SecureString $orionPW -asPlainText -Force

               

              # Load the SwisSnapin if not already loaded

              if (!(Get-PSSnapin | where {$_.Name -eq "SwisSnapin"})) { Add-PSSnapin "SwisSnapin" }

               

              # Connect to the Orion system SDK

              $credential = New-Object System.Management.Automation.PSCredential($orionUser,$password)

              $swis = Connect-Swis -Credential $credential -Hostname $orionHost

               

              Thanks

               

              Mike

                • Re: JobExecutionException
                  tdanner

                  Mike,

                   

                  We are able to get the same error you are seeing when we try it with an SNMPv3 node. Does that match what you are seeing? Works for SNMPv1/2 but fails for SNMPv3?

                   

                  Thanks,

                  Tim

                    • Re: JobExecutionException
                      MichaelKnee

                      Ha! yes - that's exactly what I am seeing, though I could have sworn I'd tested on SNMP V2 nodes & got the same error - I guess I must have lucked out & chosen another V3 node.

                       

                      Sorry I didn't mention SNMP V3 at the start - the whole point of the work I am doing at the moment is to detect if a node is SNMP V2 or V3 & provision into SolarWinds appropriately...

                       

                      Thanks for looking into this for me - do you think there is a workaround? or is it just a case of waiting for the next SDK release?

                       

                      Mike