Unable to import IP Addresses to a Filter from a CSV file
search cancel

Unable to import IP Addresses to a Filter from a CSV file

book

Article ID: 240173

calendar_today

Updated On:

Products

IT Management Suite

Issue/Introduction

We have a customer that is trying to add "IP Addresses" to a filter (under the Import Resource List window) as a Computer Resource type.

They are using a ".csv" file to upload data (IP addresses in this case).

  

When the import occurs, they only get a message like this (they tried just with one IP Address in a simple .CSV file):

0 of the 0 resources found in the file were successfully imported. If any resources failed to import, it is likely that they have not yet been discovered. Unable to cast object of type 'System.DBNull' to type 'System.String'.
   [System.InvalidCastException @ Altiris.Web.NS]
   at Altiris.NS.UI.NSResourcePickerControl.OnImportCompleted(Object sender, EventArgs e)

There are around 600 IP addresses in total and what they have observed is that this issue is being observed for 50 or so IPs.
They have checked and verified the filter created which is a basic filter with query mode as none and the import resources list selected as computer.

Their additional observation is that all the IPs are discovered / visible under All computers. The IP addresses that are not importing already exist in the SMP Console under Manage>Computers from an existing Computers.

Also, they tried importing the data via hostname but that did not work.
If they add the IPs manually to the filter, it is getting added (no using a CSV file).

 

Environment

ITMS 8.6 RU1, 8.6 RU2, 8.6 RU3, 8.7

Cause

Known issue. Our Dev team fixed an issue with "no name" situation for matched IP to resource import.

Resolution

This issue has been fixed in ITMS 8.6 RU3 release.

ITMS 8.6 RU2:
A point fix for ITMS 8.6 RU2 is currently available. See "CUMULATIVE POST ITMS 8.6 RU2 POINT FIXES" (KB 235538)

Note:

The main issue was fixed in our ITMS 8.6 RU3, however, there was one more spot that needed further fixing. If you see the following error entry in the NS logs while trying to import IP Addresses from a CSV file:

Error encountered during the retrieval of machine data. Unhandled exception has occurred.

Violation of PRIMARY KEY constraint 'PK_#gn______A2B5777C39F08344'. Cannot insert duplicate key in object 'dbo.#gn'. The duplicate key value is (8a113f5e-58ea-4350-9be5-336be84290de).
The statement has been terminated.
   [System.Data.SqlClient.SqlException @ .Net SqlClient Data Provider]

Server stack trace: 
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader()
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at System.Data.SqlClient.SqlCommand.ExecuteReader()
   at Altiris.NS.DataAccessLayer.DatabaseAbilities.ExecuteContainer[T](IDatabaseContext ctx, CommandType type, String sql, T container, Action`2 loader, Object[] parampairs)
   at Altiris.NS.DataAccessLayer.DatabaseAbilities.ExecuteContainer[T](CommandType type, String sql, T container, Action`2 loader, Object[] parampairs)
   at Altiris.NS.UI.NSResourcePickerControl.GetCurrentMachinesData(IDictionary machines)

SQL Exception details: code=2627, line=33, procedure=spGetPushAgentStatusLightTemp

Exception logged from: 
   at Altiris.NS.UI.NSResourcePickerControl.GetCurrentMachinesData(System.Collections.IDictionary)
   at Altiris.NS.UI.NSResourcePickerControl.OnImportCompleted(Object, EventArgs)
   at System.Web.UI.HtmlControls.HtmlInputButton.OnServerClick(EventArgs)
   at System.Web.UI.Page.ProcessRequestMain(Boolean, Boolean)
   at System.Web.UI.Page.ProcessRequest(Boolean, Boolean)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequest(System.Web.HttpContext)
   at Altiris.NS.UI.Controls.PageCachePage.ProcessRequest(System.Web.HttpContext)
   at Altiris.NS.UI.AltirisPage.ProcessRequest(System.Web.HttpContext)
   at System.Web.HttpApplication+CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStepImpl(System.Web.HttpApplication+IExecutionStep)
   at System.Web.HttpApplication.ExecuteStep(System.Web.HttpApplication+IExecutionStep, Boolean&)
   at System.Web.HttpApplication+PipelineStepManager.ResumeSteps(Exception)
   at System.Web.HttpApplication.BeginProcessRequestNotification(System.Web.HttpContext, AsyncCallback)
   at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.Hosting.IIS7WorkerRequest, System.Web.HttpContext)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32)

HTTP [POST]: https://SMPserver.dpomain.com/Altiris/NS/Admin/Collections/NSResourceCollection.aspx?Guid=297674fc-ca19-4cad-b077-1a8354b97422&TreeGuid=1ce604a6-c897-493f-a090-0039563990be&ItemGuid=297674fc-ca19-4cad-b077-1a8354b97422&ParentGuid=00000000-0000-0000-0000-000000000000&Url=https://SMPserver.dpomain.com/altiris/console/tree.aspx?TreeGuid=1ce604a6-c897-493f-a090-0039563990be&&ConsoleGuid=1b22db4e-a898-443f-9b99-855b1653d3f5&ConsoleGuid=1b22db4e-a898-443f-9b99-855b1653d3f5&CallbackPageId=da84c17300844a61b471706c50e72525
 ip: [10.147.18.109]; languages: [en-US,en;q=0.9]; content-length: [104549];
 timings: [[R] 00:00:00.0937406(W: 00:00:00)];
 response: [200 OK]; x-smp-nsversion: [8.6.4286.0];

-----------------------------------------------------------------------------------------------------
Date: 12/26/2022 6:57:36 PM, Tick Count: 303865718 (3.12:24:25.7180000), Size: 5.56 KB
Process: w3wp (9784), Thread ID: 466, Module: w3wp.exe
Priority: 1, Source: Altiris.NS.UI.NSResourcePickerControl.GetCurrentMachinesData

Try applying the updated SQL procedure "spGetPushAgentStatusLightTemp" (attached) which should fix a problem with the original "spGetPushAgentStatusLightTemp".

Attachments

spGetPushAgentStatusLightTemp-fixed-duplicates_1677847067411.sql get_app