Unfortunately, this isn't as straightforward as it ought to be. The first
thing you need to do is get a handle for the event domain, which is just
like getting the model domain. (Note that the instructions for how to do it
in the API Reference PDF are completely wrong.)

CORBAHelper helper = CORBAHelper.getHelperImpl();
Properties props = new Properties();
props.setProperty("user.name", username);
props.setProperty("CORBAHelper.password", password);
helper.init(null, props);
CsCEventDomain ed = (CsCEventDomain)
helper.getObjectImplementation(CsCEventDomain.class, hostname);

I'm assuming that you can already retrieve the alarm you want. When you
retrieve the alarm, make sure to request CsCorbaAlarmHelper.EVENT_ID_LIST as
one of its attributes. This is the list of all the event IDs associated to
this alarm. Once you have that attribute stored in CsCValue value, then
value.eventIDList() is a byte[][] - an array of event IDs, which are byte[].
The originating event ID is always the first element.

If you want to retrieve all the associated events, replace eventIdList below
with value.eventIDList(). Otherwise, the one event you want will be in event
at the end of this snippet.

byte[][] eventIdList = new byte[][] {value.eventIDList()[0]};
int[] reqAttrs = {CsCorbaEventHelper.TYPE_ATTRIBUTES}; /* This means
retrieve all the varbinds */
CsCEventList el = ed.getEventList(eventIdList, reqAttrs);
CsCEvent event = el.list[0];

Now that you have the event in a usable format, you can get at all the
varbinds. Just like in an alarm, event.attrValList.list contains all the
attributes in no particular order. You'll need to iterate through the list,
looking at each attribute's attributeID to find the ones you're interested
in. For example:

for (CsCAttrValue event_attr : event.attrValList.list) {
    switch (event_attr.attributeID) {
        case INTERESTING_ATTR:
            /* Do something with event_attr.value */
            break;
    }
}
 
The attribute IDs are the numbers you used in the AlertMap to assign trap
varbinds to event attributes.

If you want the actual text that OneClick shows (the event format file),
this is not available through the CORBA API. However, you can get it from a
OneClick server at:

http://oneclick:8080/spectrum/event-config/do/eventFormat?format=text&event=
69379

The event value is the decimal representation of the event code. The only
other format option I've found is "html".

One final caveat - if you're relying on retrieving events, note that they're
only available from the primary SpectroServer. If you've failed over to the
secondary, even though it's storing events, those events are not available
through the CORBA API.

Please feel free to contact me directly if you have any other questions or
issues.

HTH,
Jim


-- 
JIM PFLEGER  |  Application Architect  |  Insight  |  insight.com

t. 480.889.9680 f. 480.889.9599  [email protected]



On 2/10/11 5:03 AM, "Kenneth Kirchner" <[email protected]> wrote:

> Does anyone know if it is possible to access the event message that is
> displayed for an alarm using CORBA?  All of the useful info from the trap var
> binds are displayed in the event message and I would like to copy that data
> into our ticketing system.  I do not know which attribute ID would contain
> this, if it is even available.
> 
> -Ken 
> ---
> To unsubscribe from spectrum, send email to [email protected] with the body:
> unsubscribe spectrum [email protected]


---
To unsubscribe from spectrum, send email to [email protected] with the body: 
unsubscribe spectrum [email protected]

Reply via email to