[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs

Chapter 4. Error Notification

The Error Notification object class specifies the conditions and actions to be taken when errors are recorded in the system error log. The user specifies these conditions and actions in an Error Notification object.

Each time an error is logged, the Error Notification daemon determines if the error log entry matches the selection criteria of any of the Error Notification objects. If matches exist, the daemon runs the programmed action, also called a notify method, for each matched object.

The Error Notification object class is located in the /etc/objrepos/errnotify file. Error Notification objects are added to the object class by using Object Data Manager (ODM) commands. Error Notification objects contain the following descriptors:

en_alertflg Identifies whether the error is alertable. This descriptor is provided for use by alert agents associated with network management applications. The valid alert descriptor values are:
TRUE alertable
FALSE not alertable
en_class Identifies the class of the error log entries to match. The valid en_class descriptor values are:
H Hardware Error class
S Software Error class
O Messages from the errlogger command
U Undetermined
en_crcid Specifies the error identifier associated with a particular error.
en_label Specifies the label associated with a particular error identifier as defined in the output of the errpt -t command.
en_method Specifies a user-programmable action, such as a shell script or command string, to be run when an error matching the selection criteria of this Error Notification object is logged. The error notification daemon uses the sh -c command to execute the notify method.

The following key words are automatically expanded by the error notification daemon as arguments to the notify method.

$1 Sequence number from the error log entry
$2 Error ID from the error log entry
$3 Class from the error log entry
$4 Type from the error log entry
$5 Alert flags value from the error log entry
$6 Resource name from the error log entry
$7 Resource type from the error log entry
$8 Resource class from the error log entry
$9 Error label from the error log entry
en_name Uniquely identifies the object. The creator uses this unique name when removing the object.
en_persistenceflg Designates whether the Error Notification object should be automatically removed when the system is restarted. For example, to avoid erroneous signaling, Error Notification objects containing methods which send a signal to another process should not persist across system restarts. This is because the receiving process and its process ID do not persist across system restarts.

The creator of the Error Notification object is responsible for removing the Error Notification object at the appropriate time. In the event that the process terminates and fails to remove the Error Notification object, the en_persistenceflg descriptor ensures that obsolete Error Notification objects are removed when the system is restarted.

The valid en_persistenceflg descriptor values are:

0 non-persistent (removed at boot time)
1 persistent (persists through boot)
en_pid Specifies a process ID (PID) for use in identifying the Error Notification object. Objects which have a PID specified should have the en_persistenceflg descriptor set to 0.
en_rclass Identifies the class of the failing resource. For the hardware error class, the resource class is the device class. The resource error class is not applicable for the software error class.
en_resource Identifies the name of the failing resource. For the hardware error class, a resource name is the device name.
en_rtype Identifies the type of the failing resource. For the hardware error class, a resource type is the device type a resource is known by in the devices object class.
en_symptom Enables notification of an error accompanied by a symptom string when set to TRUE.
en_type Identifies the severity of error log entries to match. The valid en_type descriptor values are:
INFO Informational
PEND Impending loss of availability
PERM Permanent
PERF Unacceptable performance degradation
TEMP Temporary
UNKN Unknown
TRUE Matches alertable errors.
FALSE Matches non-alertable errors.
0 Removes the Error Notification object at system restart.
non-zero Retains the Error Notification object at system restart.

Security

Only processes running with the root user authority can add objects to the Error Notification object class.

Examples

  1. To create a notify method that mails a formatted error entry to root each time a disk error of type PERM is logged, create a file called /tmp/en_sample.add containing the following Error Notification object:
    errnotify:
        en_name = "sample"
        en_persistenceflg = 0
        en_class = "H"
        en_type = "PERM"
        en_rclass = "disk"
        en_method = "errpt -a -l $1 | mail -s 'Disk Error' root"
    To add the object to the Error Notification object class, enter:
    odmadd /tmp/en_sample.add
    The odmadd command adds the Error Notification object contained in /tmp/en_sample.add to the errnotify file.

  2. To verify that the Error Notification object was added to the object class, enter:
    odmget -q"en_name='sample'" errnotify
    The odmget command locates the Error Notification object within the errnotify file that has an en_name value of "sample" and displays the object. The following output is returned:
    errnotify:
        en_pid = 0
        en_name = "sample"
        en_persistenceflg = 0
        en_label = ""
        en_crcid = 0
        en_class = "H"
        en_type = "PERM"
        en_alertflg = ""
        en_resource = ""
        en_rtype = ""
        en_rclass = "disk"
        en_method = "errpt -a -l $1 | mail -s 'Disk Error' root"
  3. To delete the sample Error Notification object from the Error Notification object class, enter:
    odmdelete -q"en_name='sample'" -o errnotify
    The odmdelete command locates the Error Notification object within the errnotify file that has an en_name value of "sample" and removes it from the Error Notification object class.

Related Information

Error Logging Overview in AIX Version 4.3 Problem Solving Guide and Reference.

Error Logging Special Files in AIX Version 4.3 Files Reference.

The errdemon daemon in AIX Version 4.3 Commands Reference.

The errclear command, errdead command, errinstall command, errlogger command, errmsg command, errpt command, errstop command, errupdate command, odmadd command, odmdelete command, odmget command in AIX Version 4.3 Commands Reference.

The errlog subroutine in AIX Version 4.3 Technical Reference: Base Operating System and Extensions Volume 1.

The errsave kernel service in AIX Version 4.3 Technical Reference: Kernel and Subsystems Volume 1.


[ Previous | Next | Contents | Glossary | Home | Search ]