The sp_eventmon monitoring script monitors the SharePlex Event Log (event_log) at set intervals for entries relating to key replication events. You can define the scan interval and the error messages you want the script to detect. Each scan starts where the previous one stopped to keep the impact on the system minimal and prevent duplicate warnings.

The sp_eventmon script takes the following actions after each scan of the Event Log:

  • When sp_eventmon detects an error that you defined, it prints a notification to the error.splex log file and an e-mail message, if that option is enabled.
  • It logs each error, the error Event Log line number of the error, the sp_cop instance name (typically the port number), and the time and date of the error.
  • The script relies on the iwgrep program, the error_list file (described later), and a marker file named username.mrk (where username is derived from the string that you enter with the -s argument when you run sp_eventmon). These three components must be kept in the same directory as the script, or it will not function.
  • Note: The username.mrk file prevents duplicate warning messages from being sent to the log and to your e-mail or pager. Without this file, the script starts scanning the Event Log from the beginning every time it starts. Warnings that were previously generated are sent again.

    Prepare to run sp_eventmon

    Before running the script, perform the following tasks.

    Satisfy requirements

    See Requirements for using the monitoring scripts before using this script. Note: The script must be run in the ksh shell.

    Define error messages

    The sp_eventmon script scans for events listed in the error_list file, located in the util sub-directory of the SharePlex product directory. View that file for more information about the supported errors. You can add custom error strings to the error_list file by editing it in any ASCII text editor. Open the file and place each error string on a separate line.

    Set IW_HOME

    The IW_HOME variable in the script must be set to the correct value on each machine. This variable must point to the directory in which the monitoring scripts and iwgrep reside.

    If the path is not correct:

    1. Open the script in the app-modules directory of the SharePlex product directory.
    2. Set the path as shown in the following example:

      IW_HOME=/export/home/splex/monscripts

    Define e-mail addresses

    To use the e-mail notification feature, define the e-mail address(es) in the script before running it.

    1. Open the script in the app-modules directory of the SharePlex product directory.
    2. Add any number of address strings after the MailUserName= variable. Use the full e-mail and/or pager address. Separate multiple entries with a comma, as shown in the following example:

      MailUserName=scott@company.com,12345678910@pageservice.com

    Run sp_eventmon

    NoteS:

    • If you are running multiple instances of sp_eventmon, each instance must be run under the name of a different operating system user. Each username.mrk file will have a different username.
    • Use the truncate log command in sp_ctrl to truncate the Event Log frequently when you are running the sp_eventmon script. If the log grows too large, the iwgrep program cannot grep from it properly. When you issue the truncate log command, remove the username.mrk file. The next time you run sp_eventmon it will create a new file. See the SharePlex Reference Guide for more information about the truncate log command.

    • When there is an existing Event Log with errors in it and the script is running, issue the truncate log command and then delete the sp_cop_name.mrk file, where sp_cop_name is the value used in the -s argument when the script was run. This file is in the util sub-directory of the SharePlex product directory.

    To run sp_eventmon

    Run the script from the util sub-directory of the SharePlex product directory, not from app-modules. When you run it from the util directory, you actually make a soft link that runs a utility which first sets up the correct environment before running the script itself.

    Syntax

    nohup sp_eventmon -s 'sp_copname' -t interval -p path [-n name ] [-m] /dev/null &

    Table 2: Required arguments

    Component Description
    nohup sp_eventmon

    Directs the script to continue running in the background if the user logs out. This ensures continuous monitoring. The sp_eventmon component runs the script.

    -s 'sp_copname'

    Sets the name of sp_cop that was used when sp_cop was started with the -u option. The name of sp_cop must be enclosed within single quote marks. You can use this parameter more than once to monitor multiple sp_cop instances on a system. Without this parameter, sp_eventmon will not start.

    &

    Runs the script in the background.

    -t interval

    Sets the time interval between scans in seconds. The value can be any positive integer.

    Table 3: Optional Components

    Component Description
    -p path Sets the path to the SharePlex variable-data directory. Without this variable, sp_eventmon assumes the default path.
    /dev/null Redirects the notification output to the /dev/null device on the local system so that the monitoring process continues to run in the background and generate output. To have the output appear on screen, omit this argument.
    -n name Sets the name of the Event Log if it is something other than the default name “event_log.”
    -m Enables the e-mail/paging option. Without this option, sp_eventmon only logs errors to the log file.