This guide explains how you can react to Monitoring and Alerting Infrastructure (MAI) Alerts in SAP Focused Run by sending an OS Command:
Within SAP Focused Run, MAI offers a unique and centralized alerting approach. It pulls metrics and simple events from different data providers as a simple diagnostics agent at the managed system. Alternatively, MAI provides this information via a (third-party product) CA Application Performance Management push mechanism.
SAP Focused Run uses an Alert Consumer Connector (ACC), with adjustable protocols, to forward collected MAI data to end users via automatic notifications and an alert inbox. In addition, the ACC can process MAI data through a third-party connector. In that event, an OS command adapter executes external OS commands and directs MAI data to a desired third-party tool.
The OS Command Adapter is fully configurable to execute any external OS Command.
In SAP Focused Run an SAP-Standard BAdI implementing class is provided: CL_ALERT_REACT_OS_COMMAND (package AI_SOLMAN_ALRT_AL_REACTION_IMP)
The provided implementation is bundling the following MAI Alert Information:
Name of the Managed Object reporting the Alert
T_SYSTEM, INSTANCE, HOST, DBMS…
Unique ID that identifies the Alert in MAI
UTC Date (YYYYMMDD)
UTC Time (hhmmss)
Human readable short name of the Alert
Technical ID of the Alert
Alert Description (or Custom Description)
AVAIL, PERFORM, EXCEPTION, CONFIGURE
0:Unknown, 1:Normal, 2:Warning, 3:Critical
0:Low … 5:Medium … 9:Critical
Metric Name (or Metric Path for grouped metric)
Metric Value and Unit (or Metric Text Value)
Unique ID that identifies the Managed Object
1:Re-configuration, 2:Work mode Change, 3:Green alert…
1:Low, 2:Medium, 3:High, 4:Very high
System Home (Host Name) for the Managed Object
The corresponding value ranges are as follows:
Custom BAdI implementation overview
Alert Inbox listeners should implement the BAdI Definition BADI_ACC_REACTION_EXT from the Enhancement Spot ACC_REACTION_EXTERNAL (package AI_SOLMAN_ALRT_CONSM_MGMT):
The BAdI filter is as follow: ACC_REACTION_FILTER (Character-Type)
The Implementing class should be Standard MAI Information, or any
CL_ALERT_REACT_OS_COMMAND if you want to use the SAP-other implementing class according to your needs.
Steps to Create BAdI entities
With transaction SE19, create a new Z Enhancement Implementation based on the existing Enhancement Spot ACC_REACTION_EXTERNAL in a similar way as shown in the screenshot below:
The following detailed view results from the newly-created BAdI implementation:
Set a dedicated BAdI filter value that will be used to differentiate configurations:
Note: When the ACC triggers its next alert notification, it registers the activated implementing class and the BAdI implementation.
In SAP Focused Run a dedicated User Interface has been implemented to configure the OS Command.
Note: Ensure that for transaction SICF that the service mai_os_command_config is active.
When accessing the configuration UI for the first time, follow the steps below to create a new configuration:
This will create 2 Configuration Entries for each type of forwarding (AlertChange & AlertClosure):
Note: The two created configurations must be set to react differently:
OS Command Options
Two mandatory options are already pre-filled:
The values must reflect the SM49 External OS Command Configuration. An example SM49 command has been configured in the figure shown above.
Note: The two mandatory configurations react to an Alert Change (OS_COMMAND_REACT) and an Alert Closure (OS_COMMAND_REACT_CLOSE). You can deactivate a reaction by setting the value <SKIP> value to the COMMAND_NAME option.
Note: Be sure to prefix (separated by semi-columns) the option name with the index order to which you want the OS command to be executed:
Note: Option values can remain empty. Alternatively, you can add new options.
The above options create the following OS Command call:
<SM49_CMD_ConfiguredCommand> -v -d ‘true' -DIR /cfg/mydir/
OS Command Parameters
Additionally, to Options, you can configure the OS Command Adapter to send Parameters.
By default it is configured with “-1;NO_PARAMETER” that indicates that no parameter will be build. Please do not remove this entry to avoid the Configuration Entry to be deleted automatically.
The format is the following: <FieldIndex>;<FieldName> <FieldType> (<FieldType> = s(tring) or i(nteger) ). If FieldType is s(tring), then the parameter value should be enclosed in quotes, but if it is i(nteger), then no need to do so.
If you need to add Parameters, replace the “-1;NO_PARAMETER” with the Parameters at your convenience as shown in the screenshot, for example:
01;r3frunAlertMOName s '[MAI:ALERT:MO_NAME]'
02;r3frunAlertDate s ‘[MAI:ALERT:DATE]'
03;r3frunAlertSeverity i [MAI:ALERT:SEVERITY]
04;$$ i [MAI:ALERT:RATING]
This will create the following Parameters' line that will be concatenated to the previously build Options' line:
r3frunAlertMOName s '<MAI_AlertMOName_value>' r3frunAlertDate s '<MAI_AlertDate_value>' r3frunAlertSeverity i <MAI_AlertSeverity_value> i <MAI_AlertRating>
Note: The Parameter name ‘$$' indicates that there will be parameter name (only a parameter value).
Note: The OS Command is limiting the concatenated length of all Parameters to maximum 1024 chars.
Enable the outbound integration at one or more of the following levels:
3 In the newly opened window, Click Add.
4 Provide Name, Description and set the Status to Active.
5 Click the Outbound Integration Input field, and select one or more appropriate Outbound Integration from the suggestion list.
6 Choose ‘Save' to save the Outbound Integration Variant.
Logs are available using SLG1 transaction.
External ID has the following structure:
<ConfigurationFilterValue> _ OSCMD_<ManagedObject Name> _ <Alert Category> _ <AlertName>
For the Initialization process, and if an unexpected error occurs, you can also check the following External ID: