db2GetAlertCfg API - Get the alert configuration settings for the health indicators
Returns the alert configuration settings for the health indicators.
Authorization
None
Required connection
Instance. If there is not instance attachment, a default instance attachment is created.
API include file
db2ApiDf.h
API and data structure syntax
SQL_API_RC SQL_API_FN
db2GetAlertCfg (
db2Uint32 versionNumber,
void * pParmStruct,
struct sqlca * pSqlca);
typedef SQL_STRUCTURE db2GetAlertCfgData
{
db2Uint32 iObjType;
char *piObjName;
db2Uint32 iDefault;
char *piDbName;
db2Uint32 ioNumIndicators;
struct db2GetAlertCfgInd *pioIndicators;
} db2GetAlertCfgData;
typedef SQL_STRUCTURE db2GetAlertCfgInd
{
db2Uint32 ioIndicatorID;
sqlint64 oAlarm;
sqlint64 oWarning;
db2Uint32 oSensitivity;
char *poFormula;
db2Uint32 oActionEnabled;
db2Uint32 oCheckThresholds;
db2Uint32 oNumTaskActions;
struct db2AlertTaskAction *poTaskActions;
db2Uint32 oNumScriptActions;
struct db2AlertScriptAction *poScriptActions;
db2Uint32 oDefault;
} db2GetAlertCfgInd;
typedef SQL_STRUCTURE db2AlertTaskAction
{
char *pTaskName;
db2Uint32 condition;
char *pUserID;
char *pPassword;
char *pHostName;
} db2AlertTaskAction;
typedef SQL_STRUCTURE db2AlertScriptAction
{
db2Uint32 scriptType;
db2Uint32 condition;
char *pPathName;
char *pWorkingDir;
char *pCmdLineParms;
char stmtTermChar;
char *pUserID;
char *pPassword;
char *pHostName;
} db2AlertScriptAction;
db2GetAlertCfg API parameters
- versionNumber
- Input. Specifies the version and release level of the structure passed as the second parameter pParmStruct.
- pParmStruct
- Input. A pointer to the db2GetAlertCfgData structure.
- pSqlca
- Output. A pointer to the sqlca structure.
db2GetAlertCfgData data structure parameters
- iObjType
- Input. Specifies the type of object for which configuration is
requested. Valid values are:
- DB2ALERTCFG_OBJTYPE_DBM
- DB2ALERTCFG_OBJTYPE_DATABASES
- DB2ALERTCFG_OBJTYPE_TABLESPACES
- DB2ALERTCFG_OBJTYPE_TS_CONTAINERS
- DB2ALERTCFG_OBJTYPE_DATABASE
- DB2ALERTCFG_OBJTYPE_TABLESPACE
- DB2ALERTCFG_OBJTYPE_TS_CONTAINER
- piObjName
- Input. The name of the table space or table space container when the object type, iObjType, is set to DB2ALERTCFG_OBJTYPE_TABLESPACE or DB2ALERTCFG_OBJTYPE_TS_CONTAINER.
- iDefault
- Input. Indicates that the default installation configuration values are to be retrieved.
- piDbname
- Input. The alias name for the database for which configuration is requested when object type, iObjType, is DB2ALERTCFG_OBJTYPE_TS_CONTAINER, DB2ALERTCFG_OBJTYPE_TABLESPACE, and DB2ALERTCFG_OBJTYPE_DATABASE.
- ioNumIndicators
- This parameter can be used as either an input or output parameter.
Input: Indicates the number of pioIndicators submitted when requesting the settings for a subset of health indicators.
Output: Indicates the total number of health indicators returned by the API.
- pioIndicators
- A pointer to the db2GetAlertCfgInd structure. If it is set to NULL, all health indicators for that object will be returned.
db2GetAlertCfgInd data structure parameters
- ioIndicatorID
- The health indicator (defined in sqlmon.h).
- oAlarm
- Output. The health indicator alarm threshold setting. This setting is valid for threshold-based health indicators only.
- oWarning
- Output. The health indicator warning threshold setting. This setting is valid for threshold-based health indicators only.
- oSensitivity
- Output. The period of time a health indicator's value must remain within a threshold zone before the associated alarm or warning condition is registered.
- poFormula
- Output. A string representation of the formula used to compute the health indicator's value.
- oActionEnabled
- Output. If TRUE, then any alert actions that are defined in poTaskActions or poScriptActions will be invoked if a threshold is breached. If FALSE, none of the defined actions will be invoked.
- oCheckThresholds
- Output. If TRUE, the threshold breaches or state changes will be evaluated. If threshold breaches or states are not evaluated, then alerts will not be issued and alert actions will not be invoked regardless of whether oActionEnabled is TRUE.
- oNumTaskActions
- Output. The number of task alert actions in the pTaskAction array.
- poTaskActions
- A pointer to the db2AlertTaskAction structure.
- oNumScriptActions
- Output. The number of script actions in the poScriptActions array.
- poScriptActions
- A pointer to the db2AlertScriptAction structure.
- oDefault
- Output. Indicates whether current settings are inherited from the default. Set to TRUE to indicate the current settings are inherited from the default; set to FALSE otherwise.
db2AlertTaskAction data structure parameters
- pTaskname
- The name of the task.
- condition
- The condition for which to run the action.
- pUserID
- The user account under which the script will be executed.
- pPassword
- The password for the user account pUserId.
- pHostName
- The host name on which to run the script. This applies for both task and script.
- Script
- The hostname for where the script resides and will be run.
- Task
- The hostname for where the scheduler resides.
db2AlertScriptAction data structure parameters
- scriptType
- Specifies the type of script. Valid values are:
- DB2ALERTCFG_SCRIPTTYPE_DB2CMD
- DB2ALERTCFG_SCRIPTTYPE_OS
- condition
- The condition on which to run the action. Valid values for threshold
based health indicators are:
- DB2ALERTCFG_CONDITION_ALL
- DB2ALERTCFG_CONDITION_WARNING
- DB2ALERTCFG_CONDITION_ALARM
- pPathname
- The absolute pathname of the script.
- pWorkingDir
- The absolute pathname of the directory in which the script is to be executed.
- pCmdLineParms
- The command line parameters to be passed to the script when it is invoked. Optional for DB2ALERTCFG_SCRIPTTYPE_OS only.
- stmtTermChar
- The character that is used in the script to terminate statements. Optional for DB2ALERTCFG_SCRIPTTYPE_DB2CMD only.
- pUserID
- The user account under which the script will be executed.
- pPassword
- The password for the user account pUserId.
- pHostName
- The host name on which to run the script. This applies for both task and script.
- Script
- The hostname for where the script resides and will be run.
- Task
- The hostname for where the scheduler resides.
Usage notes
If pioIndicators is left NULL, all health indicators for that object will be returned. This parameter can be set to an array of db2GetAlertCfgInd structures with the ioIndicatorID set to the health indicator for which the configuration is wanted. When used in this manner, be sure to set ioNumIndicators to the input array length and to set all other fields in db2GetAlertCfgInd to 0 or NULL.
All of the memory under this pointer is allocated by the engine and must be freed with a call to the db2GetAlertCfgFree API whenever the db2GetAlertCfg API returns with no error. See db2ApiDf.h, located in the include directory, for information about the db2GetAlertCfgFree API.