Share via


Creating a New Resource Class

If the resource information you want to track is not contained in the system, user, or user group resource classes or not related to the data contained in these classes, you can add your own resource type and provide its discovery information. For example, if your company provides a carpool service for its sales force, you can create a process to discover carpool information.

Before creating the new resource type, you need to determine whether you are going to report inventory data for the new resource type. This will help you determine how much discovery information to gather. For guidelines on determining what is discovered and what is reported through inventory, see Resource Discovery and Inventory.

Note  If your discovery agent is loading a large number of resources from a source such as a database, you should run your process on an SMS site server — this approach reduces the amount of network traffic incurred.

Creating a New Resource Type

The discovery data record (DDR) specifies the resource type, discovery process, site that discovered the resource, and the resource properties. SMS provides seven library functions that you use to create your own DDRs. For more information, see Discovery Data Record Functions.

The following example creates a DDR for a carpool resource type.

  [C/C++]
    DDRNew("Carpool", "Vehicle Discovery", "ABC");             // SMS_R_Carpool
    DDRAddString("VIN", "9FD7821T8B14751", 15, ADDPROP_NAME);  // update key
    DDRAddString("LicenseNumber", "ABC123", 8, 0);
    DDRAddString("Make", "Pontiac", 15, 0);
    DDRAddString("Model", "Bonneville", 15, 0);
    DDRAddInteger("ModelYear", 1996, 0);
    DDRAddString("Color", "Green", 16, 0);
    DDRAddString("SMSUniqueIdentifier",                        // update key
                 "VIN:9FD7821T8B14751", 20,
                 ADDPROP_GUID | ADDPROP_KEY);
DDRSendToSMS();
[Visual Basic]
    Dim DDR As New SMSResGen

    DDR.DDRNew "Carpool2", "CarsRUs", "<sitecode>"
    DDR.DDRAddString "VIN", "9FD7821T8B14751", 15, ADDPROP_NAME
    DDR.DDRAddString "License", "ABC123", 8, ADDPROP_NONE
    DDR.DDRAddString "Make", "Pontiac", 15, ADDPROP_NONE
    DDR.DDRAddString "Model", "Bonneville", 15, ADDPROP_NONE
    DDR.DDRAddInteger "ModelYear", 1996, ADDPROP_NONE
    DDR.DDRAddString "Color", "Green", 16, ADDPROP_NONE
    DDR.DDRAddString "SMSUniqueIdentifier", "VIN:9FD7821T8B14751", _
                     20, ADDPROP_GUID And ADDPROP_KEY
    DDR.DDRSendToSMS
[VBScript]
    Const ADDPROP_NONE = &H0
    Const ADDPROP_GUID = &H2
    Const ADDPROP_KEY  = &H8
    Const ADDPROP_NAME = &H44

    Dim DDR

    Set DDR = CreateObject("SMSResGen.SMSResGen.1")

    DDR.DDRNew "Carpool3", "CarsRUs", "<sitecode"
    DDR.DDRAddString "VIN", "9FD7821T8B14751", 15, ADDPROP_NAME
    DDR.DDRAddString "License", "ABC123", 8, ADDPROP_NONE
    DDR.DDRAddString "Make", "Pontiac", 15, ADDPROP_NONE
    DDR.DDRAddString "Model", "Bonneville", 15, ADDPROP_NONE
    DDR.DDRAddInteger "ModelYear", 1996, ADDPROP_NONE
    DDR.DDRAddString "Color", "Green", 16, ADDPROP_NONE
    DDR.DDRAddString "SMSUniqueIdentifier", "VIN:9FD7821T8B14751", _
                     20, ADDPROP_GUID And ADDPROP_KEY
    DDR.DDRSendToSMS

The Discovery Data Manager (DDM) creates a new resource class if the specified resource type does not exist in the database. The new class name is SMS_R_Carpool.

class SMS_R_Carpool : SMS_Resource
{
   uint32 ResourceID;
   string AgentName[];
   string AgentSite[];
   datetime AgentTime[];
   string Color;
   string LicenseNumber;
   string Make;
   string Model;
   string ModelYear;
   string Name;
   uint32 ResourceType;
   string SMSAssignedSite[];
   string SMSUniqueIdentifier;
   string VIN;
};

When the DDM creates a new resource class, it adds these additional properties to the class:

  • ResourceID
  • AgentName
  • AgentSite
  • AgentTime
  • Name
  • ResourceType
  • SMSAssignedSite

For a description of these properties, see SMS_R_System. In addition to creating these properties, the DDM creates an instance of SMS_ResourceMap for the new ResourceType value.

For more information on how you can use the DDR to update existing resource types, see Adding New Properties to an Existing Resource Type and Updating Properties of an Existing Resource Instance.