First, you create a driver that sets up the process of querying the MIB for the value of SM_SerialNumber.
A driver is an instance of the GA_Driver class, and is composed of three parts:
-
Front End — The source of the input (defined by the ReadsInputFrom attribute of the GA_Driver class).
-
Rule Set — The ASL script that parses through the input string to determine the values of the attributes (defined by the ReadsRulesFrom attribute of the GA_Driver class).
-
Back End — The repository where the attribute values that are parsed from the input string are stored.
In this example, the back end is the Manager that is started with the sm_server command and loads the import file. The value for the root OID in this example is for a Cisco router, Cisco chassis-id MIB (3).
To create an import file:
-
Start editing the import file.
t # BASEDIR /smarts/bin/sm_edit --create conf/discovery/DISCOVERY_serialNumber.imports
-
Type the following lines into the DISCOVERY_serialNumber.importfile:
GA_Driver::DynModel-SerialNumber-Driver { ReadsInputFrom = SNMP_WalkFE::DynModel-SN-FrontEnd { retries =5 rootOIDs = { { 10, ".1.3.6.1.4.1.9.3.6.3" } } trace=FALSE } ReadsRulesFrom = GA_RuleSet::DynModel-SN-RuleSet { fileName = "discovery/dynmodel-sn.asl" trace=FALSE} waitForCompletion =TRUE }
-
Save and close the DISCOVERY_serialNumber.import file.
The DISCOVERY_serialNumber.import file is saved into the BASEDIR/smarts/local/conf/discovery directory.
In this import file, an instance of the GA_Driver class is created, named DynModel-SerialNumber-Driver. Since an OID is queried for its value, a SNMP_WalkFE front end is used. The SNMP_WalkFE instance, DynModel-SN-FrontEnd:
-
-
Retrieves all of the MIB objects under a set of root OIDs.
-
Converts the values to ASCII and markers.
-
Passes them to the ASL file that is defined to parse the input..
In this import file, the ASL file is defined by the ReadRulesFrom attribute as discovery/dynmodel-sn.asl.