Quantcast
Channel: THWACK: All Content - Orion SDK
Viewing all 2677 articles
Browse latest View live

Orion Discovery API, errors when not using primary poller

$
0
0

I have two nearly identical discovery profiles, one works fine and the other returns error:

 

The difference between them is that the one that works is on the primary poller and the other is on our second poller, defined within  <EngineId>$EngineID</EngineId> of the Discovery config.

With $EngineID =2 (our HA Orion server) or $EngineID = 3 (1st APE)

I have also just tested this against $EngineID = 4  (2nd APE), which also fails with the same error.

 

I found this log entry in OrionDiscoveryJob.log

 

2017-03-23 14:54:37,454 [STP SmartThreadPool Thread #0] ERROR OrionDiscoveryJob - Unable to deserialize job description.

System.Runtime.Serialization.SerializationException: Error in line 0 position 0. Element 'http://schemas.datacontract.org/2004/07/SolarWinds.Orion.Core.Models.Discovery:DiscoveryPluginJobDescriptionBase' contains data from a type that maps to the name 'http://schemas.solarwinds.com/2008/DeviceStudio:DeviceStudioDiscoveryPluginJobDescription'. The deserializer has no knowledge of any type that maps to this name. Consider using a DataContractResolver if you are using DataContractSerializer or add the type corresponding to 'DeviceStudioDiscoveryPluginJobDescription' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to the serializer.

 

It matches time and date, but not really the problem.

 

Any ideas as to why, or how to fix it?

We installed APEs to take the polling load off our Orion server(s) and this is creating a backward step in automating the discovery process.


Issue with API Creating Discovery

$
0
0

I am having an issue in my production environment this worked fine in a test lab but not production Solarwinds.

The error in the discovery is

 

A Network Discovery job has failed to complete.\r\nState: Failed\r\nProfile id: 106.\r\nThe Job Scheduler is reporting the following error:\r\nSolarWinds.JobEngine.WorkerProcess.JobExecutionException: System.Exception: Unable to deserialize job description. ---> System.Runtime.Serialization.SerializationException: Error in line 0 position 0. Element 'http://schemas.datacontract.org/2004/07/SolarWinds.Orion.Core.Models.Discovery:DiscoveryPluginJobDescriptionBase' contains data from a type that maps to the name 'http://schemas.solarwinds.com/2008/DeviceStudio:DeviceStudioDiscoveryPluginJobDescription'. The deserializer has no knowledge of any type that maps to this name. Consider using a DataContractResolver or add the type corresponding to 'DeviceStudioDiscoveryPluginJobDescription' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to DataContractSerializer.

 

 

Here is the code :

 

       public HttpResponseMessage Post([FromBody]NodeInfo info)

        {

             CustomNodeInfo cnInfo = new CustomNodeInfo();

            #region Hard Coded Values for SaaS

            //Hard coding these for now as this is for just the SaaS Poller currently

            info.EngineID = 12;

            cnInfo.Custom1 = "1";

            cnInfo.Custom2 = "2";

            cnInfo.Custom3 = "3";

            //End Hard Coded

            #endregion

 

 

            info.ObjectSubType = "SNMP";

            info.SNMPVersion = "2";

            info.EntityType = "Orion.Nodes";

            info.DynamicIP = false;

            info.Status = 1;

            info.UnManaged = false;

            info.Allow64BitCounters = false;

            if (ModelState.IsValid)

            {

                string query = "{\"query\":\"SELECT PropertyValue FROM Orion.EngineProperties WHERE EngineID=@e AND PropertyName='Orion.Standard.Polling'\",\"parameters\":{\"e\":" + info.EngineID + "}}";

 

 

                JObject pollingRate = JObject.Parse(SWJsonCall.Post("Json/Query", query));

 

 

                int curRate = (Int32)pollingRate["results"][0]["PropertyValue"];

                if (curRate < 85)

                {

                    #region Start Discovery on New Node

                    var dis = new DiscoveryInfo

                    {

                        Name = "API Add Node " + info.IPAddress,

                        EngineID = info.EngineID,

                        JobTimeoutSeconds = 3600,

                        SearchTimeoutMiliseconds = 5000,

                        SnmpTimeoutMiliseconds = 5000,

                        SnmpRetries = 2,

                        RepeatIntervalMiliseconds = 1800,

                        SnmpPort = 161,

                        HopCount = 0,

                        PreferredSnmpVersion = "SNMP2c",

                        DisableIcmp = false,

                        AllowDuplicateNodes = true,

                        IsAutoImport = true,

                        IsHidden = false,

                    };

                    dis.PluginConfigurations = new List<PluginItems> { new PluginItems { PluginConfigurationItem = DiscoveryProfiles.SNMPv2(info.Community, info.IPAddress) } };

 

 

                    DiscoveryInfo[] disArray = new DiscoveryInfo[] { dis };

 

 

                    string createDiscovery = SWJsonCall.Post("Json/Invoke/Orion.Discovery/StartDiscovery", JsonConvert.SerializeObject(disArray));

                    #endregion

 

 

                    JObject disStatus = null;

                    Stopwatch time = new Stopwatch();

                    time.Start();

                    do

                    {

                        string statusQuery = "{\"query\":\"SELECT Status,StatusDescription FROM Orion.DiscoveryProfiles where ProfileID=@id\",\"parameters\":{\"id\":\"" + createDiscovery + "\"}}";

                        disStatus = JObject.Parse(SWJsonCall.Post("Json/Query", statusQuery));

                        if (time.ElapsedMilliseconds > 120000) return Request.CreateResponse(HttpStatusCode.RequestTimeout, "This has taken over 120 seconds it should not take that long this might be something wrong with the information provided.");

                    } while (disStatus["results"][0]["Status"].ToString() == "0" || disStatus["results"][0]["Status"].ToString() == "1" || !disStatus["results"].HasValues);

 

 

                    if (disStatus["results"][0]["Status"].ToString() == "2")

                    {

                        string nodeQuery = "{\"query\":\"SELECT Uri,NodeID FROM Orion.Nodes where IPAddress=@ip AND EngineID=@e\",\"parameters\":{\"ip\":\"" + info.IPAddress + "\", \"e\": " + info.EngineID + "}}";

                        JObject nodeStatus = JObject.Parse(SWJsonCall.Post("Json/Query", nodeQuery));

                        string swisUrl = nodeStatus["results"][0]["Uri"].ToString();

                        string updateProps = SWJsonCall.Post("Json/" + swisUrl + "/CustomProperties", JsonConvert.SerializeObject(cnInfo));

                    }

                    else return Request.CreateResponse(HttpStatusCode.ExpectationFailed, disStatus["results"][0]["StatusDescription"].ToString());

 

 

                    return new HttpResponseMessage(HttpStatusCode.Created);

                }

                else

                {

                    return Request.CreateResponse(HttpStatusCode.InternalServerError, "Polling rate at dangerous level " + curRate + "%. Please consult Admins, node NOT added.");

                }

            }

            else

            {

                var message = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage));

                var execption = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.Exception));

                return Request.CreateResponse(HttpStatusCode.BadRequest, "Error - " + message + " : " + execption);

            }

        }

 

 

 

Here is the discovery profile model.

 

        public static string SNMPv2(string community, string ipaddress)

        {

            string discoveryProfileXML = "<PluginItems xmlns=\"http://schemas.datacontract.org/2004/07/SolarWinds.Orion.Core.Models.Discovery\">\n" +

            "<knownTypes>\n" +

            "<ArrayOfstring xmlns=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">\n" +

            "<string>SolarWinds.Orion.Core.Models.Discovery.CoreDiscoveryPluginConfiguration,SolarWinds.Orion.Core.Models</string>\n" +

            "</ArrayOfstring>\n" +

            "</knownTypes>\n" +

            "<pluginItem>\n" +

            "<ArrayOfDiscoveryPluginConfigurationBase xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">\n" +

            "<DiscoveryPluginConfigurationBase i:type=\"d2p1:CoreDiscoveryPluginConfiguration\" xmlns:d2p1=\"http://schemas.solarwinds.com/2008/Orion\">\n" +

            "<d2p1:AddressRange/>\n" +

            "<d2p1:AgentsAddresses xmlns:d3p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\"/>\n" +

            "<d2p1:BulkList xmlns:d3p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\n" +

            "<d3p1:string>"+ipaddress+"</d3p1:string>\n" +

            "</d2p1:BulkList>\n" +

            "<d2p1:Credentials>\n" +

            "<d2p1:credentials>\n" +

            "<knownTypes>\n" +

            "<ArrayOfstring xmlns=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\n" +

            "<string>SolarWinds.Orion.Core.Models.Credentials.SnmpCredentialsV2,SolarWinds.Orion.Core.Models</string>\n" +

            "</ArrayOfstring>\n" +

            "</knownTypes>\n" +

            "<pluginItem>\n" +

            "<d2p1:ArrayOfCredential>\n" +

            "<d2p1:Credential i:type=\"d2p1:SnmpCredentialsV2\">\n" +

            "<d2p1:Description i:nil=\"true\"/>\n" +

            "<d2p1:ID i:nil=\"true\"/>\n" +

            "<d2p1:IsBroken>false</d2p1:IsBroken>\n" +

            "<d2p1:Name>"+community+"</d2p1:Name>\n" +

            "<d2p1:Owner i:nil=\"true\"/>\n" +

            "<d2p1:Community>"+community+"</d2p1:Community>\n" +

            "</d2p1:Credential>\n" +

            "</d2p1:ArrayOfCredential>\n" +

            "</pluginItem>\n" +

            "</d2p1:credentials>\n" +

            "</d2p1:Credentials>\n" +

            "<d2p1:DiscoverAgentNodes>false</d2p1:DiscoverAgentNodes>\n" +

            "<d2p1:SharedCredentials xmlns:d3p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\"/>\n" +

            "<d2p1:SubnetList/>\n" +

            "<d2p1:WmiRetries>1</d2p1:WmiRetries>\n" +

            "<d2p1:WmiRetryInterval>PT10S</d2p1:WmiRetryInterval>\n" +

            "</DiscoveryPluginConfigurationBase>\n" +

            "</ArrayOfDiscoveryPluginConfigurationBase>\n" +

            "</pluginItem>\n" +

            "</PluginItems>\n";

 

 

            return discoveryProfileXML;

        }

Filter: where node is not muted

$
0
0

Thank you in advance.

 

Since the default "Active Alerts View" does not automatically clear the instance of the alert once that node has been set to mute; I have replicated (somewhat) the Active Alerts View to filter in the alerts that needs to be visible to the NOC.  So when the NOC sees the alert, it gets escalated, then the engineer would "mute" the alert, thus, would also remove the alert from view.

 

In the SWQL code below, when I run the query it takes a loooong time to complete.

 

Question.  Is there a simple way to filter out if the node has been muted? 

 

 

Thanks again.

 

 

SELECT  DISTINCT

 

  o.AlertConfigurations.Name AS [ALERT NAME] 

    ,'/Orion/NetPerfMon/ActiveAlertDetails.aspx?NetObject=AAT:' + ToString(o.AlertObjectID) AS [_LinkFor_ALERT NAME]

,Case

WHEN o.AlertConfigurations.Severity = '0' THEN ('/Orion/images/ActiveAlerts/Serious.png')

WHEN o.AlertConfigurations.Severity = '1' THEN ('/Orion/images/ActiveAlerts/Warning.png')

WHEN o.AlertConfigurations.Severity = '2' THEN ('/Orion/images/ActiveAlerts/Critical.png')

WHEN o.AlertConfigurations.Severity = '3' THEN ('/Orion/images/ActiveAlerts/InformationalAlert.png')

WHEN o.AlertConfigurations.Severity = '4' THEN ('/Orion/images/ActiveAlerts/Notice.png')

End as [_IconFor_ALERT NAME]

 

  ,o.AlertActive.TriggeredMessage AS [ALERT MESSAGE] 

  ,o.EntityCaption AS [ALERT OBJECT] 

  ,o.EntityDetailsURL AS [_LinkFor_ALERT OBJECT]

 

,CASE WHEN o.AlertActive.TriggeredDateTime IS NULL THEN NULL ELSE (

    TOSTRING(FLOOR(MINUTEDIFF(o.AlertActive.TriggeredDateTime,GETUTCDATE())/60.0)) + 'h ' +

    TOSTRING(MINUTEDIFF(o.AlertActive.TriggeredDateTime,GETUTCDATE())%60) + 'm'

) END AS [ACTIVE TIME]

 

    ,o.RelatedNodeCaption AS [RELATED NODE] 

,o.RelatedNodeDetailsURL AS [_LinkFor_RELATED NODE] 

 

FROM Orion.AlertObjects o 

left join orion.nodes n on n.caption = o.EntityCaption

 

LEFT OUTER JOIN Orion.AuditingEvents AS AE ON AE.AuditEventMessage LIKE CONCAT('%', CASE

          WHEN EntityUri LIKE 'swis://%/Orion/Orion.Nodes/NodeID=%' AND EntityUri NOT LIKE 'swis://%/Orion/Orion.Nodes/NodeID=%/%'

             THEN N.NodeName

                    ELSE 'Wrong'

       END, '%') AND [EntityUri] LIKE CONCAT('%=', AE.NetObjectID)

INNER JOIN Orion.AuditingActionTypes AS AT ON AE.ActionTypeID = AT.ActionTypeID

 

WHERE o.AlertActive.TriggeredMessage <> '' and o.AlertConfigurations.Name = 'Critical' and [AT].ActionTypeDisplayName not like '%mute%'

 

ORDER by o.AlertActive.TriggeredDateTime

Can any one supply a REST example of how to define a Node in Solarwinds

$
0
0

I am developing an integration agent for SolarWindws and would like to use the REST API to add nodes to SolarWindws and change the system name

APIs compatibility NPM 10.6.1 / NCM 7.2.2 and NPM 12.1 / NCM 7.6

$
0
0

Could you please advise whether the APIs configured to work with NPM 10.6.1 and NCM 7.2.2 will work after upgrade to NPM 12.1 and NCM 7.6 or whether there are major changes in API that would prevent this and have you got any documentation on this?

 

Thanks

NCM job execution from API

$
0
0

Hi,

 

I know we can execute a script on a node from an API call. For me, this would be the final solution.

 

As an intermediate step, I was wondering if we could create an NCM Job (type = execute script on a node) that could be reviewed and planned for execution by an operator. In some way, it would be in disabled / latent mode.

 

Can we do this ?

IPAM API Bug?

$
0
0

When adding IPAddresses to a subnet by using the followind inside a loop :

 

$IPProperties = @{

    SubnetId=$SubnetId;

    IPAddress=$Current_ip   

  }

New-SwisObject $IPAMswis -EntityType "IPAM.IPNode" -Properties $IPProperties

 

you only see the first page of IP addresses populated in the GUI. However if you query the DB they are all there.

The reason behind this is that the column IPOrdinal in the IPAM_GroupNodetable does not get automatically populated and is left out as NULL. The fix that I found was manually inserting values (0 - [IP_Count]) into the table via SQL (the field is not editable via the API).

 

Anyone else encounter this bug?

Create NTA IP Address Group by API

$
0
0

Hi Guys,

currently I have the challenge to create "NTA IP Address Groups", at the moment this is a manual process by either creating an xml file and importing this into NTA, or in case of minor changes, editing the list manually (see screenshot)

 

I can see that some of the information is stored in Orion.NetFlow.IPAddressGroups, but not the actual Range.

Is there a Verb to add an NTA IP Group? Is there any way to add an IP Address Group?

 

Thanks!


Issue Acknowledging Alert thru SDK

$
0
0

I have am trying to acknowledge an alert thru the JSON api.  My post looks like this

 

https://localhost:17778/SolarWinds/InformationService/v3/Json/Invoke/Orion.AlertStatus/Acknowledge

PAYLOAD: [[{"DefinitionId":"61957fe9-f3c6-4340-b45c-40936772abb1","ObjectType":"Virtual Datastore","ObjectId":"82298","Notes":"[xMatters] (2399091): mivy responded with \"Acknowledge\"."}]]

 

There are also several AppendNote functions that do not appear to work such as

https://localhost:17778/SolarWinds/InformationService/v3/Json/Invoke/Orion.AlertActive/AppendNote

PAYLOAD: [[512],"[xMatters] (undefined): Notification Delivered to mivy on iPhone App"]

 

However on the solarwinds side in the information service v3 logs I only see one error message

2017-08-30 08:12:50,178 [140] ERROR SolarWinds.Data.Providers.Orion.Verbs.Alerts - (null) (null)  Multiple AlertObjects founded for AlertID:61957fe9-f3c6-4340-b45c-40936772abb1 and ActiveObject:82298

 

Any help on what could cause this type of issue?

add node using powershell

$
0
0

We are trying to automate the server build process so wanted to know how to add node in solarwinds using powershell for monitoring.

Orion.APM.Component - Delete or Create individual components using API

$
0
0

Hello Orion SDK Community,

 

I've verified through the Metadata.Entity namespace/table that the Orion.APM.Component table is only available through the API to read or invoke - not the ability to delete, create, or update.

I really need this ability through the API to do exactly those operations... delete/create/update.

 

To that end, I began inspecting web calls through the GUI and found the following operations:

 

http://localserver/Orion/APM/Services/Components.asmx/DeleteComponents (For delete operation)

 

http://localserver/Orion/APM/Services/Components.asmx/CopyToApplicationTemplate (For create operation)

 

all referenced in the following file:

C:\inetpub\SolarWinds\Orion\APM\Services\Components.asmx

 

I was using these services recently with JSON and normal authentication successfully until I recently installed hotfixes during an upgrade to 12.1 -

The account i'm using to make the request has all possible access/permissions enabled and yet I'm getting a 401 unauthorized error as a response:

{

  "Message": "Authentication failed.",

  "StackTrace": null,

  "ExceptionType": "System.InvalidOperationException"

}

 

Credentials are correct, but failing. Other than these methods to delete/create, are there any other options in the API for creating / deleting components? I see an Invoke property is set to true, but no verbs that I'm aware of.

 

I would really hate to resort to deleting / adding components using SQL - not even sure that would work for the create, but not ideal.

 

Thank you,

 

=swql

 

tdanner  / tomas.vrabel

 

 

REST API - Network Sonar Discovery Gets Created, but fails to complete

$
0
0

Hello Orion SDK Community,

 

I have automation in place that is working to create discoveries, run the discovery, and complete the import - I have this working fine in multiple instances of solarwinds.

However in one specific instance (which is on the same version of NPM and all other modules) I'm getting a few random errors. Any help would be greatly appreciated.

 

One set of weird errors:

2017-08-22 15:58:54,105 [85] ERROR SolarWinds.Orion.Core.SharedCredentials.CredentialDAL - (null) (null)     Unable to find credential with ID = 3, owner =  and credentialType = SolarWinds.Orion.Core.SharedCredentials.Credentials.UsernamePasswordCredential

2017-08-22 15:59:35,215 [17] ERROR SolarWinds.InformationService.Core.InformationService - (null) (null)     Exception for Operation: <root type="array">

  <item type="number">18</item>

</root>

 

I should note that CredentialID 3 is type: SolarWinds.Orion.Core.Models.Credentials.SnmpCredentialsV2 NOT SolarWinds.Orion.Core.SharedCredentials.Credentials.UsernamePasswordCredential,

so I'm wondering why it is being interpreted as a different type.

 

Here is the statusdescription as reported by Orion.DiscoveryProfiles - I'm not suer why it is referencing "DeviceStudioDiscoveryPluginJobDescription" when I only am using the Core, Interface, and VIM Plugins....

 

Network Discovery job has failed to complete.\r\nState: Failed\r\nProfile id: 28.\r\nThe Job Scheduler is reporting the following error:\r\nSolarWinds.JobEngine.WorkerProcess.JobExecutionException: System.Exception: Unable to deserialize job description. ---> System.Runtime.Serialization.SerializationException: Error in line 0 position 0. Element 'http://schemas.datacontract.org/2004/07/SolarWinds.Orion.Core.Models.Discovery:DiscoveryPluginJobDescriptionBase' contains data from a type that maps to the name 'http://schemas.solarwinds.com/2008/DeviceStudio:DeviceStudioDiscoveryPluginJobDescription'. The deserializer has no knowledge of any type that maps to this name. Consider using a DataContractResolver if you are using DataContractSerializer or add the type corresponding to 'DeviceStudioDiscoveryPluginJobDescription' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to the serializer.

   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 ReadArrayOfDiscoveryPluginJobDescriptionBaseFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString , XmlDictionaryString , CollectionDataContract )

   at System.Runtime.Serialization.CollectionDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)

   at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)

   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 ReadDiscoveryJobDescriptionFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )

   at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)

   at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)

   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 System.Runtime.Serialization.DataContractSerializer.ReadObject(XmlReader reader, Boolean verifyObjectName)

   at SolarWinds.Orion.Common.SerializationHelper.FromXmlReader[T](XmlReader reader, Boolean verifyObjectName, IEnumerable`1 knownTypes)

   at SolarWinds.Orion.Common.SerializationHelper.FromXmlReader[T](XmlReader reader, IEnumerable`1 knownTypes)

   at SolarWinds.Orion.Discovery.Job.OrionDiscoveryJob.GetDiscoveryJobContext(String jobDetailConfiguration, IDiscoveryPluginFactory pluginFactory, List`1& plugins)

   --- End of inner exception stack trace ---

   at SolarWinds.Orion.Discovery.Job.OrionDiscoveryJob.GetDiscoveryJobContext(String jobDetailConfiguration, IDiscoveryPluginFactory pluginFactory, List`1& plugins)

   at SolarWinds.Orion.Discovery.Job.OrionDiscoveryJob.ConfigureJobContext()

   at SolarWinds.Orion.Discovery.Job.OrionDiscoveryJob.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)

 

Lastly, here is my discovery context:

[

  "Name": "AutoDiscovery_08222017035855", 

  "EngineID":5, 

  "JobTimeoutSeconds": 3600, 

  "SearchTimeoutMiliseconds": 3000, 

  "SnmpTimeoutMiliseconds": 2000, 

  "SnmpRetries": 1, 

  "RepeatIntervalMiliseconds": 1800, 

  "SnmpPort": 161, 

  "HopCount": 0, 

  "PreferredSnmpVersion": "SNMP2c", 

  "DisableIcmp": "False", 

  "AllowDuplicateNodes": "True", 

  "IsAutoImport": "False", 

  "IsHidden": "False", 

  "PluginConfigurations":

       {"PluginConfigurationItem": "<?xml version=\"1.0\" encoding=\"utf-16\"?><PluginItems><knownTypes><ArrayOfstring xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\"><string>SolarWinds.Orion.Core.Models.Discovery.CoreDiscoveryPluginConfiguration,SolarWinds.Orion.Core.Models</string></ArrayOfstring></knownTypes><pluginItem><ArrayOfDiscoveryPluginConfigurationBase xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://schemas.datacontract.org/2004/07/SolarWinds.Orion.Core.Models.Discovery\"><DiscoveryPluginConfigurationBase xmlns:d2p1=\"http://schemas.solarwinds.com/2008/Orion\" i:type=\"d2p1:CoreDiscoveryPluginConfiguration\"><d2p1:ActiveDirectoryList /><d2p1:AddressRange /><d2p1:AgentsAddresses xmlns:d3p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\" /><d2p1:AutoImportVolumeTypes xmlns:d3p1=\"http://schemas.datacontract.org/2004/07/SolarWinds.Common.Snmp\" i:nil=\"true\" /><d2p1:BulkList xmlns:d3p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\"><d3p1:string>10.75.146.120</d3p1:string><d3p1:string>10.75.146.121</d3p1:string><d3p1:string>10.75.146.122</d3p1:string></d2p1:BulkList><d2p1:Credentials><d2p1:credentials><knownTypes><ArrayOfstring xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\" /></knownTypes><pluginItem><d2p1:ArrayOfCredential xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" /></pluginItem></d2p1:credentials></d2p1:Credentials><d2p1:DiscoverAgentNodes>false</d2p1:DiscoverAgentNodes><d2p1:PreferredPollingMethod>SNMP</d2p1:PreferredPollingMethod><d2p1:SharedCredentials xmlns:d3p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\"><d3p1:KeyValueOfintint><d3p1:Key>1</d3p1:Key><d3p1:Value>3</d3p1:Value></d3p1:KeyValueOfintint></d2p1:SharedCredentials><d2p1:SubnetList /><d2p1:WMICredentials /><d2p1:WmiRetries>1</d2p1:WmiRetries><d2p1:WmiRetryInterval>PT1.5S</d2p1:WmiRetryInterval></DiscoveryPluginConfigurationBase></ArrayOfDiscoveryPluginConfigurationBase></pluginItem></PluginItems>"}, 

       {"PluginConfigurationItem": "<?xml version=\"1.0\" encoding=\"utf-16\"?><PluginItems><knownTypes><ArrayOfstring xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\"><string>SolarWinds.Interfaces.Common.Models.Discovery.InterfacesDiscoveryPluginConfiguration,SolarWinds.Interfaces.Common</string></ArrayOfstring></knownTypes><pluginItem><ArrayOfDiscoveryPluginConfigurationBase xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://schemas.datacontract.org/2004/07/SolarWinds.Orion.Core.Models.Discovery\"><DiscoveryPluginConfigurationBase xmlns:d2p1=\"http://schemas.solarwinds.com/2008/Interfaces\" i:type=\"d2p1:InterfacesDiscoveryPluginConfiguration\"><d2p1:AutoImportExpressionFilter xmlns:d3p1=\"http://schemas.datacontract.org/2004/07/\" /><d2p1:AutoImportStatus xmlns:d3p1=\"http://schemas.datacontract.org/2004/07/SolarWinds.Interfaces.Common.Enums\"><d3p1:IfAutoImportStatus>Up</d3p1:IfAutoImportStatus></d2p1:AutoImportStatus><d2p1:AutoImportVirtualTypes xmlns:d3p1=\"http://schemas.datacontract.org/2004/07/System\"><d3p1:boolean>false</d3p1:boolean></d2p1:AutoImportVirtualTypes><d2p1:AutoImportVlanPortTypes xmlns:d3p1=\"http://schemas.datacontract.org/2004/07/SolarWinds.Orion.Core.Models.Enums\" /><d2p1:DiscoverVLANs>false</d2p1:DiscoverVLANs></DiscoveryPluginConfigurationBase></ArrayOfDiscoveryPluginConfigurationBase></pluginItem></PluginItems>"},

       {"PluginConfigurationItem": "<?xml version=\"1.0\" encoding=\"utf-16\"?><PluginItems><knownTypes><ArrayOfstring xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\"><string>SolarWinds.VIM.Common.Configuration.VimDiscoveryPluginConfiguration,SolarWinds.VIM.Common</string><string>SolarWinds.VIM.Common.Configuration.HyperVDiscoveryPluginConfiguration,SolarWinds.VIM.Common</string></ArrayOfstring></knownTypes><pluginItem><ArrayOfDiscoveryPluginConfigurationBase xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://schemas.datacontract.org/2004/07/SolarWinds.Orion.Core.Models.Discovery\"><DiscoveryPluginConfigurationBase xmlns:d2p1=\"http://schemas.solarwinds.com/2008/Virtualization\" i:type=\"d2p1:VimDiscoveryPluginConfiguration\"><d2p1:IsDiscoveryForVimEnabled>true</d2p1:IsDiscoveryForVimEnabled><d2p1:SelectedVmWareCredentials xmlns:d3p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\" /></DiscoveryPluginConfigurationBase><DiscoveryPluginConfigurationBase xmlns:d2p1=\"http://schemas.solarwinds.com/2008/Virtualization\" i:type=\"d2p1:HyperVDiscoveryPluginConfiguration\" /></ArrayOfDiscoveryPluginConfigurationBase></pluginItem></PluginItems>"}

 

}

]

 

Thank you,


=SWQL

 

 

Issue with API Creating Discovery

$
0
0

I am having an issue in my production environment this worked fine in a test lab but not production Solarwinds.

The error in the discovery is

 

A Network Discovery job has failed to complete.\r\nState: Failed\r\nProfile id: 106.\r\nThe Job Scheduler is reporting the following error:\r\nSolarWinds.JobEngine.WorkerProcess.JobExecutionException: System.Exception: Unable to deserialize job description. ---> System.Runtime.Serialization.SerializationException: Error in line 0 position 0. Element 'http://schemas.datacontract.org/2004/07/SolarWinds.Orion.Core.Models.Discovery:DiscoveryPluginJobDescriptionBase' contains data from a type that maps to the name 'http://schemas.solarwinds.com/2008/DeviceStudio:DeviceStudioDiscoveryPluginJobDescription'. The deserializer has no knowledge of any type that maps to this name. Consider using a DataContractResolver or add the type corresponding to 'DeviceStudioDiscoveryPluginJobDescription' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to DataContractSerializer.

 

 

Here is the code :

 

       public HttpResponseMessage Post([FromBody]NodeInfo info)

        {

             CustomNodeInfo cnInfo = new CustomNodeInfo();

            #region Hard Coded Values for SaaS

            //Hard coding these for now as this is for just the SaaS Poller currently

            info.EngineID = 12;

            cnInfo.Custom1 = "1";

            cnInfo.Custom2 = "2";

            cnInfo.Custom3 = "3";

            //End Hard Coded

            #endregion

 

 

            info.ObjectSubType = "SNMP";

            info.SNMPVersion = "2";

            info.EntityType = "Orion.Nodes";

            info.DynamicIP = false;

            info.Status = 1;

            info.UnManaged = false;

            info.Allow64BitCounters = false;

            if (ModelState.IsValid)

            {

                string query = "{\"query\":\"SELECT PropertyValue FROM Orion.EngineProperties WHERE EngineID=@e AND PropertyName='Orion.Standard.Polling'\",\"parameters\":{\"e\":" + info.EngineID + "}}";

 

 

                JObject pollingRate = JObject.Parse(SWJsonCall.Post("Json/Query", query));

 

 

                int curRate = (Int32)pollingRate["results"][0]["PropertyValue"];

                if (curRate < 85)

                {

                    #region Start Discovery on New Node

                    var dis = new DiscoveryInfo

                    {

                        Name = "API Add Node " + info.IPAddress,

                        EngineID = info.EngineID,

                        JobTimeoutSeconds = 3600,

                        SearchTimeoutMiliseconds = 5000,

                        SnmpTimeoutMiliseconds = 5000,

                        SnmpRetries = 2,

                        RepeatIntervalMiliseconds = 1800,

                        SnmpPort = 161,

                        HopCount = 0,

                        PreferredSnmpVersion = "SNMP2c",

                        DisableIcmp = false,

                        AllowDuplicateNodes = true,

                        IsAutoImport = true,

                        IsHidden = false,

                    };

                    dis.PluginConfigurations = new List<PluginItems> { new PluginItems { PluginConfigurationItem = DiscoveryProfiles.SNMPv2(info.Community, info.IPAddress) } };

 

 

                    DiscoveryInfo[] disArray = new DiscoveryInfo[] { dis };

 

 

                    string createDiscovery = SWJsonCall.Post("Json/Invoke/Orion.Discovery/StartDiscovery", JsonConvert.SerializeObject(disArray));

                    #endregion

 

 

                    JObject disStatus = null;

                    Stopwatch time = new Stopwatch();

                    time.Start();

                    do

                    {

                        string statusQuery = "{\"query\":\"SELECT Status,StatusDescription FROM Orion.DiscoveryProfiles where ProfileID=@id\",\"parameters\":{\"id\":\"" + createDiscovery + "\"}}";

                        disStatus = JObject.Parse(SWJsonCall.Post("Json/Query", statusQuery));

                        if (time.ElapsedMilliseconds > 120000) return Request.CreateResponse(HttpStatusCode.RequestTimeout, "This has taken over 120 seconds it should not take that long this might be something wrong with the information provided.");

                    } while (disStatus["results"][0]["Status"].ToString() == "0" || disStatus["results"][0]["Status"].ToString() == "1" || !disStatus["results"].HasValues);

 

 

                    if (disStatus["results"][0]["Status"].ToString() == "2")

                    {

                        string nodeQuery = "{\"query\":\"SELECT Uri,NodeID FROM Orion.Nodes where IPAddress=@ip AND EngineID=@e\",\"parameters\":{\"ip\":\"" + info.IPAddress + "\", \"e\": " + info.EngineID + "}}";

                        JObject nodeStatus = JObject.Parse(SWJsonCall.Post("Json/Query", nodeQuery));

                        string swisUrl = nodeStatus["results"][0]["Uri"].ToString();

                        string updateProps = SWJsonCall.Post("Json/" + swisUrl + "/CustomProperties", JsonConvert.SerializeObject(cnInfo));

                    }

                    else return Request.CreateResponse(HttpStatusCode.ExpectationFailed, disStatus["results"][0]["StatusDescription"].ToString());

 

 

                    return new HttpResponseMessage(HttpStatusCode.Created);

                }

                else

                {

                    return Request.CreateResponse(HttpStatusCode.InternalServerError, "Polling rate at dangerous level " + curRate + "%. Please consult Admins, node NOT added.");

                }

            }

            else

            {

                var message = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage));

                var execption = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.Exception));

                return Request.CreateResponse(HttpStatusCode.BadRequest, "Error - " + message + " : " + execption);

            }

        }

 

 

 

Here is the discovery profile model.

 

        public static string SNMPv2(string community, string ipaddress)

        {

            string discoveryProfileXML = "<PluginItems xmlns=\"http://schemas.datacontract.org/2004/07/SolarWinds.Orion.Core.Models.Discovery\">\n" +

            "<knownTypes>\n" +

            "<ArrayOfstring xmlns=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">\n" +

            "<string>SolarWinds.Orion.Core.Models.Discovery.CoreDiscoveryPluginConfiguration,SolarWinds.Orion.Core.Models</string>\n" +

            "</ArrayOfstring>\n" +

            "</knownTypes>\n" +

            "<pluginItem>\n" +

            "<ArrayOfDiscoveryPluginConfigurationBase xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">\n" +

            "<DiscoveryPluginConfigurationBase i:type=\"d2p1:CoreDiscoveryPluginConfiguration\" xmlns:d2p1=\"http://schemas.solarwinds.com/2008/Orion\">\n" +

            "<d2p1:AddressRange/>\n" +

            "<d2p1:AgentsAddresses xmlns:d3p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\"/>\n" +

            "<d2p1:BulkList xmlns:d3p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\n" +

            "<d3p1:string>"+ipaddress+"</d3p1:string>\n" +

            "</d2p1:BulkList>\n" +

            "<d2p1:Credentials>\n" +

            "<d2p1:credentials>\n" +

            "<knownTypes>\n" +

            "<ArrayOfstring xmlns=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\n" +

            "<string>SolarWinds.Orion.Core.Models.Credentials.SnmpCredentialsV2,SolarWinds.Orion.Core.Models</string>\n" +

            "</ArrayOfstring>\n" +

            "</knownTypes>\n" +

            "<pluginItem>\n" +

            "<d2p1:ArrayOfCredential>\n" +

            "<d2p1:Credential i:type=\"d2p1:SnmpCredentialsV2\">\n" +

            "<d2p1:Description i:nil=\"true\"/>\n" +

            "<d2p1:ID i:nil=\"true\"/>\n" +

            "<d2p1:IsBroken>false</d2p1:IsBroken>\n" +

            "<d2p1:Name>"+community+"</d2p1:Name>\n" +

            "<d2p1:Owner i:nil=\"true\"/>\n" +

            "<d2p1:Community>"+community+"</d2p1:Community>\n" +

            "</d2p1:Credential>\n" +

            "</d2p1:ArrayOfCredential>\n" +

            "</pluginItem>\n" +

            "</d2p1:credentials>\n" +

            "</d2p1:Credentials>\n" +

            "<d2p1:DiscoverAgentNodes>false</d2p1:DiscoverAgentNodes>\n" +

            "<d2p1:SharedCredentials xmlns:d3p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\"/>\n" +

            "<d2p1:SubnetList/>\n" +

            "<d2p1:WmiRetries>1</d2p1:WmiRetries>\n" +

            "<d2p1:WmiRetryInterval>PT10S</d2p1:WmiRetryInterval>\n" +

            "</DiscoveryPluginConfigurationBase>\n" +

            "</ArrayOfDiscoveryPluginConfigurationBase>\n" +

            "</pluginItem>\n" +

            "</PluginItems>\n";

 

 

            return discoveryProfileXML;

        }

Orion Discovery API, errors when not using primary poller

$
0
0

I have two nearly identical discovery profiles, one works fine and the other returns error:

 

The difference between them is that the one that works is on the primary poller and the other is on our second poller, defined within  <EngineId>$EngineID</EngineId> of the Discovery config.

With $EngineID =2 (our HA Orion server) or $EngineID = 3 (1st APE)

I have also just tested this against $EngineID = 4  (2nd APE), which also fails with the same error.

 

I found this log entry in OrionDiscoveryJob.log

 

2017-03-23 14:54:37,454 [STP SmartThreadPool Thread #0] ERROR OrionDiscoveryJob - Unable to deserialize job description.

System.Runtime.Serialization.SerializationException: Error in line 0 position 0. Element 'http://schemas.datacontract.org/2004/07/SolarWinds.Orion.Core.Models.Discovery:DiscoveryPluginJobDescriptionBase' contains data from a type that maps to the name 'http://schemas.solarwinds.com/2008/DeviceStudio:DeviceStudioDiscoveryPluginJobDescription'. The deserializer has no knowledge of any type that maps to this name. Consider using a DataContractResolver if you are using DataContractSerializer or add the type corresponding to 'DeviceStudioDiscoveryPluginJobDescription' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to the serializer.

 

It matches time and date, but not really the problem.

 

Any ideas as to why, or how to fix it?

We installed APEs to take the polling load off our Orion server(s) and this is creating a backward step in automating the discovery process.

Discovery Function Question (PowerShell)

$
0
0

I am attempting to create some functions inside of a larger script that will create a basic SNMP Discovery job. All of the details in the function were pulled from my base script that works without any issues. It seems that something about passing the values across in this manner is causing a ruckus.

 

SAMPLE

 

#region Connect to SWIS
# Import the SolarWinds PowerShell Module if needed


If (!(Get-Module SwisPowerShell)) {
    Import-Module SwisPowerShell
}


# Connect to SWIS


$hostname = "hostname here"
$swis = Connect-Swis -Trusted -Hostname $hostname


#endregion


#region Functions
# $nodeList $snmpID
FUNCTION New-CoreParameter ($ipAddresses, $snmpCredentialID) {
<#
.SYNOPSIS    Creates the Core Parameter for Sonar Discovery
.DESCRIPTION    Building block for New-DiscoveryJob
.EXAMPLE    $coreParameter = New-CoreParameter $nodeList $snmpID
.PARAMETER ipAddresses    Value of $nodeList from the File Select Region
.PARAMETER snmpCredentialID    Value of $snmpID from the SNMP Community String Region
#>    $ipList = @()    foreach ($ip in $ipAddresses) {        $ipList += '<IpAddress><Address>{0}</Address></IpAddress>' -f ($ip)    }    $core = ([xml]"<CorePluginConfigurationContext xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.solarwinds.com/2012/Orion/Core'>    <BulkList>        $ipList            </BulkList>    <IpRanges></IpRanges>    <Subnets></Subnets>    <Credentials>            <SharedCredentialInfo>            <CredentialID>$snmpCredentialID</CredentialID>            <Order>1</Order>        </SharedCredentialInfo>      </Credentials>    <WmiRetriesCount>1</WmiRetriesCount>    <WmiRetryIntervalMiliseconds>1000</WmiRetryIntervalMiliseconds>    </CorePluginConfigurationContext>").DocumentElement    # Build the Core Plugin Config, and grab its XML    $coreConfig = Invoke-SwisVerb $swis Orion.Discovery CreateCorePluginConfiguration @($core)    $coreConfigInnerXml = $coreConfig.InnerXml    RETURN $coreConfigInnerXML
}


# $discName $selectedEngineID $coreParamter $vimParameter $interfaceParameter
FUNCTION New-DiscoveryJob($discoveryName, $engineID, $core) {
<#
.SYNOPSIS    Builds a new Orion Sonar Discovery Job for SNMPv1/2c
.DESCRIPTION    Leverages the New-CoreParameter, New-VimParameter, and New-InterfaceParamater functions
.EXAMPLE    $newDiscovery = New-DiscoveryJob $discName, $selectedEngineID, $coreParamter, $vimParamter, $interfaceParameter
.PARAMETER discoveryName    The value of the $discName parameter from the Variables Region
.PARAMETER engineID    The value of the $selectedEngineID parameter from the Polling Engines Region
.PARAMETER core    The value of the New-CoreParameter function return
.PARAMETER vim    The value of the New-VimParameter function return
.PARAMETER interface    The value of the New-InterfaceParameter function return
#>    ([xml]"<StartDiscoveryContext xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.solarwinds.com/2012/Orion/Core'>    <Name>$discoveryName</Name>    <EngineId>$engineID</EngineId>    <JobTimeoutSeconds>3600</JobTimeoutSeconds>    <SearchTimeoutMiliseconds>2000</SearchTimeoutMiliseconds>    <SnmpTimeoutMiliseconds>3000</SnmpTimeoutMiliseconds>    <SnmpRetries>3</SnmpRetries>    <RepeatIntervalMiliseconds>1800000</RepeatIntervalMiliseconds>    <SnmpPort>161</SnmpPort>    <HopCount>0</HopCount>    <PreferredSnmpVersion>SNMP2c</PreferredSnmpVersion>    <DisableIcmp>false</DisableIcmp>    <AllowDuplicateNodes>false</AllowDuplicateNodes>    <IsAutoImport>false</IsAutoImport>    <IsHidden>false</IsHidden>    <PluginConfigurations>        <PluginConfiguration>           <PluginConfigurationItem>$core</PluginConfigurationItem>        </PluginConfiguration>    </PluginConfigurations>    </StartDiscoveryContext>").DocumentElement
}


# $newDiscovery
FUNCTION Start-Discovery($discoveryJob) {
<#
.SYNOPSIS    Starts to newly-created Orion Sonar Discovery
.DESCRIPTION    Utilizes the results of the New-DiscoveryJob function
.EXAMPLE    $discoveryProfileID = Start-Discovery $newDiscovery
.PARAMETER discoveryJob    The value of the New-DiscoveryJob function return
#>    (Invoke-SwisVerb $swis Orion.Discovery StartDiscovery @($discoveryJob)).InnerText   
}


#endregion


$nodeList = Get-Content -Path "C:\Testing\ipDemo.txt"
$snmpID = 3
$discName = "gentleTest"
$selectedEngineID = 8
$coreParameter = New-CoreParameter $nodeList $snmpID
$newDiscovery = New-DiscoveryJob $discName $selectedEngineID $coreParamter
Start-Discovery $newDiscovery













 

Investigation of the $coreParameter and $newDiscovery variables look good; not idea why but the Start-Discovery function returns the following:

 

Invoke-SwisVerb : ProvideFault failed, check fault information.
At line:116 char:6
+     (Invoke-SwisVerb $swis Orion.Discovery StartDiscovery @($discover ...
+      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    + CategoryInfo          : InvalidOperation: (:) [Invoke-SwisVerb], FaultException`1    + FullyQualifiedErrorId : SwisError,SwisPowerShell.InvokeSwisVerb

 

So it's failing on the (Invoke-SwisVerb $swis Orion.Discovery StartDiscovery @($discoveryJob)).InnerText  execution...

 

Here's the Original Script (sans-Functions) that works

 

#region Connect to SWIS
# Import the SolarWinds PowerShell Module if needed


If (!(Get-Module SwisPowerShell)) {
    Import-Module SwisPowerShell
}


# Connect to SWIS


$hostname = "wpil0219swweb01"
$swis = Connect-Swis -Trusted -Hostname $hostname


#endregion


#####-----------------------------------------------------------------------------------------#####


#region Variables
# Name your discovery job
$discName = "gentleTest_old"


# Build an array of IP addresses
$ipAddresses = Get-Content -Path "C:\Testing\ipDemo.txt"
$ipList = @()


foreach ($ip in $ipAddresses) {
    $ipList += '<IpAddress><Address>{0}</Address></IpAddress>' -f ($ip)
}


# Get the SNMP Community String ID
$credID = 3


# Get the Polling Engine ID
$engineID = 8


#endregion


#####-----------------------------------------------------------------------------------------#####


#region Core Plugin Configuration


# Build the Core parameter, using the $ipList and $credID variables from above
$coreParameter = ([xml]"<CorePluginConfigurationContext xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.solarwinds.com/2012/Orion/Core'><BulkList>    $ipList        </BulkList><IpRanges></IpRanges><Subnets></Subnets><Credentials>        <SharedCredentialInfo>        <CredentialID>$credID</CredentialID>        <Order>1</Order>    </SharedCredentialInfo>  </Credentials><WmiRetriesCount>1</WmiRetriesCount><WmiRetryIntervalMiliseconds>1000</WmiRetryIntervalMiliseconds></CorePluginConfigurationContext>").DocumentElement


# Build the Core Plugin Config, and grab its XML


$coreConfig = Invoke-SwisVerb $swis "Orion.Discovery" "CreateCorePluginConfiguration" @($coreParameter)
$coreConfigInnerXml = $coreConfig.InnerXml


#endregion


#####-----------------------------------------------------------------------------------------#####


#region Discovery Context


# Build the Discovery Configuration
$newDiscovery = ([xml]"<StartDiscoveryContext xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.solarwinds.com/2012/Orion/Core'>    <Name>$discName</Name>    <EngineId>$engineID</EngineId>    <JobTimeoutSeconds>3600</JobTimeoutSeconds>    <SearchTimeoutMiliseconds>2000</SearchTimeoutMiliseconds>    <SnmpTimeoutMiliseconds>3000</SnmpTimeoutMiliseconds>    <SnmpRetries>3</SnmpRetries>    <RepeatIntervalMiliseconds>1800000</RepeatIntervalMiliseconds>    <SnmpPort>161</SnmpPort>    <HopCount>0</HopCount>    <PreferredSnmpVersion>SNMP2c</PreferredSnmpVersion>    <DisableIcmp>false</DisableIcmp>    <AllowDuplicateNodes>false</AllowDuplicateNodes>    <IsAutoImport>false</IsAutoImport>    <IsHidden>false</IsHidden>    <PluginConfigurations>        <PluginConfiguration>           <PluginConfigurationItem>$coreConfigInnerXml</PluginConfigurationItem>        </PluginConfiguration>    </PluginConfigurations></StartDiscoveryContext>").DocumentElement


#endregion


#####-----------------------------------------------------------------------------------------#####


#region Start The Discovery


# Start the discovery


(Invoke-SwisVerb $swis Orion.Discovery StartDiscovery @($newDiscovery)).InnerText


#endregion

































 

After running the original script:

 

My assumption is something trivial has been overlooked by me being too deep in the script; so any and all feedback is welcome.

 

Any help is appreciated!


Poller Type - Performance Impact

$
0
0

In adding devices via the SDK - I am curious if there are performance repercussions when adding unnecessary pollers to a node.

 

In the example below, if the poll method was ICMP - would adding all six pollers impact the performance of SolarWinds?

 

Here is the only information I could find on these pollers. Additional resources / information would be appreciated!

Poller Types · solarwinds/OrionSDK Wiki · GitHub

 

 

# 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.CiscoGen3";
$pollerUri=New-SwisObject$swis-EntityType "Orion.Pollers"-Properties $poller
# Memory
$poller["PollerType"]="N.Memory.SNMP.CiscoGen3";
$pollerUri=New-SwisObject$swis-EntityType "Orion.Pollers"-Properties $poller

REST API to SharePoint

$
0
0

Hi I am trying to create a REST end point ..to retrieve information from SolarWinds.

Can this be possible if yes how....

Clearing Alerts in Orion.AlertActive

$
0
0

Hey guys,

 

I'm trying to clear alerts in SWQL. My code is as follows:

 

public static bool Clear(IEnumerable<Alert> alerts)

        {

            var ids = alerts.Select(alert => alert.AlertObjectID).ToList();

 

 

            var body = JsonConvert.SerializeObject(ids);

 

 

            var postAlert = _Post(body, "Invoke/Orion.AlertActive/ClearAlert");

 

 

            if (false == postAlert.HasData) return false;

 

 

            return Convert.ToBoolean(postAlert.Data);

        }

 

I have a similar method to acknowledge alerts and it works fine with Invoke/Orion.AlertStatus/Acknowledge.

 

Why is clearing the alerts not working (getting 400 error)? I'm sending in an array of AlertObjectIDs?

Preventing SW agent for Linux from creating duplicate entry ( P.S: SW Automation for CI/CD)

$
0
0

Hi All,

 

We are trying to automate automatic deployment of Linux servers. Our challenge is that as soon as we install the SW agent on a node it registers into SW. When a vm is destroyed and later re-provisioned with same ip and cname, a duplicate is created within SW. We would like prevent the SW Linux agent from creating a duplicate. Is there any way to automatically kill a registered node whenever that particular node destroyed. Also, we would like to automate adding custom properties from SW end without any human intervention using a script or calling an API or etc. Probably I am looking for a script that I can run against the SW API that will delete a node. I will take responsibility for running the script prior to decommissioning the device. I would welcome a script or some pointers in perl.

 

Thanks in advance.

 

 

Thanks & Regards,

Shyam.

Disabling Hardware Health Sensors

$
0
0

tdanner et. al;

 

Can anyone identify what the "DisableSensors" verb is looking for in Orion.HardwareHealth.HardwareItem ?

 

Trying the ID is coming back with an error in PowerShell:

 

Script:

 

# Clear PowerShell and add the SwisSnapin
Clear-Host

if (-not (Get-PSSnapin | Where-Object { $_.Name -eq 'SwisSnapin' })) {
    Add-PSSnapin 'SwisSnapin'
}

# Connect to SWIS using AD pass-through
$hostname = 'SolarWindsPoller'
$swis = Connect-Swis -Hostname $hostname -Trusted

# Query SWIS to get an array of Sensor IDs to disable
$query = "SELECT ID, FullyQualifiedName FROM Orion.HardwareHealth.HardwareItem WHERE Name LIKE 'System Memory'"
$results = Get-SwisData $swis $query

#  Loop through the array to disable the sensors
Foreach($sensor in $results){    Invoke-SwisVerb $swis Orion.HardwareHealth.HardwareItem DisableSensors $($sensor[0].ID)    Write-Host "Disabling Hardware Sensor On: $($sensor[0].FullyQualifiedName)"
}

 

 

This is an example of what is being passed (adding a Write-Host to the front of the Invoke)

 

Invoke-SwisVerb SolarWinds.InformationService.Contract2.InfoServiceProxy Orion.HardwareHealth.HardwareItem DisableSensors 136

Disabling Hardware Sensor On: System Memory on hostname.domain.local

 

 

And this is the error:

 

Invoke-SwisVerb : Verb Orion.HardwareHealth.HardwareItem.DisableSensors cannot unpackage parameter 0 of type System.Collections.Generic.IEnumerable`1[SolarWinds.HardwareHealth.Common.Models.HardwareHealth.HardwareHealthItemKey]

At line:36 char:2

+     Invoke-SwisVerb $swis Orion.HardwareHealth.HardwareItem DisableSe ...

+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

    + FullyQualifiedErrorId : SwisError,SwisPowerShell.InvokeSwisVerb

 

 

Any and all help is appreciated!

Viewing all 2677 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>