E    Sending Selected Events Via E-mail

E.1    Overview

This appendix describes how to send selected Event Manager (EVM) events via e-mail.

After you configure the Server Platform Manager (SPM) or Platform Console Manager (PCM) to generate events from console error messages (Section 5.8.3), you can perform the steps outlined in this procedure to send those events via e-mail. You can also send events to a cellular phone or pager that is capable of receiving alphanumeric messages. See Section E.2 for more information.

EVM provides a means for system components or applications to indicate when something of interest has happened, such as a disk failure or a task completion. These indications are called events. You can configure EVM to monitor events on your system and to notify you as soon as interesting events occur. Using this procedure, you can configure EVM to notify you by forwarding the event information through e-mail.

EVM sends e-mail messages of events with a priority of 700 or higher to the root user of the AMS, by default. This procedure shows you how to specify the user name and priority you want.

See Appendix D and the EVM chapters in the Tru64 UNIX System Administration manual and Programmer's Guide for more information.

E.2    Sending Selected Events to a Cellular Phone or Pager

When you configure EVM to send events to a cellular phone or pager, you can use the e-mail address of the device to send events to it. Use the procedure outlined in Section E.5 and substitute the example e-mail address with the device's e-mail address.

Read the literature that came with your device to determine that it is capable of receiving alphanumeric messages, determine its e-mail address, and to learn how to use its messaging capability.

E.3    EVM Configuration File

To specify the user name and event priority you want, edit the EVM logger's configuration file /etc/evmlogger.conf. The /etc/evmlogger.conf file is a text file that configures the display, forwarding, or storage of events for the EVM logger. All events meeting the specifications of an eventlog statement in the configuration file are written to the specified event log or device. This appendix describes how to add entries to the /etc/evmlogger.conf file to forward these events as formatted text.

E.4    Using Templates with evmshow

You can use templates with the evmshow command to select the information you want to see about each event and to format the display of the information.

evmshow -t "@timestamp [@priority] @@"

In this example, evmshow replaces @timestamp with the time at which the event took place, @priority with the priority level of the event, and @@ with the event's formatted text as specified in the format_specifier of the event template file. The example output appears as follows:

evmshow -t "@timestamp [@priority] @@"

E.5    Editing the EVM Logger Configuration File

To specify the user name and event priority you want to e-mail:

  1. Log into the AMS machine as root.

  2. Create a Bourne shell script similar to the following that can receive a single EVM event from its stdin stream, format it, and mail it to the e-mail address you want. The following examples use email_me as the file name.

    The script uses a template with the evmshow command and the mail command, which uses the e-mail address you specify.

    #! /bin/sh
     
              string=`evmshow -t "EVM alert [@host_name]: @@"`
                      (echo Subject: $string
                       echo $string
                      ) | mail jr_admin@company.com
    

    This example executes the evmshow command, formats the information using a template, and assigns the result to the variable string. The definition of the string variable uses back quotes (`).

    The evmshow command replaces the data item specifier, @host_name, with the literal host name of the system on which the event takes place. It also replaces @@ with the event's formatted text.

    The Bourne shell script then executes two echo commands. The first creates a Subject line using the information assigned to the string variable for the text of the subject. The second repeats the string variable for the message body text.

    The script pipes the resulting message through the mail command, which sends it to the e-mail address you specify. You must replace the example electronic mail address, jr_admin@company.com. You can use your own electronic mail address for testing purposes.

  3. Change the permission of the Bourne shell script you created with the chmod command so that it is executable.

    # chmod 744 email_me
    

  4. Check the contents of the /etc/evmlogger.conf file to see if there is an existing forward entry. If there is, we recommend that you copy it and edit the copied entry rather than edit the original.

    forward {
                      name    email_me [1]
     
                      # Don't forward mail events through mail
                      filter    "[prio >= 600] & ![name @SYS_VP@.syslog.mail]" [2]
     
                      suppress [3]
                      {   filter      "[name *]"
                          period      120     # minutes
                          threshold   1   # No. of duplicates before suppression
                      }
                      command     "full_directory_path/email_me" [4]
              }
    

    1. Any name can be supplied. [Return to example]

    2. This line posts any event that has a priority equal to or greater than 600 and is not a mail event. An event with a priority of 600-699 is an Alert and an event with a priority of 700 is an Emergency.

      You must filter out mail events because the forwarding command makes use of the mail system. If the mail system encounters a problem, it might post a high priority event. This can cause an endless event loop if you continue to forward high priority mail events through the mail system. [Return to example]

    3. You can suppress duplicate events to prevent unnecessary duplicate notifications. This example suppresses any event that has occurred twice within 120 minutes. [Return to example]

    4. You must provide the full pathname of the Bourne shell script you created in step 2.

      You can specify a person's e-mail address or the e-mail address of a cellular phone or pager. [Return to example]

  5. Instruct the logger to reload the /etc/evmlogger.conf file:

    # evmreload -l
    

    Reloading the logger configuration file causes EVM to begin using the new configuration. You must enter evmreload -l every time you modify the /etc/evmlogger.conf file.

E.6    Verifying Success

After you apply this procedure, you can verify whether it was successful.

  1. In step 2, use an electronic mail address with which you can test the notification.

  2. Create an event with a priority higher than the minimum priority entered in /etc/evmlogger.conf.

    # evmpost -a "Test Message" -p 700
    

    This example posts an administrator's quick message and assigns it a priority of 700. Since the example filter used in the procedure selects events with a priority of 600 or greater, this test event meets the selection criteria and a mail notification is sent.

  3. Create an event that matches the minimum priority entered in /etc/evmlogger.conf.

    # evmpost -a "Test Message" -p 600
    

    This example posts an administrator's quick message and assigns it a priority of 600. Since the example filter used in the procedure selects events with a priority of 600 or greater, this test event meets the selection criteria and a mail notification is sent.

  4. Create an event with a priority that is less than the minimum priority entered in /etc/evmlogger.conf. This verifies whether it successfully filters out events that do not match.

    # evmpost -a "Test Message" -p 599
    

    This example posts an administrator's quick message and assigns it a priority of 599. Since the example filter used in the procedure selects events with a priority of 600 or greater, this test event does not meet the selection criteria; therefore, a mail message is not sent.

  5. Check your mail program for notifications of the two events that match the filter criteria.

E.7    Troubleshooting

If you determine that this procedure was not successful, as described in Verifying Success, use the following table to identify and solve problems:

Problem Possible Solutions
The event neither appeared on the system console nor sent mail.

  • Enter the evmreload -l command to reload the logger file.

  • Check to see if the event matches the filter parameters in /etc/evmlogger.conf.

  • Check the values entered in the suppress entry in the /etc/evmlogger.conf file to ensure that the event has not been repeated within the given time period.

    For testing purposes, temporarily comment out the suppress entry by entering a pound sign (#) at the beginning of each suppress line and then enter evmreload -l to reload the logger file.

The event appeared on the console but no mail was sent.

  • Ensure that the Bourne shell script file is executable.

  • Select the option to retrieve new messages in your mail viewer.

  • Ensure that the command entry in /etc/evmlogger.conf calls out the correct name of the shell script.

  • Ensure that the Bourne shell script includes the correct electronic mail address.

  • Enter the evmreload -l command to reload the logger file.

The event message was not received.

  • There may be a delay before the device receives the notification. Wait for a few minutes for the notification to be received.

  • Enter the evmreload -l command to reload the logger file.