Video Screencast Help

How to Prevent Custom Inventories from Being Processed as Basic Inventory

Created: 09 Sep 2013
Language Translations
Ludovic Ferre's picture
+1 1 Vote
Login to vote

Content:

Problem description:

As I discovered for one of my customers yesterday [1] everything is not always as it seems in the SMP database. Especially when it comes to processed events.

Now I have checked the documentation and I experimented on a couple of my test SMP's to challenge the status-quo, and make sure Custom Inventory events are handled and registered as Custom Inventory events, not as Basic Inventory.

Finding a Solution:

The solution, as you will see is rather simple. Given the "Basic Inventory Capture Item" entry is handling the basic inventory, custom inventory and even Compliance inventory events, the class registered for this guid is capable of handling multiple or any types of NSE. So to have a custom entry doing the same, we only need to clone the item.

Cloning the item itself is difficult, given it is hidden and read-only. However we can export it, modify it to suit our needs and import it back. Then of course, we need to amend all custom inventory tasks to use the new guid.

Here is the modified item xml, with the edits in bold italic:

<?xml version="1.0" encoding="utf-8" ?>
<item guid="{EB16AFB6-C0AB-434C-9AFA-72B468227BE8}" classGuid="{7c32a539-d757-45f1-acad-6bf9578d7cf5}">
  <!--  Type: Altiris.NS.StandardItems.Messaging.InventoryCaptureItem  -->
  <!--  Assembly: Altiris.NS.StandardItems, Version=7.1.8400.0, Culture=neutral, PublicKeyToken=d516cb311cfb6e4f  -->
  <name>Custom Inventory Capture Item</name>
  <alias>custominventory</alias>
  <ownerNSGuid>{ef47834a-4200-4742-a82c-631f8c78df70}</ownerNSGuid>
  <productGuid>{d0e33520-c160-11d2-8612-00104b74a9df}</productGuid>
  <itemAttributes>Hidden, Readonly</itemAttributes>
  <itemLocalizations>
    <culture name="">
      <description>Custom Inventory Capture Item</description>
      <name>Custom Inventory Capture Item</name>
    </culture>
  </itemLocalizations>
  <originNS guid="{ef47834a-4200-4742-a82c-631f8c78df70}" name="SMP-001.15-cloud.ads" url="http://SMP-001.15-cloud.ads/Altiris/NS/" />
  <licenseCheckRequired>false</licenseCheckRequired>
  <parentFolderGuid>3b298f2d-3a83-4979-b58d-e819a2e41d51</parentFolderGuid>
  <sourceNS guid="{ef47834a-4200-4742-a82c-631f8c78df70}" name="SMP-001.15-cloud.ads" url="http://SMP-001.15-cloud.ads/Altiris/NS/" />
  <security owner="@APPLICATION_ID" inherit="True">
    <aces>
      <ace type="reserved" name="@APPLICATION_ID">
        <permissionGrants>
          <permissionGrant guid="{eca6254f-5017-4730-9b3f-5add230829b7}" name="Delete" />
          <permissionGrant guid="{983a2d22-7a82-4db0-a707-52c7d6b1441e}" name="Read" />
          <permissionGrant guid="{ac296df1-eb40-4592-899f-25d5c07d45f6}" name="Write" />
          <permissionGrant guid="{819dae1e-b1a5-4643-81a1-26ef95feb8a8}" name="Change Permissions" />
          <permissionGrant guid="{726b1c09-7108-450d-ae24-5f8e93135ed6}" name="Clone" />
          <permissionGrant guid="{4ddc04c3-f0a5-4e88-84aa-c44c8c5ebcc4}" name="Read Permissions" />
        </permissionGrants>
      </ace>
    </aces>
  </security>
</item>

Implementation

Import the xml:

Copy the xml above, save the attached file or export the basic inventory capture item using the "Importexportutil.exe" and then open a command line prompt with your Altiris Administrator account.

Then enter '"<path_to_ns_directory>\bin\tools\importexportutil" /import /q <path_to_xml>' and press return. In my test SMP the command looked like this:

"c:\program files\altiris\notification server\bin\tools\importexportutil.exe" /import /q c:\custom_inventory.xml

The utility should report that the import was successful unless you have problems with the file path or xml (it can happen if you are using notepad for example).

Modify the Custom Inventories:

Depending on how your custom inventories are implemented, you will have to go back to the tasks or vbscript files and modify the following line:

nse.To = "{1592B913-72F3-4C36-91D2-D4EDA21D2F96}"

with

nse.To = "{EB16AFB6-C0AB-434C-9AFA-72B468227BE8}"

if you are using the xml above or attached.

Monitor incoming Custom Inventories:

With the changes in place (or with just one custom inventory changed to validate the process works fine in your environment) you can then check incoming custom inventory messages with the following SQL:

select *
  from Evt_NS_Event_History
 where ItemGuid = 'EB16AFB6-C0AB-434C-9AFA-72B468227BE8'
 order by _eventTime desc

Conclusion:

With the changes in place you will be able to monitor the load caused on your server from Basic Inventory and Custom Inventory separately. You could even extend the content of this article to create an inventory message handler per custom inventory if you are generating a lot of data (and need to fine tune the data gathering process and event sent).

[1] When is a Basic Inventory not a Basic Inventory?