VMWare Smart Assurance IP: How can I bulk unmanage topology instances or class objects in the IP domain?
search cancel

VMWare Smart Assurance IP: How can I bulk unmanage topology instances or class objects in the IP domain?

book

Article ID: 331602

calendar_today

Updated On:

Products

VMware Smart Assurance

Issue/Introduction

Symptoms:
How can I bulk unmanage topology instances or class objects in the VMWare Smart Assurance IP domain?
How do I unmanage multiple objects in a VMWare Smart Assurance IP domain

Environment

VMware Smart Assurance - SMARTS

Resolution

To bulk manage and unmanage in IP, you must use Adapter Scripting Language (ASL) script. There are two ways of doing this (automatic and manual/on-demand) using a custom ASL script as defined in the following sections.

Automatic post-processing
You can have the IP domain do it automatically by using custom post-processing ASL script during discovery. This can be done as follows:

  1. Open the custom-end-post.asl script using sm_edit:

    IP/smarts/bin/sm_edit rules/discovery/custom-end-post.asl
     
  2. Modify the script to make your customization under the following location:

  3. /*    
     * Add processing rules here.
    */
    --<your code here >--
       

Manual/on-demand ASL script
You can create a standalone ASL file and invoke anytime the script with the following:

<BASEDIR>/sm_adapter -s <domain> <path>/<asl filename> 

Your code should loop through the foreach command and look for the class name you want to make the change.  

foreach <instance> (getInstances("<class name>")) { .. }

The following is an ASL script code example of unmanaging an interface that belongs to a Router (Vendor=Cisco, Model=2811, FastEthernet):

foreach int (getInstances("Interface")) {
    intObj = object(int);
    if ( !intObj->isNull() && intObj->SystemType == "ROUTER" && intObj->SystemVendor == "CISCO") {
    // Unmanage certain Interfaces of Cisco Model 2811           
    if (intObj->SystemModel == "2811" && glob("FastEthernet*", intObj->Description)) {
        if (debug) {
            print("Manage (2811): ".intObj->DisplayName);
        }
        intObj->unmanage();
     }     
}