You can execute any operating system command as an auto-reaction to a monitoring architecture alert. The auto-reaction method CCMS_AUTO_REACT_OP_COMMAND is available to you for this purpose. For security reasons, this does, however, apply only for those commands that have previously been defined in External Operating System Commands (transaction SM69).
To use the auto-reaction method, ensure that you are using a current SAPXPG from the SAP Service Marketplace (http://service.sap.com/swdc → Download → Support Packages and Patches → Entry by Application Group → SAP NetWeaver → SAP NetWeaver → SAP NetWeaver 04 → Entry by Component → AS ABAP → SAP KERNEL 6.40 32/64-BIT → <Platform> → Database independent).
The key feature of this auto-reaction method is that you can transfer details about the alert to the operating system command as parameters. Use method parameters to do this, which can contain arguments that are in turn replaced by the relevant alert data at runtime.
In detail, the auto-reaction method has the following method parameters:
Method Parameter | Meaning |
---|---|
COMMAND |
Logical command that is to be executed in the case of an alert |
PARAMETERS |
Static parameter to which you transfer the logical command |
REACT_ON_ALERTS |
Alert color at which the auto-reaction method is to be started YELLOW: Only start the method for yellow alerts RED: Only start the method for red alerts <anything else>: Start the method for all alerts |
MTENAME |
SID/SEGMENT/CONTEXT/OBJECT/ATTRIBUTE; if an alert occurs, the arguments are filled with the relevant values (see below) |
PARAMLIST_1 |
Additional parameters that are transferred to the operating system command; these can contain arguments in addition to normal text (see below) |
PARAMLIST_2 |
|
PARAMLIST_3 |
|
PARAMLIST_4 |
The COMMAND parameter is required, all other parameters are optional.
The following arguments in the method parameters MTENAME and PARAMLIST_<n> are replaced by the relevant values at runtime:
Argument | Meaning |
---|---|
SID |
System ID of the system in which the alert occurred |
CONTEXT |
Monitoring context of the MTE |
OBJECT |
Monitoring object of the MTE |
ATTRIBUTE |
Monitoring attribute of the MTE |
SEGMENT |
Monitoring segment of the MTE |
COLOR |
Color of the alert (YELLOWor RED) |
SEVERITY |
Severity of the alert |
DATE TIME |
Date and time of the alert (system date and system time) |
CLIENT |
Client of the user under which the alert was generated |
USER |
User under which the alert was generated (this information is not always available) |
REPORTER |
Function or C source that is responsible for the creation of the alert |
CLASS |
Message class (such as SAP-SYSLOGor SAP-T100) |
ID |
Class and number of the message (such as A04) |
ARG1 ARG2 ARG3 ARG4 |
Arguments of the message |
TXT |
Text of the message without arguments (in system language) |
MSG |
Expanded message with arguments (in system language) |
MSCGL |
global external line ID |
Note that parameters that are transferred to operating system commands must be separated by spaces. The following parts of the parameters, which may contain spaces, are therefore enclosed in single quotation marks ( ' ) for UNIX and quotation marks ( " ) for Microsoft Windows:
In this way, all parts of the MTE name and the arguments MSG and TXT are each identified as one parameter.
Separate all other arguments in the method parameters by space, if these are to be recognized as independent parameters. A space is automatically inserted between the arguments of MTENAME and PARAMLIST_<n> (see also the example below). If two arguments are to be identified as one parameter, do not place a space between the arguments.
Note also, that an argument can only be specified once in MTENAME and in all PARAMLIST_* parameters.
You must define the desired operating system command in the External Operating System Commands transaction. To do this, proceed as follows:
The optional static parameter, which you defined in the input field Parameter for Operating System Command in transaction SM69, is first transferred to the operating system command. Which other parameters are additionally transferred to the command depends on the configuration of the corresponding auto-reaction method.
Copy Method
We recommend that you leave the original method CCMS_AUTO_REACT_OP_COMMAND unchanged and use it only as a template for your methods. In this way, you can set up as many logical commands as you wish as auto-reactions.
Adjust Method Parameters and Release Method
By default, the operating system command is executed on the local server of the MTE that generated the alert. If the command is to be executed on a different server, change the execution location on the Execution tab page in the Execute Method On group box.
Assigning the Method to the Desired Node
You must now assign the method to the desired MTEs or MTE classes. You can use either transaction RZ20 (only for the active properties variant) or transaction RZ21 to do this (see also Changing Properties and Method Assignments). Assignment using transaction RZ20 is described below:
Assign Analysis Method to the Selected MTE Class
Assign Analysis Method to Only this MTE
If an alert is triggered for one of the MTEs to which you have assigned this auto-reaction method, the monitoring architecture will automatically execute the corresponding logical command.
Alerts are to be logged. To do this, a file with the name alert_<date>_<time>.txt is to be created, which contains information about the alert, such as:
yellow alert from 'PDR/SAP_CCMS_pdrhost_PRD_00/prdhost_PRD_00/R3Syslog/BasisSystem' A04 'Load format of SAPLQDIS abload1 0413 invalid.'
Parameter | Parameter Value |
---|---|
COMMAND |
Z_TEST |
PARAMETERS |
|
REACT_ON_ALERTS |
|
MTENAME |
SID/SEGMENT/CONTEXT/OBJECT/ATTRIBUTE |
PARAMLIST_1 |
COLOR DATE_TIME MSG |
PARAMLIST_2 |
ID |
PARAMLIST_3 |
|
PARAMLIST_4 |
|
Allow additional parameters for both logical commands.
With the settings that you have just adjusted, the following command is executed if an alert occurs:
test.sh '<SID>/<SEGMENT>/<CONTEXT>/<OBJECT>/<ATTRIBUTE>' <COLOR> <DATE>_<TIME> '<MSG>' <ID>
test.cmd '<SID>/<SEGMENT>/<CONTEXT>/<OBJECT>/<ATTRIBUTE>' <COLOR>
<DATE>_<TIME> '<MSG>' <ID>
#!/usr/bin/shecho $2 alert from $1 Message $5 $4 > alert_$3.txt
echo %2 alert from %1 Message %5 %4 > alert_%3.txt
If you are not using absolute path specifications, the file is stored in the DIR_HOME directory.