Notification Payload Elements Specific to Event Types
gc$notif_event_attr_array
Array of gc$notif_event_attr is used for referencing event-specific attributes. The array has a maximum size of 25. Each element of the array is of type gc$notif_event_attr (used for referencing event type-specific attributes).
Table 6-50 Event Attribute Type
Attribute | Datatype | Additional Information |
---|---|---|
NAME |
VARCHAR2(64) |
The internal name of event type specific attribute. |
VALUE |
VARCHAR2(4000) |
value. |
NLS_VALUE |
VARCHAR2(4000) |
Translated value for the attribute. |
You can use SQL queries to list the deployed event types in your deployment and the payload specific to each. The following SQL can be used to list all internal event type names which are registered in the Enterprise Manager.
Select event_class as event_type, upper(name) as env_var_name from em_event_class_attrs where notif_order != 0 and event_class is not null order by event_type, env_var_name;
You should convert the attribute name to upper case before using the name for comparison.
There is an attribute variable payload specific to each event type that can be accessed from a gc$notif_event_attr_array database type. The following tables list notification attributes for the most critical event types. You should convert the attribute name to uppercase before using the name for comparison.
Table 6-51 Environment variables specific to Metric Alert Event Type
Environment Variable | Description |
---|---|
COLL_NAME |
The name of the collection collecting the metric. |
KEY_COLUMN_X |
Internal name of Key Column X where X is a number between 1 and 7. |
KEY_COLUMN_X_VALUE |
Value of Key Column X where X is a number between 1 and 7. |
KEY_VALUE |
Monitored object for the metric corresponding to the Metric Alert event. |
METRIC_COLUMN |
The name of the metric column |
METRIC_DESCRIPTION |
Brief description of the metric. |
METRIC_GROUP |
The name of the metric. |
NUM_KEYS |
The number of key metric columns in the metric. |
SEVERITY_GUID |
The GUID of the severity record associated with this metric alert. |
VALUE |
Value of the metric when the event triggered. |
Table 6-52 Environment variables specific to Target Availability Event Type
Environment Variable | Description |
---|---|
AVAIL_SEVERITY |
The transition severity (0-6) that resulted in the status of the target to change to the current availability status. Possible Values for AVAIL_SEVERITY
|
AVAIL_SUB_STATE |
The substatus of a target for the current status. |
CYCLE_GUID |
A unique identifier for a metric alert cycle, which starts from the time the metric alert is initially generated until the time it is clear. |
METRIC_GUID |
Metric GUID of response metric. |
SEVERITY_GUID |
The GUID of the severity record associated with this availability status. |
TARGET_STATUS |
The current availability status of the target. |
Table 6-53 Environment variables specific to Job Status Change event type
Environment Variable | Description |
---|---|
EXECUTION_ID |
Unique ID of the job execution.. |
EXECUTION_LOG |
The job output of the last step executed. |
EXECUTION_STATUS |
The internal status of the job execution. |
EXEC_STATUS_CODE |
Execution status code of job execution. For possible values, see Table 6-16. |
STATE_CHANGE_GUID |
Unique ID of last status change |
Example 6-17 PL/SQL Script: Event Type Payload Elements
-- log_table table is created by following DDL to demostrate how to access -- event notification payload GC$NOTIF_EVENT_MSG. CREATE TABLE log_table (message VARCHAR2(4000)) ; -- Define PL/SQL notification method for Events CREATE OR REPLACE PROCEDURE log_table_notif_proc(s IN GC$NOTIF_EVENT_MSG) IS l_categories gc$category_string_array; l_category_codes gc$category_string_array; l_attrs gc$notif_event_attr_array; l_ca_obj gc$notif_corrective_action_job; BEGIN INSERT INTO log_table VALUES ('notification_type: ' || s.msg_info.notification_type); INSERT INTO log_table VALUES ('repeat_count: ' || s.msg_info.repeat_count); INSERT INTO log_table VALUES ('ruleset_name: ' || s.msg_info.ruleset_name); INSERT INTO log_table VALUES ('rule_name: ' || s.msg_info.rule_name); INSERT INTO log_table VALUES ('rule_owner: ' || s.msg_info.rule_owner); INSERT INTO log_table VALUES ('message: ' || s.msg_info.message); INSERT INTO log_table VALUES ('message_url: ' || s.msg_info.message_url); INSERT INTO log_table VALUES ('event_instance_guid: ' || s.event_payload.event_instance_guid); INSERT INTO log_table VALUES ('event_type: ' || s.event_payload.event_type); INSERT INTO log_table VALUES ('event_name: ' || s.event_payload.event_name); INSERT INTO log_table VALUES ('event_msg: ' || s.event_payload.event_msg); INSERT INTO log_table VALUES ('source_obj_type: ' || s.event_payload.source.source_type); INSERT INTO log_table VALUES ('source_obj_name: ' || s.event_payload.source.source_name); INSERT INTO log_table VALUES ('source_obj_url: ' || s.event_payload.source.source_url); INSERT INTO log_table VALUES ('target_name: ' || s.event_payload.target.target_name); INSERT INTO log_table VALUES ('target_url: ' || s.event_payload.target.target_url); INSERT INTO log_table VALUES ('severity: ' || s.event_payload.severity); INSERT INTO log_table VALUES ('severity_code: ' || s.event_payload.severity_code); INSERT INTO log_table VALUES ('event_reported_date: ' || to_char(s.event_payload.reported_date, 'D MON DD HH24:MI:SS')); IF s.event_payload.target.TARGET_LIFECYCLE_STATUS IS NOT NULL THEN INSERT INTO log_table VALUES ('target lifecycle_status: ' || s.event_payload.target.TARGET_LIFECYCLE_STATUS); END IF; -- Following block illustrates the list of category codes to which the event -- belongs. l_category_codes := s.event_payload.category_codes; IF l_categories IS NOT NULL THEN FOR c IN 1..l_category_codes.COUNT LOOP INSERT INTO log_table VALUES ('category_code ' || c || ' - ' || l_category_codes(c)); END LOOP; END IF; -- -- Each event type has a specific set of attributes modeled. Examples of -- event types include metric_alert, target_availability, job_status_change. -- Following block illustrates how to access the attributes for job_status change -- event type -- IF s.event_payload.event_type = 'job_staus_chage' THEN l_attrs := s.event_payload.event_attrs; IF l_attrs IS NOT NULL THEN FOR c IN 1..l_attrs.COUNT LOOP INSERT INTO log_table VALUES ('EV.ATTR name=' || l_attrs(c).name || ' value=' || l_attrs(c).value || ' nls_value=' || l_attrs(c).nls_value); END LOOP; END IF; END IF; -- Following block illustrates how to access corrective action job's attributes IF s.msg_info.notification_type = GC$NOTIFICATION.NOTIF_CA AND s.event_payload.corrective_action IS NOT NULL THEN l_ca_obj := s.event_payload.corrective_action; INSERT INTO log_table VALUES ('CA JOB_GUID: ' || l_ca_obj.JOB_GUID); INSERT INTO log_table VALUES ('CA JOB_NAME: ' || l_ca_obj.JOB_NAME); INSERT INTO log_table VALUES ('CA JOB_OWNER: ' || l_ca_obj.JOB_OWNER); INSERT INTO log_table VALUES ('CA JOB_TYPE: ' || l_ca_obj.JOB_TYPE); INSERT INTO log_table VALUES ('CA JOB_STATUS: ' || l_ca_obj.JOB_STATUS); INSERT INTO log_table VALUES ('CA JOB_STATUS_CODE: ' || l_ca_obj.JOB_STATUS_CODE); INSERT INTO log_table VALUES ('CA JOB_STEP_OUTPUT: ' || l_ca_obj.JOB_STEP_OUTPUT); INSERT INTO log_table VALUES ('CA JOB_EXECUTION_GUID: ' || l_ca_obj.JOB_EXECUTION_GUID); INSERT INTO log_table VALUES ('CA JOB_STATE_CHANGE_GUID: ' || l_ca_obj.JOB_STATE_CHANGE_GUID); INSERT INTO log_table VALUES ('CA OCCURRED_DATE: ' || l_ca_obj.OCCURRED_DATE); END IF; COMMIT ; END ; /