0% found this document useful (0 votes)
182 views

How-To Guide Os Command Adapter

How-To Guide Os Command Adapter

Uploaded by

Saurabh Dubey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
182 views

How-To Guide Os Command Adapter

How-To Guide Os Command Adapter

Uploaded by

Saurabh Dubey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

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

Version 2.20 (March 2015)


SAP Active Global Support

HOW-TO GUIDE: EXECUTE 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

OS COMMAND ADAPTER .......................................................................................................... 6


Overall mechanism ..................................................................................................................... 6
OS Command usage................................................................................................................... 7
BAdI Implementation .................................................................................................................. 9
Custom BAdI implementation overview ......................................................................................... 9
Steps to create the BAdI entities ..................................................................................................10

3
3.1
3.1.1
3.1.2
3.2

OS COMMAND CONFIGURATION .............................................................................................13


User Interface SP07 and upper .................................................................................................13
OS Command Options.................................................................................................................15
OS Command Parameters...........................................................................................................17
User Interface SP06 ...................................................................................................................18

4
4.1
4.2
4.3

MAI CONFIGURATION TO REACT TO ALERTS........................................................................19


Enabling the Third-Party Component at Global Level .............................................................19
Enabling the Third-Party Component at Template Level .........................................................20
Enabling the Third-Party Component at Alert Level ................................................................20

TROUBLESHOOTING ................................................................................................................21

HOW-TO GUIDE: EXECUTE OS COMMAND

E2E Monitoring and Alerting Infrastructure (E2E MAI):

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.

HOW-TO GUIDE: EXECUTE OS COMMAND

HOW-TO GUIDE: EXECUTE 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

Some additional corrections need to be applied:


For SP06 :
https://service.sap.com/sap/support/notes/1752573
https://service.sap.com/sap/support/notes/1754559
https://service.sap.com/sap/support/notes/1754295
https://service.sap.com/sap/support/notes/1779366
For SP07 :
https://service.sap.com/sap/support/notes/1779140
https://service.sap.com/sap/support/notes/1820724
https://service.sap.com/sap/support/notes/1779366
For SP08 :
https://service.sap.com/sap/support/notes/1959978
https://service.sap.com/sap/support/notes/1820727
For SP10 :
https://service.sap.com/sap/support/notes/1965064
For SP11 :
https://service.sap.com/sap/support/notes/2009733
For SP12 :
https://service.sap.com/sap/support/notes/2134843
For SP13 :
https://service.sap.com/sap/support/notes/2134848

1.3

System Monitoring Setup

The System Monitoring setup (transaction solman_setup) must have been successfully completed.

HOW-TO GUIDE: EXECUTE OS COMMAND

OS COMMAND ADAPTER

The OS Command Adapter is fully configurable to execute any External OS Command.


2.1

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.

HOW-TO GUIDE: EXECUTE OS COMMAND

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)

The provided implementation is bundling the following MAI Alert Information:

Name

Value

[MAI:ALERT:MO_NAME]

Name of the ManagedObject reporting the Alert

[MAI:ALERT:MO_TYPE]

T_SYSTEM, INSTANCE, HOST, DBMS

[MAI:ALERT:ID]

Unique ID that identifies the Alert in MAI

[MAI:ALERT:DATE]

UTC Date (YYYYMMDD)

[MAI:ALERT:TIME]

UTC Time (hhmmss)

[MAI:ALERT:NAME]

Human readable short name of the Alert

[MAI:ALERT:TECHNICAL_NAME]

Technical ID of the Alert

[MAI:ALERT:DESCRIPTION]

Alert Description (or Custom Description)

[MAI:ALERT:CATEGORY]

AVAIL, PERFORM, EXCEPTION, CONFIGURE

[MAI:ALERT:RATING]

0:Unknown, 1:Normal, 2:Warning, 3:Critical

[MAI:ALERT:SEVERITY]

0:Low 5:Medium 9:Critical

[MAI:METRIC:NAME_PATH]

Metric Name (or Metric Path for grouped metric)

[MAI:METRIC:VALUE]

Metric Value and Unit (or Metric TextValue)

[MAI:ALERT:MO_ID]

Unique ID that identifies the ManagedObject

[MAI:ALERT:STATUS]

O:Open, I:In process, T:Transferred, C:Confirmed

[MAI:ALERT:REASON_FOR_CLOSURE]

1:Re-configuration, 2:Work mode change, 3:Green alert

[MAI:ALERT:PRIORITY]

1:Low, 2:Medium, 3:High, 4:Very high

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

HOW-TO GUIDE: EXECUTE OS COMMAND

Here are the corresponding Value Ranges:


[MAI:ALERT:MO_TYPE] :

[MAI:ALERT:CATEGORY] :

[MAI:ALERT:STATUS] :

[MAI:ALERT:RATING] :
[MAI:ALERT:REASON_FOR_CL
OSURE] :

[MAI:ALERT:SEVERITY] :

[MAI:ALERT:PRIORITY] :

HOW-TO GUIDE: EXECUTE OS COMMAND

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

Custom BAdI implementation overview

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):

BAdI filter is:


-

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.

HOW-TO GUIDE: EXECUTE OS COMMAND

2.3.2

Steps to create the BAdI entities

a) With transaction se19, create a new Enhancement Implementation, e.g.


Z_ALERT_REACTION_IMPL based on the existing Enhacement Spot ALERT_REACTION:

10

HOW-TO GUIDE: EXECUTE OS COMMAND

Here is the detailed view of the newly created BAdI Implementation:

11

HOW-TO GUIDE: EXECUTE OS COMMAND

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

HOW-TO GUIDE: EXECUTE OS COMMAND

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

User Interface SP07 and upper

http://<SolutionManagerHost>:<port>/sap/bc/webdynpro/sap/mai_os_command_config

13

HOW-TO GUIDE: EXECUTE OS COMMAND

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.

It is mandatory to create those 2 configurations to react differently:


- Reacting on Alert Change Configuration <BAdI_FilterValue>_REACT
- Reacting on Alert Closure Configuration <BAdI_FilterValue>_REACT_CLOSE

14

HOW-TO GUIDE: EXECUTE OS COMMAND

3.1.1

OS Command Options

2 mandatory options are already pre-filled:


00;COMMAND_NAME
01;OP_SYSTEM

The values must reflect the SM49 External OS Command Configuration.

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

HOW-TO GUIDE: EXECUTE OS COMMAND

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

Option values can remain empty.


You can freely add new options. For example:
00;COMMAND_NAME
01;OP_SYSTEM
02;-v
03;-d
04;-DIR

SM49_CMD
ANYOS
true
/cfg/mydir/

Will create the following OS Command call:


<SM49_CMD_ConfiguredCommand> -v -d true -DIR /cfg/mydir/

16

HOW-TO GUIDE: EXECUTE OS COMMAND

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

HOW-TO GUIDE: EXECUTE OS COMMAND

3.2

User Interface SP06

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

HOW-TO GUIDE: EXECUTE OS COMMAND

MAI CONFIGURATION TO REACT TO ALERTS

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

Enabling the Third-Party Component at Global Level

Call transaction solman_setup


Select Technical Monitoring > System Monitoring
Select Step 2: Configure Infrastructure > Step 2.4: Default Settings
Select Third-Party Components tab
Add Entry: <OS Command BAdI Description> with scope = All Alerts
Check Third-Party Components
Save
Jump to Step 5: Define Scope
Select the Managed Object to configure
Jump to Step 6: Setup Monitoring
Eventually assign the template and always press Apply and Activate

19

HOW-TO GUIDE: EXECUTE OS COMMAND

4.2

Enabling the Third-Party Component at Template Level

Call transaction solman_setup


Select Technical Monitoring > System Monitoring
Select Step 4: Template Maintenance
Select the Template and switch to Expert Mode
Select the Tab Third-Party Components
Set Dropdown to active and add Entry: <OS Command BAdI Description> with scope = All Alerts
Save
Jump to Step 5: Define Scope
Select the Managed Object to configure
Jump to Step 6: Setup Monitoring
Eventually assign the template and always press Apply and Activate

4.3

Enabling the Third-Party Component at Alert Level

Call transaction solman_setup


Select Technical Monitoring > System Monitoring
Select Step 4: Template Maintenance
Select the Template and switch to Expert Mode
Select the Tab Alerts
Select the specific alert you want to configure and go to the Tab Third-Party Components
Set Dropdown to active and add Entry: <OS Command BAdI Description> with scope = All Alerts
Save
Jump to Step 5: Define Scope
Select the Managed Object to configure
Jump to Step 6: Setup Monitoring
Eventually assign the template and always press Apply and Activate

20

HOW-TO GUIDE: EXECUTE OS COMMAND

TROUBLESHOOTING

Logs are available using the standard 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 ExternalID :

21

www.sap.com

2012 SAP AG. All rights reserved.


SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign,
SAP BusinessObjects Explorer, StreamWork, SAP HANA, and other
SAP products and services mentioned herein as well as their
respective logos are trademarks or registered trademarks of SAP AG
in Germany and other countries.
Business Objects and the Business Objects logo, BusinessObjects,
Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and
other Business Objects products and services mentioned herein as
well as their respective logos are trademarks or registered trademarks
of Business Objects Software Ltd. Business Objects is an SAP
company.
Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL
Anywhere, and other Sybase products and services mentioned herein
as well as their respective logos are trademarks or registered
trademarks of Sybase, Inc. Sybase is an SAP company.
All other product and service names mentioned are the trademarks of
their respective companies. Data contained in this document serves
informational purposes only. National product specifications may vary.
These materials are subject to change without notice. These materials
are provided by SAP AG and its affiliated companies ("SAP Group")
for informational purposes only, without representation or warranty of
any kind, and SAP Group shall not be liable for errors or omissions
with respect to the materials. The only warranties for SAP Group
products and services are those that are set forth in the express
warranty statements accompanying such products and services, if
any. Nothing herein should be construed as constituting an additional
warranty.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy