Many thanks lutelewis, for the reply.
Unfortunately, the Spectrum attribute was on a child model. I had to use 'GetModelsByRelationName' to get it done.
I have explained it below (just for reference / information).
- The trap comes into say.... 'myDevice'.
- It has 'entPhysicalIndex' on {U 2}. (example Index = 7777)
- I need to get the 'myDevice_EntityMIBApp' and then get to entPhysicalClass's AttrID under it.
- I am storing the value of entPhysicalClass.7777 in a new event variable {U 7}
$ ./show devices | grep myDevice
0x1f2cc40 myDevice 0x3d0002 GnSNMPDev
$
$ ./show children rel=Manages mh=0x1f2cc40
MHandle MName MTypeHnd MTypeName Relation
...
0x1f2cc4e myDevice_Standard RMON 0x590006 RMONApp Manages
0x1f2cc47 myDevice_EntityMIBApp 0xc40055 RFC2737App Manages
$
$ ./show attributes attr=0xc40aaf,iid=7777 mh=0x1f2cc47
Id Name Iid Value
0xc40aaf entPhysicalClass 7777 8
Where:
0x10001 : Modeltype_Handle's AttrID
0xc40055 : RFC2737App's MTypeHnd (myDevice_EntityMIBApp)
0xc40aaf : entPhysicalClass's AttrID under RFC2737App
My EventDisp looks as follows and is working fine.
0xfff00046 E 20 P "ForEach( \
GetModelsByRelationName({C CURRENT_MODEL}, {S \"Manages\"}, {C RELATION_SIDE_RIGHT}), \
{Variable childMh}, {Variable notUsed}, {H 0}, \
If ( Equals( {H 0xc40055} , ReadAttribute( {Variable childMh}, {H 0x10001}) ), \
CreateEventWithVariables( {C CURRENT_MODEL}, {H 0xfff00040}, \
SetEventVariable ( GetEventVariableList(), \
{U 7}, ReadAttributeInstance( {Variable childMh}, {H 0xc40aaf}, ToObjectId( GetEventVariable({U 2}) ) ) \
) \
) \
, Nil() ) \
)"
Explanation:
"GetModelsByRelationName({C CURRENT_MODEL}, {S \"Manages\"}, {C RELATION_SIDE_RIGHT})" is equal to "./show children rel=Manages mh=0x1f2cc40"
"If ( Equals( {H 0xc40055} , ReadAttribute( {Variable childMh}, {H 0x10001}) )" is to get the model id of 'myDevice_EntityMIBApp'. Model Handle of 'myDevice_EntityMIBApp' will be stored in 'childMh'.
I am then creating a new Event '0xfff00040' with all the existing variables (GetEventVariableList()), along with the new variable {U 7} which reads '0xc40aaf : entPhysicalClass's AttrID' with instance '7777' ({U 2} of original event) from 'childMh' (which is 'myDevice_EntityMIBApp' )