Notifying the administrator when a physical volume is missing

Although AIX® logs an error when a physical volume becomes inaccessible, there are circumstances in which an error can go undetected.

For example, when the physical volume is part of a mirrored volume group, users do not notice a problem because a good copy of the data remains accessible. In such cases, automatic notification can alert the administrator to the problem before the users notice any disruption to their work.

The following procedure describes how to set up automatic notification when a physical volume is declared missing. By modifying the following procedure, you can track other errors that are significant to you.

The information in this how-to scenario was tested using specific versions of AIX. The results you obtain might vary significantly depending on your version and level of AIX.

  1. With root authority, make a backup copy of the /etc/objrepos/errnotify ODM file.
    You can name the backup copy anything that you choose. In the following example, the backup copy appends the errnotify file name with the current date:
    cd /etc/objrepos
    cp errnotify errnotifycurrent_date
  2. Use your favorite editor to create a file named /tmp/pvmiss.add that contains the following stanza:
    errnotify:
    	en_pid = 0
    	en_name = "LVM_SA_PVMISS"
    	en_persistenceflg = 1
    	en_label = "LVM_SA_PVMISS"
    	en_crcid = 0
    	en_type = "UNKN"
    	en_alertflg = ""
    	en_resource = "LVDD"
    	en_rtype = "NONE"
    	en_rclass = "NONE"
    	en_method = "/usr/lib/ras/pvmiss.notify $1 $2 $3 $4 $5 $6 $7 $8 $9"
    After you complete all the steps in this topic, the error notification daemon will automatically expand the $1 through $9 in this script with detailed information from the error log entry within the notification message.
  3. Use your favorite editor to create a file named /usr/lib/ras/pvmiss.notify with the following contents:
    #!/bin/ksh
    exec 3>/dev/console
    print -u3 "?"
    print -u3 - "----------------------------------------------"
    print -u3 "ALERT!  ALERT!  ALERT!  ALERT!  ALERT!  ALERT!"
    print -u3 ""
    print -u3 "Desc: PHYSICAL VOLUME IS MISSING. SEE ERRPT."
    print -u3 ""
    print -u3 "Error label: $9"
    print -u3 "Sequence number: $1"
    print -u3 "Error ID: $2"
    print -u3 "Error class: $3"
    print -u3 "Error type: $4"
    print -u3 "Resource name: $6"
    print -u3 "Resource type: $7"
    print -u3 "Resource class: $8"
    print -u3 - "----------------------------------------------"
    print -u3 "?"
    mail - "PHSYICAL VOLUME DECLARED MISSING" root <<-EOF
    ----------------------------------------------
    ALERT!  ALERT!  ALERT!  ALERT!  ALERT!  ALERT!
    Desc: PHYSICAL VOLUME IS MISSING. SEE ERRPT.
    Error label: $9
    Sequence number: $1
    Error ID: $2
    Error class: $3
    Error type: $4
    Resource name: $6
    Resource type: $7
    Resource class: $8
    ----------------------------------------------
    EOF
  4. Save your file and exit the editor.
  5. Set the appropriate permissions on the file that you created.
    For example:
    chmod 755 /usr/lib/ras/pvmiss.notify
  6. Type the following command to add the LVM_SA_PVMISS definition that you created in step 2 to the ODM:
    odmadd /tmp/pvmiss.add

Now, the system runs the /usr/lib/ras/pvmiss.notify script whenever an LVM_SA_PVMISS error occurs. This script sends a message to the console and also sends mail to the root user.