asnmon: Starting a Replication Alert Monitor

Use the asnmon command to start a Replication Alert Monitor on Linux®, UNIX, Windows, and UNIX System Services (USS) on z/OS®. Run this command at an operating system prompt or in a shell script.

Syntax

Read syntax diagramSkip visual syntax diagramasnmonmonitor_server= servermonitor_qual= mon_qualmonitor_interval= nrunonce=nyalerts_tofile=nyalerts_totable=ynalerts_file_path= filepathalerts_filesz= maximum_sizearm= identifierautoprune=ynlogreuse=nylogstdout=nyterm=ynalert_prune_limit= ntrace_limit= nmax_notifications_per_alert= nmax_notifications_minutes= npwdfile=asnpwd.autfilepathmonitor_path= pathmonitor_errors=,"address"email_server= server_namesender_address= valid_email_addressconsole=nyconfmt=nymonintmsg=yn

Parameters

Table 1 defines the invocation parameters for the asnmon command.

Table 1. asnmon invocation parameter definitions for Linux, UNIX, Windows, and z/OS operating systems
Parameter Definition
monitor_server=serverh Specifies the name of the Monitor control server where the Replication Alert Monitor program runs and the monitor control tables reside. This must be the first parameter if entered.

Linux, UNIX, Windows: If you do not specify a Monitor control server, this parameter defaults to the value from the DB2DBDFT environment variable.

z/OS: The default is DSN.

monitor_qual=mon_qual Specifies the monitor qualifier that the Replication Alert Monitor program uses. The monitor qualifier identifies the server to be monitored and the associated monitoring conditions.

You must specify a monitor qualifier. The monitor qualifier name is case sensitive and can be a maximum of 18 characters.

monitor_interval=n Specifies how frequently (in seconds) the Replication Alert Monitor program runs for this monitor qualifier. The default is 300 seconds (five minutes).

This parameter is ignored by the Replication Alert Monitor if you set the runonce parameter to y.

Important: This monitor_interval parameter affects the Replication Alert Monitor program only. This parameter does not affect Q Capture, Q Apply, Capture, and Apply programs.
runonce=y/n Specifies whether the Replication Alert Monitor program runs only one time for this monitor qualifier.
n (default)
The Replication Alert Monitor program runs at the frequency indicated by the monitor_interval parameter.
y
The Replication Alert Monitor program runs only one monitor cycle.

If you set the runonce parameter to y, the monitor_interval parameter is ignored by the Replication Alert Monitor.

arm=identifier z/OS: Specifies a three-character alphanumeric string that is used to identify a single instance of the Replication Alert Monitor program to the Automatic Restart Manager. The value that you supply is appended to the ARM element name that the monitor program generates for itself: ASNAMxxxxyyyy (where xxxx is the data-sharing group attach name, and yyyy is the Db2® member name). You can specify any length of string for the arm parameter, but the monitor program will concatenate only up to three characters to the current name. If necessary, the monitor program will pad the name with blanks to make a unique 16-byte name.
autoprune=y/n Specifies whether automatic pruning of the rows in the Replication Alert Monitor alerts (IBMSNAP_ALERTS) table is enabled.
y (default)
The Replication Alert Monitor program automatically prunes the rows in the IBMSNAP_ALERTS table that are older than the value of the alert_prune_limit parameter.
n
Automatic pruning is disabled.
logreuse=y/n Specifies whether the Replication Alert Monitor program reuses or appends messages to its diagnostic log file ( db2instance.monitor_server.mon_qual.MON.log ).
n (default)
The Replication Alert Monitor program appends messages to the log file.
y
The Replication Alert Monitor program reuses the log file by deleting it and then recreating it when the Replication Alert Monitor program is restarted.
logstdout=y/n Specifies where messages are sent by the Replication Alert Monitor program.
n (default)
The Replication Alert Monitor program sends messages to the log file only.
y
The Replication Alert Monitor program sends messages to both the log file and the standard output (stdout).
term=y/n Specifies whether a monitor program keeps running when Db2 is quiesced.
y (default)
The monitor program stops when Db2 is quiesced.
n
The monitor program keeps running while Db2 is in quiesce mode and has forced all applications to disconnect (including the monitor program). When Db2 is taken out of quiesce mode, the monitor program goes back to monitoring replication.
Regardless of the setting for the term parameter, a monitor program stops when Db2 shuts down. When Db2 starts again, you must restart the monitor program.
alert_prune_limit=n Specifies how long (in minutes) rows are kept in the Replication Alert Monitor alerts (IBMSNAP_ALERTS) table. Any rows older than this value are pruned. The default is 10 080 minutes (seven days).
trace_limit=n Specifies how long (in minutes) a row can remain in the Replication Alert Monitor trace (IBMSNAP_MONTRACE) table before it becomes eligible for pruning. All IBMSNAP_MONTRACE rows that are older than the value of this trace_limit parameter are pruned at the next pruning cycle. The default is 10 080 minutes (seven days).
max_notifications_per_alert=n Specifies the maximum number of the same alerts that are sent to a user when the alerts occurred during the time period specified by the max_notifications_minutes parameter value. Use this parameter to avoid re-sending the same alerts to a user. The default is 3.
max_notifications_minutes=n This parameter works with the max_notifications_per_alert parameter to indicate the time period when alert conditions occurred. The default is 60 minutes.
pwdfile=filepath Specifies the fully qualified name of the password file. You define this file by using the asnpwd command. The default file name is asnpwd.aut.
monitor_path=path Specifies the location of the log files used by the Replication Alert Monitor program. The default is the directory where the asnmon command was invoked.
monitor_errors=address Specifies the email address to which notifications are sent if a fatal error is detected before the alert monitor connects to the Monitor control server. Use this parameter to send a notification that the Monitor control server connection failed because of invalid start parameters, an incorrect monitor qualifier, a down database, or other error.

Type double quotation marks around the email address text.

You can enter multiple email addresses. Separate the email addresses with commas. You can type spaces before or after the commas.

email_server=server_name Specifies the email server address. Enter this parameter only if you use the ASNMAIL exit routine with SMTP (Simple Mail Transfer Protocol). The monitor uses port 25 by default to connect to the email server.
console=y/n z/OS: Specifies whether the Replication Alert Monitor program sends alert notifications to the z/OS console. If you set this parameter to Y (yes) and an email server was already configured, alerts are sent to both the z/OS console and the email server.
n (default)
The Replication Alert Monitor program does not send alert notifications to the z/OS console.
y
The Replication Alert Monitor program sends alert notifications to the z/OS console.
confmt=y/n z/OS: Specifies whether alert notifications that go to the z/OS console use a format that is standardized for system automation:
n (default)
Console messages use the same format as log messages: message_number message_text
y
Console messages use a concise format that is designed for system automation. The Q Capture and Q Apply messages use a slightly different format:
Q Capture format
message_number event_name event_text capture_schema
Q Apply format
message_number event_name event_text apply_schema receive_queue
Note: Informational messages are not affected by this parameter and are always issued with the regular asnmon log format.
monintmsg=y/n Specifies whether the monitor program issues an ASN5194I message at each monitor interval to indicate that it is running and state the time range within which it monitors for alert conditions:
y (default)
The monitor program issues an ASN5194I message at each monitor interval.
n
The monitor does not issue ASN5194I messages.
sender_address z/OS: Specifies a valid email address as sender email address. Some providers such as pager services require a full valid return address for filtering unsolicited messages and do not consider the default sender address that is used by the monitor program, asnmon@hostserver, as valid. If a valid return address is not provided, the alert emails might be blocked.
alerts_tofile Linux, UNIX, Windows: Specifies whether the monitor program writes alerts to files.
n (default)
The monitor does not write alerts to files.
y
The monitor writes alerts to files that it generates in the directory that is specified by the alerts_file_path parameter.
alerts_totable Linux, UNIX, Windows: Specifies whether the monitor program writes alerts to the IBMSNAP_ALERTS table.
y (default)
The monitor writes alerts to the table.
n
The monitor does not write alerts to the table.
alerts_file_path Linux, UNIX, Windows: The path where alert files are generated. The default is the directory from which the asnmon command was issued.
alerts_filesz Linux, UNIX, Windows: The maximum file size in megabytes for an alert file. When this size is exceeded the monitor generates a new alert file. Default: 1 MB

Return codes

The asnmon command returns a zero return code upon successful completion. A nonzero return code is returned if the command is unsuccessful.

Examples for asnmon

The following examples illustrate how to use the asnmon command.

Example 1

To start the Replication Alert Monitor with the default parameters:


asnmon monitor_server=wsdb monitor_qual=monqual

Example 2

To start a Replication Alert Monitor that runs every 120 seconds (two minutes) for the specified monitor qualifier:


asnmon monitor_server=wsdb monitor_qual=monqual monitor_interval=120

Example 3

To start a Replication Alert Monitor and specify that it run only once for the specified monitor qualifier:


asnmon monitor_server=wsdb monitor_qual=monqual runonce=y

Example 4

To start a Replication Alert Monitor that sends email notifications if it detects monitoring errors:


asnmon monitor_server=wsdb monitor_qual=monqual 
  monitor_errors="repladm@company.com, dbadmin@company.com"

Example 5

To start a Replication Alert Monitor that runs every 120 seconds (two minutes) and waits 1440 minutes (24 hours) before sending alerts:


asnmon monitor_server=wsdb monitor_qual=monqual monitor_interval=120
  max_notifications_per_alert=2 max_notifications_minutes=1440

This Replication Alert Monitor program sends a maximum of two alerts when the alerts occurred during the time period specified by the max_notifications_minutes parameter value (1440 minutes).