8 Krypton

Re: ASL script question

Hello Mike,

U can use asl hook file. for example "rules/ics/dxa-sample-hook.asl"

1) U should to reserv some of Userdefined fields

2) in Hook file insert syslocation of device ti Userdefined field

3) Activate Hook script in Global Manager Administration Console

4) Add userdefined field to notification log

Example of hook file.

Note: code not tested

default NotificationName = "";
default MessageType = "";
START {
    .. eol
} do {
    if (NotificationName == "") {
print("InternalError: ".
     this->Name.
     " did not receive NotificationName!");
return;
    }
    eventObj = self->object(NotificationName);
    devObj = object(eventObj->ElementName);
    if (!devObj->isNull()) {
             sysLocation = devObj->Location ? IGNORE;
             if (sysLocation != "") {
                     
                      eventObj->UserDefined1 = sysLocation;
             }
    }
    /* Customizations go here ... */
    return;
}

Enjoy

Message was edited by: Hemulll

0 Kudos
mikesolec
6 Indium

Re: ASL script question

Thanks Hemull,.

However, I am getting syntax error at line 12 next token is ". Any idea where the syntax error is? Sorry am a newbie at ASL.

thanks again

Mike C

0 Kudos
HHE1
6 Indium

Re: ASL script question

I'm sorry to stretch this further, but if a thread on this already exists I did not want to recreate a double/new one if it is related...

My idea was to print all devicenames, with their SNMPaddress. As today there are a lot of VSSC (virtual devices) in my repos, I'm confonted with virtual instances. Those specific virtual instances get the SNMPAddress value <unknown> as they are layered over physical instances.

So I'm facing also ASL-ERROR_GET but cannot test it on an IsNull-value:

ASL-ERROR_GET-While attempting to get property 'SNMPAddress' of object 'MR_Object::VSSC-cicswbeaas001

SVIF-EREMOTE-Remote error occurred.  See exception chain for detail.

MR-NON_SINGLETON_SET-Set operation produced a set which is not a singleton

Tried matching:

foreach d ( getInstances("UnitaryComputerSystem") ) {

dev=object(d);

test=object(dev->SNMPAddress);

matcher="<unknown>";

if (test!=matcher){

print(dev->SystemName.",".dev->SNMPAddress);

}

}

Without success. Am also not a pro in asl... 😉

0 Kudos
8 Krypton

Re: ASL script question

Hi HHE,

How about the following code, does this work correctly for you?

foreach d ( getInstances("UnitaryComputerSystem") ) {

dev=object(d);

if (glob("*unknown*",dev->SNMPAddress)) {

stop();

}

print(dev->SystemName.",".dev->SNMPAddress.",".dev->Description);

}

Kind Regards,

Paul O'Rourke

0 Kudos
HHE1
6 Indium

Re: ASL script question

Hello Paul,

Have been checking this based on your reaction, but still getting " ASL-ERROR_GET-While attempting to get property 'SNMPAddress' of object 'MR_Object::VSSC-cicswbeaas001/1'"

" ASL-CALL_STACK_RULE-   RuleName: START, Line: 8" which is the closing bracket after stop();

The skip or ignore of the SNMPAddress field still doesn't work. This value is to me difficult to handle.

0 Kudos
8 Krypton

Re: ASL script question

Sorry for the delay HHE.

Please find solution below.

I have tested this in my lab and it appears to be working correctly (skipping VSSC instances):

START {

    .. eol

}

do{

foreach d ( getInstances("UnitaryComputerSystem") ) {

dev=object(d);

if (glob("*VSSC-*",dev->Name)) {

print("Skipped: ".dev->Name);

}

else {

print("Matched: ".dev->SystemName.",".dev->SNMPAddress.",".dev->Description);

   }

}

}

0 Kudos