This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Template export, modification and re-import - how to do it right?

Hi all,


We're using SAM to monitor SQL using the standard SQL DB template. We're creating a template per instance because of course each component in the template needs to point at the instance name that we want to monitor. So then we apply that template to the server where the instance exists. That's fine and we can copy the templates using the GUI and rename etc. However, we need to do this on an enterprise scale - doing it through the GUI isn't going to cut it. So I've tried to export the SQL template, rename the file and modify the template <Name></Name> field in the XML to match the new name of the file. I've also updated all the <SQLInstanceName> in each of the components to the appropriate instance name for this template. (Actually I've got a cool Powershell script to do this on a large scale for lots of server/instance pairs from a CSV file).

Problem is when I try to import the newly made templates again, Orion throws an error :

ApplicationTemplateImportFromXmlStream failed, check fault information

Digging into the error further I see:

Time: 05/30/2014 10:50:17.2351

Server: Microsoft-IIS/7.5

Pipeline: Integrated

User Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/6.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)

Error Instance: 440b5ba79ef140c4a4d78c4a63ded28f

User: *MYUSER*

URL: *URL REMOVED*

Referrer: *OTHER URL REMOVED*

Message: ApplicationTemplateImportFromXmlStream failed, check fault information.

ErrorSite: SolarWinds.APM.Common.BusinessLayerFactory.BusinessLayerExceptionHandler

ErrorType: SolarWinds.APM.Common.ApmBusinessLayerException

Stack:

at SolarWinds.APM.Common.BusinessLayerFactory.BusinessLayerExceptionHandler(Exception ex)

at SolarWinds.APM.Common.APMBusinessLayerProxy.ApplicationTemplateImportFromXmlStreamEx(Stream data)

at Orion_APM_Admin_ImportApplicationTemplate.submitButton_Click(Object sender, EventArgs e)

at System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e)

at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument)

at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)

at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)

at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)

at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Do I need to make some other modifications to the edited template before I can upload it? I see a template ID in the XML, but don't know if that's relevant? Any one every do this? Maybe I need to log a support call?

  • Can you post a copy of this modified template that is throwing the exception above?

  • Uploaded a copy to the content exchange - COPY OF GOLDEN-TEMPLATE-Q-SQL SERVER 2005-2008 PERFORMANCE (SQL).APM-TEMPLATE

  • To ensure the template is indeed unique you must update the name field shown from your template below in red to something unique.

    </ComponentTemplates>

      <DeletedComponentTemplates />

      <Id>425</Id>

      <Name>Copy of GOLDEN-TEMPLATE-Q-SQL Server 2005-2008 Performance (SQL)</Name>

      <IsMockTemplate>false</IsMockTemplate>

    Secondly, you will need to update the UniqueID field to something unique to your environment. Without updating these two fields a collision will occur with the original template, causing the errors you are seeing.

    <ModuleVersion xmlns:d="http://schemas.datacontract.org/2004/07/System">

      <d:_Build>0</d:_Build>

      <d:_Major>6</d:_Major>

      <d:_Minor>1</d:_Minor>

      <d:_Revision>1835</d:_Revision>

      </ModuleVersion>

    <UniqueId>c5ef396f-977a-451d-8297-af2387b8d664</UniqueId>

      </ApplicationTemplate>

    </ArrayOfApplicationTemplate>

    Alternatively, I would strongly recommend looking at using SAM's AppInsight for SQL instead of this template since it does not require any of these manual changes.

  • Thanks - we are indeed using AppInsight, but only for prod systems. Our DBAs want something a bit more lightweight for test/dev databases that they don't care as much about.

    Tried updating the <Name> field to something unique to each template and also the <UniqueID> field to something unique to each template but still the error persists. Will upload the newly modified template to content exchange again. Must be something else I'm missing here?

  • There are multiple "UniqueID"s in the XML. Please ensure you're updating the one at the bottom of the XML document. I've tested the import, export, change, import on my own system following the steps above without issue using the template you provided. Is the template that you uploaded one that throws the error or one that was working?

  • So I've been playing with this for a few days now and I what I found is this:

    - If I export a template from Orion, change the <Name> field and <UniqueID> field at the bottom of the XML, then try to import again, I get the error.

    - If I export a template from Orion, change the <Name> field only then try to import again, it works. However, when I deploy the modified template it never reports back any statistics/status - so that must be the clash with the original template with the same unique ID that you mentioned. Makes sense.

    So seems to be the case that if I monkey with the (last) UniqueID, Orion throws it back at me. But yet I can copy a template in the SAM GUI and export it/import it with no issues. So I'm thinking its some thing to do with whatever I'm setting the UniqueID contents to be - have tried various free text in that field, but it only seem to work when I retain the same format as an existing UniqueID. So say, my exported template has a UniqueID of: b99c1f84-aabc-4fc4-8f31-283591cdf7a6, then I can change it to be say: b99c1f84-aaaa-bbbb-cccc-283591cdf7a6 and it works.


    So what's the requirements for the UniqueID field then? Looks like hex but asides from that, I can't see how it's being constructed?

  • Aha! Ok - now I get it.

    And so to create a GUID in Powershell, I use this:

    $uniqueid = [GUID]::NewGuid().ToString()

    ... and replace the last <UniqueID> in the template with that string and now I can upload the new template my script creates!

  • Are these instructions still valid in release 2019 or greater?  I updated the <Name> and <Value> field in the <ComponentTemplates> and also updated the <Name> field near the bottom of the file.  I imported the .apm-template file and the <UniqueID> near the bottom of the file was updated along with other <ID> fields.  The <UniqueID> in the <ComponentTemplates> section were not updated.  Is this expected?