Enabling health alert notification

To enable email or pager notification when an alert is generated, you must set configuration parameters and specify contact information.

Before you begin

The Database Administration Server (DAS) must be running on the system where the contact list is located. For example, if the CONTACT_HOST configuration parameter is set to a remote system, the DAS must be running on the remote system in order for contacts to be notified of alerts.

About this task

To enable health alert notification:

Procedure

  1. Specify the SMTP_SERVER parameter.
    The DAS configuration parameter, SMTP_SERVER, specifies the location of the mail server to use when sending both email and pager notification messages. Omit this step if the system on which the database is installed is enabled as an unauthenticated SMTP server.
  2. Specify the CONTACT_HOST parameter.
    The DAS configuration parameter, CONTACT_HOST, specifies the remote location of the contact list for all instances on the local system. By setting this parameter, a single contact list can be shared between multiple systems. Omit this step if you want to keep the contact list on the local system where the database is installed.
  3. Specify the default contact for health monitor notification. To enable email or pager notification from the health monitor when an alert is generated, a default administration contact must be specified. If you choose not to provide this information, notification messages cannot be sent for alert conditions. You can provide the default administration contact information during installation, or you can defer the task until after installation is complete.
    If you choose to defer the task or want to add more contacts or groups to the notification list, you can specify contacts through the CLP, or C APIs:
    • To specify contacts using the CLP:
      To define an email contact as the default for health monitor notification, issue the following commands:
      DB2 ADD CONTACT contact_name TYPE EMAIL ADDRESS 
         email_address DESCRIPTION 'Default Contact'
      
      DB2 UPDATE NOTIFICATION LIST ADD CONTACT contact_name

      For complete syntax details, see the Command Reference.

    • To specify contacts using C APIs:
      The following C code excerpt illustrates how to define health notification contacts:
      ...
      #include <db2ApiDf.h>
       
      SQL_API_RC rc = 0;
      struct db2AddContactData addContactData;
      struct sqlca sqlca;
       
      char* userid = "myuser";
      char* password = "pwd";
      char* contact = "DBA1";
      char* email = "dba1@mail.com";
      char* desc = "Default contact";
       
      memset(&addContactData, '\0', sizeof(addContactData));
      memset (&sqlca, '\0', sizeof(struct sqlca));
       
      addContactData.piUserid = userid;
      addContactData.piPassword = password;
      addContactData.piName = contact;
      addContactData.iType = DB2CONTACT_EMAIL;
      addContactData.piAddress = email;
      addContactData.iMaxPageLength = 0;
      addContactData.piDescription = desc;
       
      rc = db2AddContact(db2Version810, &addContactData, &sqlca);
       
      if (rc == 0) {
         db2HealthNotificationListUpdate update;
         db2UpdateHealthNotificationListData data;
         db2ContactTypeData contact;
       
         contact.pName = contact;
         contact.contactType = DB2CONTACT_EMAIL;
       
         update.iUpdateType = DB2HEALTHNOTIFICATIONLIST_ADD;
         update.piContact = &contact;
       
         data.iNumUpdates = 1;
         data.piUpdates = &update;
       
         rc = db2UpdateHealthNotificationList (db2Version810, &data, &ca);
      }
      ...