solarwinds / OrionSDK

SDK for the SolarWinds Orion platform, including tools, documentation, and samples in PowerShell, C#, Go, Perl, and Java.
https://thwack.com/OrionSDK
Apache License 2.0
401 stars 144 forks source link

Listresource.ps1 Swis function is not working in SAM 2019.4 #223

Open josedhinagar opened 4 years ago

josedhinagar commented 4 years ago

I have installed Orion.SDK and imported powerOrion,SwisPowerShell modules, But facing below issue, while executing.. "

.\ImportListResources.ps1 $swis 2 600 Creating schedule list resources job... Waiting until job status will be 'ReadyForImport'... Importing list resources... Invoke-SwisVerb : Could not load file or assembly 'SolarWinds.Interfaces.Discovery.Strings, Version=3.5.0.638, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. At C:\SAM\New folder\OrionSDK-master\Samples\PowerShell\ImportListResources.ps1:72 char:17

In SAM 2019.4.1 , Noticed that in Swis ,it is looking for version '3.5.0.638' ,while actually we have a updated version '3.5.0.652' in Orion application files Application file: SolarWinds.Interfaces.Discovery.Strings.dll Path :C:\Program Files (x86)\SolarWinds\Orion\Interfaces.Discovery Current Version : 3.5.0.652

My environment have only SAM ,, Kindly requesting some help to overcome this

tdanner commented 4 years ago

Do you have multiple polling engines? The exact build number of that file is not particularly important, but you may be hitting a problem where the polling engine running that operation is just missing that file.

josedhinagar commented 4 years ago

We executed it from Standalone SAM instance,, No polling engine was installed

danjagnow commented 4 years ago

Can you run the script and then retrieve the most recent entries from the SWIS log file on the Orion server? It should be at the following location in a default Orion installation:

C:\ProgramData\SolarWinds\InformationService\v3.0\Orion.InformationService.log

danjagnow commented 4 years ago

See also https://thwack.solarwinds.com/t5/Discussions/How-do-we-programmatically-discover-the-non-interface-properties/m-p/588742#M10352 for the related thread on Thwack.

danjagnow commented 4 years ago

See also https://thwack.solarwinds.com/t5/Discussions/List-resources-volumes-for-agent-managed-nodes-via-SWIS-API/m-p/588745#M10354 for a separate discussion on Thwack of the same issue.

josedhinagar commented 4 years ago

Hi @danjagnow

We checked it today, the error was different,:

PS C:\SAMAgent\OrionSDK-master\Samples\PowerShell> $swis = Connect-Swis -Hostname IP -UserName Admin -Password **** swis.log.txt

.\ImportListResources.ps1 $swis 3 300 Creating schedule list resources job... Waiting until job status will be 'ReadyForImport'... Importing list resources... Invoke-SwisVerb : One of the known types provided to the serializer via 'knownTypes' argument was invalid because it was null. All known types specified must be non-null values. At C:\SAMAgent\OrionSDK-master\Samples\PowerShell\ImportListResources.ps1:72 char:17

SWIS log information:

2020-05-04 07:06:41,346 [11] ERROR SolarWinds.Orion.Core.Models.Discovery.TypeResolverProxy - SwisPowerShell (null) Cannot load type SolarWinds.APM.BlackBox.IIS.Common.Models.Discovery.IISDiscoveredInstance,SolarWinds.APM.BlackBox.IIS.Common 2020-05-04 07:06:41,346 [11] ERROR SolarWinds.InformationService.Core.InformationService - SwisPowerShell (null) Exception for Operation: http://schemas.solarwinds.com/2007/08/informationservice/InformationService/Invoke</a:Action> urn:uuid:b99d773b-d41f-4e0a-8c0c-f2b57d7cad6a</a:MessageID> http://www.w3.org/2005/08/addressing/anonymous</a:Address> </a:ReplyTo>

en-US
<SwisSettings xmlns="http://schemas.solarwinds.com/2007/08/informationservice" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <AppendErrors>true</AppendErrors>
  <ApplicationTag>SwisPowerShell</ApplicationTag>
  <DataProviderTimeout>PT30S</DataProviderTimeout>
</SwisSettings>
<SwisProtocolVersion xmlns="http://schemas.solarwinds.com/2007/08/informationservice">2</SwisProtocolVersion>
<IsBase64EncodingAccepted xmlns="http://schemas.solarwinds.com/2007/08/informationservice">true</IsBase64EncodingAccepted>
<a:To s:mustUnderstand="1">net.tcp://10.85.200.218:17777/SolarWinds/InformationService/v3/Orion/ssl</a:To>
<o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
  <u:Timestamp u:Id="_0">
    <u:Created>2020-05-04T14:06:41.683Z</u:Created>
    <u:Expires>2020-05-04T14:11:41.683Z</u:Expires>
  </u:Timestamp>
  <c:SecurityContextToken u:Id="uuid-4a8d62e7-ca49-4a8c-8085-e0084c8d6722-352" xmlns:c="http://schemas.xmlsoap.org/ws/2005/02/sc">
    <c:Identifier>urn:uuid:12040911-5bee-4909-9867-12dba9ec7ccc</c:Identifier>
  </c:SecurityContextToken>
  <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
    <SignedInfo>
      <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
      </CanonicalizationMethod>
      <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#hmac-sha1">
      </SignatureMethod>
      <Reference URI="#_0">
        <Transforms>
          <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
          </Transform>
        </Transforms>
        <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1">
        </DigestMethod>
        <DigestValue>TWQK2WjcrCwVaK22ZdoFOn1ODuY=</DigestValue>
      </Reference>
    </SignedInfo>
    <SignatureValue>zEXpJfciPjpjuKEgjrf8oH1HFuo=</SignatureValue>
    <KeyInfo>
      <o:SecurityTokenReference>
        <o:Reference URI="#uuid-4a8d62e7-ca49-4a8c-8085-e0084c8d6722-352">
        </o:Reference>
      </o:SecurityTokenReference>
    </KeyInfo>
  </Signature>
</o:Security>

</s:Header>

orion.nodes ImportListResourcesResult b8476e3e-44fb-425f-971f-2e853530096e 3

</s:Body> </s:Envelope> 2020-05-04 07:06:41,346 [11] ERROR SolarWinds.InformationService.Core.InformationService - SwisPowerShell (null) Exception caught in method SolarWinds.InformationService.Core.InformationService.Invoke System.ArgumentException: One of the known types provided to the serializer via 'knownTypes' argument was invalid because it was null. All known types specified must be non-null values.

Server stack trace: at System.Runtime.Serialization.XmlObjectSerializerContext.GetDataContractsForKnownTypes(IList1 knownTypeList) at System.Runtime.Serialization.DataContractSerializer.get_KnownDataContracts() at System.Runtime.Serialization.XmlObjectSerializerContext.GetDataContractFromSerializerKnownTypes(XmlQualifiedName qname) at System.Runtime.Serialization.XmlObjectSerializerContext.ResolveDataContractFromKnownTypes(XmlQualifiedName typeName) at System.Runtime.Serialization.XmlObjectSerializerContext.ResolveDataContractFromKnownTypes(String typeName, String typeNs, DataContract memberTypeContract, Type declaredType) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns) at ReadArrayOfanyTypeFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString , XmlDictionaryString , CollectionDataContract ) at System.Runtime.Serialization.CollectionDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns) at System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName, DataContractResolver dataContractResolver) at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver) at SolarWinds.Orion.Common.SerializationHelper.FromXmlReader[T](XmlReader reader, Boolean verifyObjectName, IEnumerable1 knownTypes) at SolarWinds.Orion.Core.Models.DiscoveredObjects.DiscoveredObjectTree.ReadXml(XmlReader reader) at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadIXmlSerializable(XmlSerializableReader xmlSerializableReader, XmlReaderDelegator xmlReader, XmlDataContract xmlDataContract, Boolean isMemberType) at System.Runtime.Serialization.XmlDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context) at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns) at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, String name, String ns) at ReadDiscoveredObjectTreeWcfWrapperFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] ) at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context) at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns) at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, String name, String ns) at System.Runtime.Serialization.NetDataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName) at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver) at System.Runtime.Serialization.NetDataContractSerializer.ReadObject(XmlDictionaryReader reader, Boolean verifyObjectName) at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.PartInfo.ReadObject(XmlDictionaryReader reader, XmlObjectSerializer serializer) at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part, Boolean isRequest) at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest) at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest) at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(Message message, Object[] parameters) at System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: at SolarWinds.Data.Providers.Orion.Verbs.Nodes.<>c.b__10_0(Exception ex) at SolarWinds.Orion.Core.Common.Proxy.BusinessLayer.CoreBusinessLayerApiProxyExceptionHandlerInterceptor.Intercept(IInvocation invocation) at Castle.DynamicProxy.AbstractInvocation.Proceed() at SolarWinds.Orion.Core.Common.Proxy.BusinessLayer.CoreBusinessLayerApiProxyMethodRedirectInterceptor.Intercept(IInvocation invocation) at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.Proxies.ICoreBusinessLayerProxy.GetOneTimeJobResult(Guid jobId) at SolarWinds.Data.Providers.Orion.Verbs.Nodes.ImportListResourcesResult(String jobId, Int32 nodeId) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at SolarWinds.InformationService.Verb.VerbExecutor.ReflectionInvocation(Object hostInstance, Object[] parameters) at SolarWinds.InformationService.Verb.VerbExecutorContext.Invoke() at SolarWinds.InformationService.Core.InformationService.Invoke[T](String entity, String verb, Action1 setupParameters, Func2 extractReturnValue)

hsehgal609 commented 2 years ago

was this ever resolved?