UPDATE ALERT CONFIGURATION command using the ADMIN_CMD procedure

The UPDATE ALERT CONFIGURATION command updates the alert configuration settings for health indicators.

Important: This command or API has been deprecated and might be removed in a future release because the health monitor has been deprecated in Version 9.7. It is not supported in Db2® pureScale® environments. For more information, see Health monitor has been deprecated.

Authorization

One of the following authorities:
  • SYSADM
  • SYSMAINT
  • SYSCTRL

Required Connection

Database

Command Syntax

Read syntax diagramSkip visual syntax diagramUPDATE ALERTCONFIGURATIONCONFIGCFGFORDATABASE MANAGERDB MANAGERDBMDATABASESCONTAINERSTABLESPACESDATABASETABLESPACEtblspace-nameCONTAINERcontainer-nameFORtblspace-nameONdatabase-aliasUSINGhealth-indicator-nameSET,parameter-namevalueUPDATE ACTION,SCRIPTpathnameTASKtask-nameONWARNINGALARMALLALERTATTENTIONstate,SETparameter-namevalueDELETE ACTION,SCRIPTpathnameTASKtask-nameONWARNINGALARMALLALERTATTENTIONstateADD ACTION,SCRIPTpathnameAdd Script DetailsTASKtask-nameONState and User Details
Add Script Details
Read syntax diagramSkip visual syntax diagramTYPEDB2STATEMENT TERMINATION CHARACTERSTMT TERM CHARTERM CHARcharacterOPERATING SYSTEMOSCOMMAND LINE PARAMETERSPARMSparmsWORKING DIRECTORYpathname
State and User Details
Read syntax diagramSkip visual syntax diagramWARNINGALARMALLALERTATTENTIONstateONhostnameUSERusernameUSINGpassword

Command Parameters

DATABASE MANAGER
Updates alert settings for the database manager.
DATABASES
Updates alert settings for all databases managed by the database manager. These are the settings that apply to all databases that do not have custom settings. Custom settings are defined using the DATABASE ON database-alias clause.
CONTAINERS
Updates alert settings for all table space containers managed by the database manager. These are the settings that apply to all table space containers that do not have custom settings. Custom settings are defined using the CONTAINER container-name ON database-alias clause.
TABLESPACES
Updates alert settings for all table spaces managed by the database manager. These are the settings that apply to all table spaces that do not have custom settings. Custom settings are defined using the TABLESPACE tblspace-name ON database-alias clause.
DATABASE ON database-alias
Updates the alert settings for the database specified using the ON database-alias clause. If this database has custom settings, then they override the settings for all databases for the instance, which is specified using the DATABASES parameter.
CONTAINER container-name FOR tblspace-name ON database-alias
Updates the alert settings for the table space container called container-name, for the table space specified using the FOR tblspace-name clause, on the database specified using the ON database-alias clause. If this table space container has custom settings, then they override the settings for all table space containers for the database, which is specified using the CONTAINERS parameter.
TABLESPACE tblspace-name ON database-alias
Updates the alert settings for the table space called name, on the database specified using the ON database-alias clause. If this table space has custom settings, then they override the settings for all table spaces for the database, which is specified using the TABLESPACES parameter.
USING health-indicator-name
Specifies the set of health indicators for which alert configuration will be updated. Health indicator names consist of a two-letter object identifier followed by a name which describes what the indicator measures. For example:
db.sort_privmem_util
SET parameter-name value
Updates the alert configuration element, parameter-name, of the health indicator to the specified value. parameter-name must be one of the following values:
  • ALARM: the value is a health indicator unit.
  • WARNING: the value is a health indicator unit.
  • SENSITIVITY: the value is in seconds.
  • ACTIONSENABLED: the value can be either YES or NO.
  • THRESHOLDSCHECKED: the value can be either YES or NO.
The list of possible health indicator units for your specific Db2 version can be gathered by running the following query :
SELECT SUBSTR(UNIT,1,80) AS UNIT 
   FROM TABLE(HEALTH_GET_IND_DEFINITION('')) AS T GROUP BY UNIT
UPDATE ACTION SCRIPT pathname ON [WARNING | ALARM | ALLALERT | ATTENTION state]
Specifies that the script attributes of the predefined script with absolute path name pathname will be updated according to the following clause:
SET parameter-name value
Updates the script attribute, parameter-name, to the specified value. parameter-name must be one of the following values:
  • SCRIPTTYPE

    OS or DB2 are the valid types.

  • WORKINGDIR
  • TERMCHAR
  • CMDLINEPARMS
    The command line parameters that you specify for the operating system script will precede the default supplied parameters. The parameters that are sent to the operating system script are:
    • List of user supplied parameters
    • Health indicator short name
    • Fully qualified object name
    • Health indicator value
    • Alert state
  • USERID
  • PASSWORD
  • SYSTEM
UPDATE ACTION TASK task-name ON [WARNING | ALARM | ALLALERT | ATTENTION state]
Specifies that the task attributes of the task with name name will be updated according to the following clause:
SET parameter-name value
Updates the task attribute, parameter-name, to the specified value. parameter-name must be one of the following values:
  • USERID
  • PASSWORD
  • SYSTEM
DELETE ACTION SCRIPT pathname ON [WARNING | ALARM | ALLALERT | ATTENTION state]
Removes the action script with absolute path name pathname from the list of alert action scripts.
DELETE ACTION TASK task-name ON [WARNING | ALARM | ALLALERT | ATTENTION state]
Removes the action task called name from the list of alert action tasks.
ADD ACTION SCRIPT pathname ON [WARNING | ALARM | ALLALERT | ATTENTION state]
Specifies that a new action script with absolute path name pathname is to be added, the attributes of which are given by the following:
TYPE
An action script must be either a Db2 Command script or an operating system script:
  • DB2
  • OPERATING SYSTEM
If it is a Db2 Command script, then the following clause allows one to optionally specify the character, character, that is used in the script to terminate statements:
STATEMENT TERMINATION CHARACTER ;

If it is an operating system script, then the following clause allows one to optionally specify the command-line parameters, parms, that would be passed to the script upon invocation: COMMAND LINE PARAMETERS parms

WORKING DIRECTORY pathname
Specifies the absolute path name, pathname, of the directory in which the script will be executed.
USER username USING password
Specifies the user account, username, and associated password, password, under which the script will be executed. When using the ADD ACTION option, the username and password might be exposed in the network (where the username and password are sent unencrypted), to the db2diag log file, trace files, dump file, snapshot monitor (dynamic SQL snapshot), system monitor snapshots, a number of event monitors (such as statement, deadlock), explain tables, db2pd output (such as package cache and lock timeout mechanisms) and Db2 audit records.
ADD ACTION TASK name ON [WARNING | ALARM | ALLALERT | ATTENTION state]
Specifies that a new task, called name, is to be added to be run ON the specified condition.
ON [WARNING | ALARM | ALLALERT | ATTENTION state]
Specifies the condition on which the action or task will run. For threshold-based health indicators (HIs), this is WARNING or ALARM. For state-based HIs, this can be a numeric state as documented for each state-based HI (for example, for the ts.ts_op_status health indicator, refer to the tablespace_state monitor element for table space states), or a text identifier for this state. ALLALERTS handles any changes in the state for threshold-based HIs and state-based HIs (for example, the state changes from warning to normal).
ATTENTION state
Valid numeric values for some of the database health indicator states are given in the following section, as an example for the ADD ACTION SCRIPT CLP command option:
  • 0 - Active; Normal (ACTIVE)
  • 1 - Quiesce pending (QUIESCE_PEND)
  • 2 - Quiesced (QUIESCED)
  • 3 - Rollforward (ROLLFWD)

Additional state-based health indicators are defined in the header files sqlmon.h and sqlutil.h.

The UPDATE ALERT CFG command called by the ADMIN_CMD stored procedure supports either a numeric value or a text identifier for state. Valid numeric values and text identifiers for some additional health indicator states, as an example for the table space operational status health indicator (ts.ts_op_status), are:
  • 0x1 - QUIESCED_SHARE
  • 0x2 - QUIESCED_UPDATE
  • 0x4 - QUIESCED_EXCLUSIVE
Using the UPDATE ALERT CFG command and the health indicator values listed previously, the following command line entry,
ADD ACTION SCRIPT ... ON ATTENTION 2
is equivalent to
ADD ACTION SCRIPT ... ON ATTENTION QUIESCED_UPDATE
In addition, for the table space operational status health indicator (ts.ts_op_status), you can specify multiple states using a single numeric value by OR'ing states together. For example, you can specify state 7 (= 0x1 + 0x2 + 0x4), the action will be performed when the table space enters any of the Quiesced: SHARE, Quiesced: UPDATE or Quiesce: EXCLUSIVE states. Alternatively, you could specify QUIESCED_SHARE, QUIESCED_UPDATE, and QUIESCED_EXCLUSIVE in three separate UPDATE ALERT CFG command executions.

Example

Add an action for the db.log_fs_util indicator that will execute the script /home/test/scripts/logfsutilact when there is an alarm on the system with hostname 'plato'.
CALL SYSPROC.ADMIN_CMD( 'update alert cfg for databases using 
   db.log_fs_util add action script /home/test/scripts/logfsutilact 
   type os command line parameters "param1 param2" working 
   directory /tmp on alarm on plato user dricard using mypasswdv' )
To check the alert configuration after it has been set, you can use the HEALTH_GET_IND_DEFINITION and HEALTH_GET_ALERT_ACTION_CFG table functions as follows:
SELECT OBJECTTYPE, ID, CONDITION, ACTIONTYPE, 
   SUBSTR(ACTIONNAME,1,50) AS ACTION_NAME 
   FROM TABLE(SYSPROC.HEALTH_GET_ALERT_ACTION_CFG('DB','G','','')) 
   AS ALERT_ACTION_CFG
The following is an example of output from this query:
OBJECTTYPE ID     CONDITION  ACTIONTYPE ACTION_NAME
---------- ------ ---------- ---------- ----------------------------------
DB           1006 ALARM      S          /home/dricard/scripts/logfsutilact

   1 record(s) selected.

Usage notes

For the ADD ACTION option, the supplied username and password may be exposed in various places where SQL statement text is captured:
  • the network (username/password are passed over the wire unencrypted)
  • db2diag log file
  • trace files
  • dump file
  • snapshot monitor (dynamic SQL snapshot)
  • system monitor snapshots
  • a number of event monitors (statement, deadlock)
  • explain tables
  • db2pd output (package cache and lock timeout mechanisms, among others)
  • Db2 audit records

Command execution status is returned in the SQLCA resulting from the CALL statement.

The database-alias must be defined in the catalog on the server and be local to the server.

The pathname must be with a fully-qualified server path name.