ITEM: N9814L

How to add entries to errtmplt, and errlog


Env:    AIX 3.2.5
Desc:   Customer is running errupdate to generate traps from the SNMP.

        He is following the template, detailed data, data link.  He is 
        putting in 40 characters of information.  The error is getting 
        passed fine as a trap, but it only keeps 4 characters.


Action: I believe you are using the 'Detail Data' section of the 
        errupdate command incorrectly.  You should pass a 4-digit 
        error id which is then associated with the appropriate error 
        in the Detail Data error set.  You can view the various sets 
        of messages with the 'errmsg -w' command:

\#errmsg -w the following options:

-w set_list   Display messages in sets in 'set_list'
              Valid codes are:
              E     Error Description message set
              P     Probable Cause message set
              U     User Cause message set
              I     Install Cause message set
              F     Failure Cause message set
              R     Recommended Action message set
              D     Detailed Data Id message set
              ALL   Allerrmsg: option requires an argument -- w

        Using the 'errmsg' command you can add your own message to 
        this list, then use the 4-digit hex id in the Detail data 


Desc:   Customer called to say that it was true that he was not using
        the errupdate command correctly, but after correcting that 
        error, the customer noticed that you are allowed multiple 
        'Detail Data' lines for your errors.  However, in the 
        /usr/include/sys/err_rec.h file, the structure defines
        only a single detail data buffer.  How can you use this to 
        store multiple Detail Data lines?

Action: Called customer and explained how the detail data field 
        works in the ERR_REC structure in /usr/include/sys/err_rec.h.
        The detail data line in this structure is a concatenation
        of all the detail data lines you wish to display.  The total
        length of all the detail data lines cannot exceed 230.  In
        order to fill this structure you will need to know the layout
        of your detail data lines, as setup in the error template.  You
        can index into the character array to set these values or you 
        can overlay a structure to the same location as the character 
        array and assign values to the structure.

        Here is a short example that demonstrates how to use the
        ERR_REC structure in a program to post error log entries.
        Please note that the following is intended as a sample only.
        IBM does not provide technical support for the following
        code.  Custom coding is considered a Consult Line activity.

        Create a file that contains the error template.  In this 
        example, the filename is "err.file" and it contains the 
        following template:

        + LIZ_ERR:
                Comment=        "Liz is causing this error."
                Class=          S
                Log=            True
                Report=         True
                Alert=          False
                Err_Type=       TEMP
                Err_Desc=       FFFE
                Prob_Causes=    FFFE
                Fail_Causes=    FFFE
                Fail_Actions=   FFFE
                Detail_Data=    4, FFFD, DEC
                Detail_Data=    4, FFFE, DEC

        Include the error in the errtmplt:

                errupdate -h err.file

        The -h option will generate a .h file (err.file.h in this 
        example) for use in your program.  The contents of this file 
        will look similar to the following:

        \#define ERRID_LIZ_ERR 0x6b452d98 /* Liz is causing this error. */
                Next, add text for Err_Desc, Prob_Causes, Fail_Causes, 
        Fail_Actions, and Detail_Data lines:

        errinstall -f -
        SET E
        FFFE "The description of this error is that Liz did it."
        SET P
        FFFE "Liz is the probable cause"
        SET F
        FFFE "Liz caused this failure"
        SET R
        FFFE "Talk to Liz"
        SET D
        FFFD "Detail Data Line 1"
        SET D
        FFFE "Detail Data Line 2"

        You can view these messages with the errmsg command.

        Here is a small C program to generate an error log entry:

          int rc, length;
          ERR_REC(8) err_rec;
          int dd1=1, dd2=2;

          length = sizeof(err_rec);
          err_rec.error_id = ERRID_LIZ_ERR;
          strcpy(err_rec.resource_name, "RESOURCE_LIZ");
          memcpy(err_rec.detail_data, &dd1, 4);
          memcpy(err_rec.detail_data+4, &dd2, 4);

          rc = errlog(&err_rec, length);
          if (rc!=0)
            perror("err: errlog"), exit(-1);

        To compile: cc -o err err.c -lrts -I.

        To run: err

        Now, if you examine the errlog with "errpt -a" you will see an 
        entry that looks like the following:

        ERROR ID:       6B452D98

        Date/Time:       Fri Nov  4 17:16:57 
        Sequence Number: 49604
        Machine Id:      000015951100
        Node Id:         hostname
        Error Class:     S
        Error Type:      TEMP
        Resource Name:   RESOURCE_LIZ

        Error Description
        The description of this error is that Liz did it.

        Probable Causes
        Liz is the probable cause

        Failure Causes
        Liz caused this failure

                Recommended Actions
                Talk to Liz

        Detail Data
        Detail Data Line 1
        Detail Data Line 2

Support Line: How to add entries to errtmplt, and errlog ITEM: N9814L
Dated: November 1994 Category: N/A
This HTML file was generated 99/06/24~13:30:38
Comments or suggestions? Contact us