How-To Guide Os Command Adapter
How-To Guide Os Command Adapter
This guide explains how you can react to MAI Alerts in SAP
Solution Manager 7.10 by sending an OS Command
TABLE OF CONTENT
1
1.1
1.2
1.3
PREREQUISITES ........................................................................................................................ 5
SAP Solution Manager 7.10........................................................................................................ 5
SAP Notes ................................................................................................................................... 5
System Monitoring Setup ........................................................................................................... 5
2
2.1
2.2
2.3
2.3.1
2.3.2
3
3.1
3.1.1
3.1.2
3.2
4
4.1
4.2
4.3
TROUBLESHOOTING ................................................................................................................21
E2E MAI is a unique and centralized alerting approach retrieving metrics and simple events from different
data providers as CCMS at managed system or Wily Introscope via push or pull mechanism.
It includes:
An Event Calculation Engine to calculate complex events and end-user alerts out of the retrieved
metrics and simple events to avoid alert flooding.
A centralized directory for metrics, events and alerts including SAP and customer template
knowledge and context information as system landscape, business process or interface information.
Then end-user alerts are forwarded to several alert consumers as Alert Inbox, Incident Management and
Notification Engine provided by SAP Solution Manager. In order to forward those events to third party tool an
Alert Consumer Connector allows implementing standard forwarding protocols.
In this context, an adapter is implemented to react to alert by calling an OS Command.
1
1.1
PREREQUISITES
SAP Solution Manager 7.10
The OS Command Adapter is available standard with Solution Manager 7.10 SP06 and upper releases.
1.2
SAP Notes
1.3
The System Monitoring setup (transaction solman_setup) must have been successfully completed.
OS COMMAND ADAPTER
Overall mechanism
1. The ACC is configured to send 3rd Party Alert Information to the BAdI Implementation
( see configuration details).
2. All the necessary data to be forwarded to the 3 rd party is bundled in a table and passed to the OS
Command Adapter.
a. Instantiate the OS Command Adapter and pass the AlertInfo Bundle (key-value table)
b. Call : OSCommandAdapterexecute_command()
c. This will trigger the steps 3 and 4.
3. Based on the OS Command Configuration, the Executable options and parameters are built
( see configuration details).
4. The configured OS Command is called.
2.2
OS Command usage
Starting with Solution Manager 7.10 SP06 an SAP-Standard BAdI implementing class is provided:
CL_ALERT_REACT_OS_COMMAND (package AI_SOLMAN_ALRT_AL_REACTION_IMP)
Name
Value
[MAI:ALERT:MO_NAME]
[MAI:ALERT:MO_TYPE]
[MAI:ALERT:ID]
[MAI:ALERT:DATE]
[MAI:ALERT:TIME]
[MAI:ALERT:NAME]
[MAI:ALERT:TECHNICAL_NAME]
[MAI:ALERT:DESCRIPTION]
[MAI:ALERT:CATEGORY]
[MAI:ALERT:RATING]
[MAI:ALERT:SEVERITY]
[MAI:METRIC:NAME_PATH]
[MAI:METRIC:VALUE]
[MAI:ALERT:MO_ID]
[MAI:ALERT:STATUS]
[MAI:ALERT:REASON_FOR_CLOSURE]
[MAI:ALERT:PRIORITY]
Type
Length
Char
Char
Char
Char
Char
Char
Char
Char
Char
Integer
Integer
Char
Char
Char
Char
Integer
Integer
128
10
32
8
6
128
60
128
10
1
1
128
128
32
4
1
1
[MAI:ALERT:CATEGORY] :
[MAI:ALERT:STATUS] :
[MAI:ALERT:RATING] :
[MAI:ALERT:REASON_FOR_CL
OSURE] :
[MAI:ALERT:SEVERITY] :
[MAI:ALERT:PRIORITY] :
2.3
BAdI Implementation
The OS Command Adapter is ready to be used within a BAdI implementation that has to be created.
2.3.1
Any listener of the Alert Inbox must implement the BAdI Definition BADI_ALERT_REACTION from the
Enhancement Spot ALERT_REACTION (package AI_SOLMAN_ALRT_AL_REACTION_ENH):
ALERT_REACTION_OPTION (Character-Type)
The Implementing Class must be CL_ALERT_REACT_OS_COMMAND if you want to use the SAPStandard MAI Information, or any other implementing class according to your needs.
2.3.2
10
11
Then set a dedicated BAdI Filter Value that will be used to differentiate Configurations.
After activating the implementing class and the BAdI implementation, it will be registered when the next Alert
Notification is triggered by the ACC.
12
OS COMMAND CONFIGURATION
As of Solution Manager SP07, a dedicated User Interface has been implemented to configure the OS
Command.
SP06 releases do not have a dedicated User Interface and configuration is done via the Administrative
SolutionManager Generic Storage UI with Configuration ID = MAI_OS_CMS_CONFIG. ( see configuration
details).
For SP07 and upper, make sure in transaction SICF that the service mai_os_command_config is
active.
3.1
http://<SolutionManagerHost>:<port>/sap/bc/webdynpro/sap/mai_os_command_config
13
If this is the first time you are accessing the Configuration UI, youll need to create a new Configuration.
1. Expand the Panel Create a Configuration
2. Set Filter Value to <BAdI_FilterValue>_REACT (replace <BAdI_FilterValue> by its value
configured when creating the BAdI entities)
3. Press Create
4. Set Filter Value to <BAdI_FilterValue>_REACT_CLOSE (replace <BAdI_FilterValue> by its value
configured when creating the BAdI entities)
5. Press Create
This will create 2 Configuration Entries for each type of forwarding (AlertChange & AlertClosure):
- one describing the OS Command Options,
- one describing the OS Command Parameters.
14
3.1.1
OS Command Options
The 2 mandatory configurations are aimed to eventually react differently between an Alert Change
(OS_CMD_REACT) and an Alert Closure (OS_CMD_REACT_CLOSE). It is however possible to deactivate
one of them by setting the value <SKIP> to the COMMAND_NAME option.
15
You can specifically skip some ratings by adding the Parameter Name 00;RATINGS_TO_SKIP and
set the values of the ratings you want to skip, separated by the separator ;. For example, to skip Grey and
Green Alert Ratings, the value has to contain : 0;1
Do not forget to prefix (separated by semi-columns) the option name with the index order to which you
want the OS Command to be called :
01;option1 / value1
02;option2 / value2
SM49_CMD
ANYOS
true
/cfg/mydir/
16
3.1.2
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.
If you need to add Parameters, replace the -1;NO_PARAMETER with the Parameters at your convenience,
for example:
01;alertID
02;alertDateTime
03;description
04;$$
[MAI:ALERT:ID]
[MAI:ALERT:DATE] at [MAI:ALERT:TIME]
[MAI:ALERT:DESCRIPTION]
[MAI:ALERT:RATING]
This will create the following Parameters line that will be concatenated to the previously build Options line :
alertID <MAI_alertID_value> alertDateTime <MAI_alertDate_value> at
<MAI_alertTime_value> description <MAI_alertDescription_value>
<MAI_alertRating_value>
The Parameter name $$ indicates that there will be parameter name (only a parameter value).
The OS Command is limiting the concatenated length of all Parameters to maximum 1024 chars.
17
3.2
The OS Command dedicated User interface could not be downported to SP06. Therefore youll need to use
the Administrative Solution Manager Storage UI :
http://<SolutionManagerHost>:<port>/sap/bc/webdynpro/sap/wd_sise_admin
If this is the first time you are accessing the Configuration UI, youll need to create a new Configuration to
create the entry MAI_OS_CMD_CONFIG~MAI_OS_CMD_CONFIG.
Run ABAP Report : PR_ALERT_INIT_OS_CMD_CONFIG.
Set Filter Value to the previously assigned BAdI Filter Value concatenated with :
1. _REACT for the REACT_TO_ALERTS OS Command
2. _REACT_CLOSE for the REACT_TO_CLOSED_ALERT OS Command
This will create 2 Configuration entries: one relative to the OS Command Options, the other relative to the
OS Command Parameters. The configuration is then identical to the previous section.
18
You need to enable the 3rd Party forwarding and this can be done at different levels:
- Global
- and/or Template
- and/or Alert.
4.1
19
4.2
4.3
20
TROUBLESHOOTING
For the Initialization process and if an unexpected error occurs, you can also check the following ExternalID :
21
www.sap.com