How do I use ASL to search and list a Class of devices in a Smarts IP domain for a particular property?
How to search an IP domain for devices containing a particular property such as the same system OID (Object Identifier) in different devices
All supported releases of Smart
A relatively simple ASL script can be used to search for properties within a Class, such as searching IP domain devices for the same system OID (Object Identifier) in a particular Class. The following example ASL script could be used to search for the "SystemObjectID" within the "Switch" Class:
START {}
do {
print("starting to process instances");
DeviceList = getInstances("Switch"); /*add the Instance type here, e.g., Switch, Router, Host*/
foreach aDevice (DeviceList) {
/*print(aDevice." checked"); Uncomment to list all devices checked*/
instanceObj = object(aDevice);
if (instanceObj->SystemObjectID == ".1.3.6.1.4.1.9.1.501") { /* add the SystemObjectID here */
print(aDevice." has a SystemObjectID of .1.3.6.1.4.1.9.1.501");
}
}
stop();
This script can be run using BASEDIR/IP/smarts/bin/sm_adapter -s [IP Domain Name] scriptname.asl