Oracle Enterprise Manager Application Developer's Guide
Release 1.4.0

A53701_01

Library

Product

Contents

Index

Prev Next

8
Event Management Integration

This chapter describes integration with the Event Management system (EMS). Topics include:

Levels of Integration

There are two levels of integration with the Event Management System. They are:

These can be implemented separately or together, depending on your needs.

Client-Side Integration

An application must register interest in an event by calling the RegisterEventInterest API. You must register an event set with the Console Event Management system before calling RegisterEventInterest.

For the Console to monitor third-party events, you need to create an event set with the Event Management system. When you create the event set, check the "Accept Third-Party Events" box in the Event Set General page. You do not need to enter any information in the Events or Parameters pages. After the event set is created, register it on all destinations where an application registers interest. This registration will monitor all third-party events on the specified destination.

Uniqueness of Registration

All event registrations have to be unique, and EMS will return an error if an application tries to register the same event at the same node more than once. The uniqueness is defined by the application, event name, and the system name. However, the string "*" is an exception and can be used as a wildcard event name or destination. Registering interest in event name "*" is the only way to register for third-party events.

An application may register "*", and "/user/rdbms/fault/event1" at node "smpsun14". EMS handles these as two registrations. If the application tries to register the "*" or the "/user/rdbms/fault/event1" event again at node "smpsun14", EMS raises an error. However, the application can register the same event at other systems. For information on the format of event names, see eventname on page 8-5.

For a particular event, an application will be notified only once. For example, in Table 8-1, "A Sample Event Registration Database", if "/user/rdbms/fault/event1" fires at "smpsun14", the application will be notified only once.

Table 8-1 A Sample Event Registration Database
Application   Event Name   System Name  

GoodApp  

/user/rdbms/fault/event1  

smpsun14  

GoodApp  

/user/rdbms/fault/event2  

smpsun14  

GoodApp  

*  

*  

GoodApp  

*  

smpsun14  

GoodApp  

/user/rdbms/fault/event1  

*  

GoodApp  

*  

smpsun15  

Notification

In order for an application to be notified of an event you must expose the function EventNotification. This function is called whenever an event you have registered interest in is triggered. The VoxEventNotifyUnpacker class in the vox.dll is provided to unpack the parameters from the variant returned by EventNotification.

If an application is not active when the event is triggered, the Event Management System queues the event notifications. Also, the OLE object service must be declared the active object. When the application next comes up and calls RegisterApplication for the user who owns the event, all the queued events are forwarded.

Who Is Notified

Just as in job notifications (see Who Is Notified on page 7-5), events are referenced by ProgID and current Console user. This means that a user gets only notifications for the events that the user submits. Your server application does not need to pass the username because the Console already knows it.

Discovery Cache Event Management

The Event Management System sets up the discovery cache event-level based on the internally-defined event name that is returned by the intelligent agent. For example, if the event returned is /user/rdbms/fault/event1, then the Event Management System tries to locate the object name as a database, and updates the discovery cache, resulting in the map displaying the appropriate color.

Event Interest

There is one API to register interest in events: RegisterEventInterest. There are two API calls that allow you to cancel interest in events: CancelEventInterest and CancelAllEvents

Server-Side Integration

An unsolicited event is an event that is not discovered by the agent running a Tcl script itself, which is the normal way for events to get triggered. There are a number of reasons why this might occur, such as:

You can raise unsolicited events with the Oracle Intelligent Agent using:

The syntax for orareportevent and oemevent is:

orareportevent eventname object severity message [results]
oemevent eventname object severity message [results]

The parameters are the same for both except for severity.

eventname

This is the four-part name of the event in the form:

 /vendor/product/category/name

All four parts and the forward slashes (/) are required.

The first two levels of name have special significance and have many predefined strings that Oracle script writers must use:

The eventname is assumed to be in 7-bit ASCII, so that it never changes regardless of platform or language. See eventdef.tcl in the ORACLE_HOME\net8\admin directory (Enterprise Manager release 1.4.0 on a Windows platform) for a list of defined event names.

Note:

The actual event script name may be shortened, upper-cased, or manipulated in other ways to make it a legal, unique filename on a given platform. The format is operating system-specific. For example, /oracle/rdbms/security/SecurityError can be stored as $oracle_home/network/agent/events/oracle/rdbms/security/securityerror.tcl on a Unix system.

object

This is the database or service name listed in the snmp.visibleservices parameter in the snmp.ora file, or `host'.

severity

For orareportevent, this is 1 (warning), 2 (error), or -1 (clear). For oemevent, this is the literal text string alert, warning, or clear.

message

This is a quoted text string with the error message.

results

This is a Tcl list with the specific results for the event. For example. the tablespace in error or the user who had a security violation.

Event Management System APIs

The Event Management system has the following API calls:

Common Parameters

These parameters are used in multiple EMS API calls and are described in this section.

ProgID

Identifies the OLE service that is interested in the event.

EventName

The name of the event that the application is interested in. This can be "*", which means all events.

Destination

The name of the system on which the event occurs. This can be "*", which means all destinations that have agents

CancelAllEvents

Purpose

CancelAllEvents removes all event registration entries for the application specified.

Syntax
VT_BOOL CancelAllEvents(VTS_BSTR ProgID)
Parameters

Name   Type   Mode  

ProgId  

VTS_BSTR  

IN  

See Common Parameters on page 8-6.

Comments

None.

CancelEventInterest

Purpose

CancelEventInterest cancels interest for the specified event.

Syntax
CancelEventInterest(VTS_BSTR ProgID,
VTS_BSTR EventName,
VTS_BSTR Destination)
Parameters

Name   Type   Mode  

ProgId  

VTS_BSTR  

IN  

EventName  

VTS_BSTR  

IN  

Destination  

VTS_BSTR  

IN  

See Common Parameters on page 8-6.

Comments

This is a one to one match with the RegisterEventInterest function.

Examples

For example, the following commands register interest in events:

RegisterEventInterest( "Test.Doc", "event1", "system1" );
RegisterEventInterest( "Test.Doc", "*", "*" );
The following command removes the second entry alone.
CancelEventInterest( "Test.Doc", "*", "*" )

To cancel the first event, the application has to call:

CancelEventInterest( "Test.Doc", "event1", "system1" )

EventNotification

Purpose

The Communication Daemon calls this function to notify an application when a registered event has been triggered.

Syntax
VT_VOID EventNotification(VTS_VARIANT Notification)
Parameters

Name   Type   Mode  

Notification  

VTS_VARIANT  

IN  

Notification

A VARIANT containing information regarding the event's name, node, object, date, and severity. Use the unpacker functions to access the information

Comments

Oracle provides a variant unpacker class, VoxEventNotifyUnpacker, to ease the unpacking of the parameters from the variant. This is present in the vox.dll.

RegisterApplication

Purpose

RegisterApplication is used to flush queued notifications.

Syntax
VT_BOOL RegisterApplication(VTS_BSTR ProgID)
Parameters

Name   Type   Mode  

ProgId  

VTS_BSTR  

IN  

ProgID

The name of the OLE service which implements the JobNotification API.

Comments

None.

RegisterEventInterest

Purpose

RegisterEventInterest is used to register an application's interest in any events.

Syntax
VT_BOOL RegisterEventInterest(VTS_BSTR ProgID,
VTS_BSTR EventName,
VTS_BSTR Destination)
Parameters

Name   Type   Mode  

ProgId  

VTS_BSTR  

IN  

EventName  

VTS_BSTR  

IN  

Destination  

VTS_BSTR  

IN  

See Common Parameters on page 8-6.

Comments

If an application wants to register an interest in multiple events, it has to call this API multiple times with different event names. You can use "*" to register interest in all events. For example, the following commands register interest in events:

RegisterEventInterest( "Test.Doc", "event1", "system1" );
RegisterEventInterest( "Test.Doc", "*", "*" );

This service must implement the EventNotification API to receive notices of triggered events. You must register an event set with the Console Event Management system before calling RegisterEventInterest. For information on events available with Enterprise Manager, see the "Event Management System" chapter of the Oracle Enterprise Manager Administrator's Guide.

RegisterEventInterest does not return errors when errors occur.

VoxEventNotifyUnpacker

The VoxEventNotifyUnpacker methods are:

GetDate

Purpose

GetDate returns the date and time that the event was triggered.

Syntax
const CString& GetDate();
Comments

None.

GetEventName

Purpose

GetEventName returns the name of the event.

Syntax
const CString& GetEventName();
Comments

None.

GetFinalResult

Purpose

GetFinalResult returns the result string from Tcl event script.

Syntax
const CString& GetFinalResult();
Comments

None.

GetNodeName

Purpose

GetNodeName returns the node name where the event occurred.

Syntax
const CString& GetNodeName();
Comments

None.

GetObjectName

Purpose

GetObjectName returns the name of service object.

Syntax
const CString& GetObjectName();
Comments

None.

GetSeverity

Purpose

GetSeverity returns the severity of the event.

Syntax
int GetSeverity();
Comments

The severity of the event is - 1 (clear), 1 (warning), or 2 (alert)




Prev

Next
Oracle
Copyright © 1997 Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index