Smarts SAM: How can I make Smarts SAM to acknowledge multiple notifications using an ASL script?
search cancel

Smarts SAM: How can I make Smarts SAM to acknowledge multiple notifications using an ASL script?

book

Article ID: 304346

calendar_today

Updated On:

Products

VMware

Issue/Introduction

To provide an example asl script to accomplish the task using ASL.

Symptoms:
Customer wanting to use a script to acknowledge multiple notifications using an ASL script or acknowledge all notifications in SAM which have a particular attribute in common using a script?

Environment

VMware Smart Assurance - SMARTS

Resolution

To create and run an ASL script that will acknowledge multiple notifications, do the following:

  1. Create an ASL file named something like multipleAck.asl in the SAM bin directory at the following location:

    <SAMInstallDir>/smarts/bin

     
  2. Copy the example script text in the following section to this script file. Modify the script to your requirements and save.
  3. Use the following command to setup the file permissions:

    chmod 777 multipleAck.asl

     
  4. Use the following command to run the script:

    ./sm_adapter -s <SAMDomainName> multipleAck.asl

Example script
The following example shows an ASL script that will acknowledge all notifications with the word PowerSupply in the InstanceName field.

default debug = FALSE;

manager = object("ICF-TopologyManager");

factory = object("ICIM-ObjectFactory");

timestamp = numeric(time());

START {

.. eol

} do {

x = getInstances("ICS_Notification");

y = getInstances("ICS_NotificationFactory");

foreach notiffactory (y)

{

notifactObj = object(notiffactory);

foreach sys (x)

{

objRef = object();

objRef = object("ICS_Notification", sys);

if (glob("*PowerSupply*",objRef->InstanceName)) {

print("Notif-Name ==> " . objRef->Name);

print("Notif-Name ==> " . objRef->EventState);

objRef->acknowledge("admin","Acknowledge Notification");

objRef->changed();

print("Notification Object acknowledged");

}

}

}

}
 

Please note if you are using hierarchical acknowledge in your SAM domains please change the line in this asl script and run this script against your top level SAM domain so that it will pass down to the lower domains.

objRef->acknowledge("admin","Acknowledge Notification");
to 
objRef->acknowledgeAll("admin","Acknowledge Notification");