The getInstance("SelectiveGroup") function is not returning any data; How can a hook script be used to get instances of a SelectiveGroup object?
search cancel

The getInstance("SelectiveGroup") function is not returning any data; How can a hook script be used to get instances of a SelectiveGroup object?

book

Article ID: 332018

calendar_today

Updated On:

Products

VMware Smart Assurance

Issue/Introduction

  • How to achieve this using a hook script, which can be used to add to a user-defined field that contains the network device related to a Smarts SAM notification.

  • From a standalone ASL script, it is possible to get the instances of a SAM object by adding the option --server=<SAM domain>.
  • The following is shown in the logs:
print("groupName=" . groupName);groupList = getInstances(groupName);print("groupList=" . groupList)
  • The following log is traced:

[May 22, 2013 11:51:42 AM GMT+02:00 +038ms] t@981464832 RFI-OI_NL-Driver-HyperNotif

ASL_MSG-*-ASLP-ics/sysname2udef-hook.asl: groupName=SelectiveGroup

[May 22, 2013 11:51:42 AM GMT+02:00 +038ms] t@981464832 RFI-OI_NL-Driver-HyperNotif

ASL_MSG-*-ASLP-ics/sysname2udef-hook.asl: groupList={  }
  • The getInstance("SelectiveGroup") function is not returning any data.

Environment

SMARTS - 10.1.x

Cause

Since the hookscript example above is associated with the event driver, all the calls that are used in the hookscript are executed against the remote server instead of the Smarts SAM server, so the getInstance("SelectiveGroup") function will not return data.

Resolution

If you want a call/function to be called to the Smarts SAM server, you need to use the self-> command specification. The correct command syntax is: 

groupList = self->getInstances("SelectiveGroup");