During a discovery, the custom-end-system.asl script is automatically run for each device after Phase III (discovery probing). At the end of the custom-end-system.asl script is a section where you can add your own processing for each device, as shown in Modifying custom-end-system.asl.

START {

/*

* Add Parsing rules here.

*/

.. eol

} do {

/*

* Add processing rules here.

*/

stop();

}

New processing rules are added here.

Figure 1. Modifying custom-end-system.asl

To add custom processing:

  1. Start editing the custom-end-system.asl file, by using sm_edit:

                   # 
    		
                   cd
                   BASEDIR
                   /smarts/bin
                   # 
    		
                   sm_edit rules/discovery/custom/custom-end-system.asl
                
  2. Type the following lines after Add processing rules here in the START rule.

                   /* Check first if the object is a router since you have only added
                   * serial number of the router class */
                   if (nodeObj->CreationClassName =="Router")
                   {
                    /* Setup a handle to the internal GA_Driver's
                    GA_Parameters instance for custom-end-system.asl */
                      cesObj=this->findMyParameters();
                   
                    /* This statement creates the object handle to the
                    * driver defined in our import file
                    * DISCOVERY_serialNumber.import. */
                    DynModelSerialNumberDriverObj = object("DynModel-SerialNumber-Driver");
                    /* Now you kick off the GA _Driver that you have defined
                    * in the import file whose purpose is to poll the device
                    * for some MIB values and return it.   You start the driver
                    * by calling the operation startWithParamters and pass as an
                    * argument the parameters that are available through cesOBJ.
                      *
                      * Note, since the driver in the import file uses
                    * SNMPWalkFE as the frontend, the results from this
                    * front end are in the form of OID|Value
                    * for example, a sample output is: 
                    * .1.3.6.1.2.1.25.1.1.0|6297154|;  
                    * therefore the ASL script dynmodel-sn.asl
                    * defined by the driver in the import file has to
                    * parse the output in this format.
                    */
                    print("Starting DynModel-SerialNumber-Driver...");
                    DynModelSerialNumberDriverObj->startWithParameters(cesObj);
                   }
                
  3. Save and close the custom-end-system.asl file.

    The custom-end-system.asl file is saved into the BASEDIR/smarts/local/rules/discovery/custom directory.