Skip to Content

This guide is designed to walk you through the process of configuring Remote Operating System Script Monitoring within Solution Manager. The guide will show you how to perform the process for monitoring SAP Router. But it can be adapted to execute any script remotely for any application required. This is an extremely powerful metric, it provides to ability to monitor almost anything on the the OS level of a system. You are only restricted by your ability to write a script. The guide was created within Solution Manager 7.1 but the steps are basically identical within Solution Manager 7.2. The only difference will the the look and feel of the screens, the locations of each activity are exactly the same.

Create a Custom Script

1. The first step is to create a custom script that Solution Manager will execute. In this example we are creating a script that is using NIPING to check the status of SAP Router on the OS.

  • For windows the script must be .bat, Unix must be .sh
  • The script is called “saprouter_ping.sh”
  • Write the script to output specific results based on success or failure, the results are needed for the Threshold to have meaning.i. In this case the script will output a 1 if it is successful and a 0 if it fails.
  • The content of the script we are using is below.

#!/bin/bash

(niping -c 2>&1) >/dev/null

if [[ ${?} -ne 0 ]]; then

(niping -s 2>&1) >/dev/null &

fi

(niping -c -H /H/localhost/H/localhost 2>&1) >/dev/null

if [[ ${?} -eq 0 ]]; then

echo “1”

exit 0

else

echo “0”

exit 1

fi

2. Store the custom script in a new directory called “custom_scripts”. This Directory must be stored on a Host that has a Diagnostic agent installed. In this case it is on the host that SAP Router is running on.

3. We are using the directory below

  • /usr/sap/DAA/custom_scripts/

4. Make sure, that you script runs without user interaction.

5. You only can pass one line of parameters to the script.

6. The return values of the script can only be numeric or a string.

Update the Diagnostic Agent Configuration

1. Enter Transaction Solman_workcenter

2. Select Solution Manager Administration Work center

3. Select Infrastructure

4. Select Framework

5. Select Agent Framework

6. Select Agent Admin

7. Select All Agents to launch the Diagnostic Agent Administration Portal

8. Select the Application Configuration Tab

9. Under Configuration

10. Select “com.sap.smd.agent.application.remoteos”

11. Select “Application Resources”

12. Select “Commands.xml”

13. Select Scope drop down

14. Select the Host that the script exists on. DO NOT select Global, this will edit all Diagnostic agents.

15. Look for a custom commands.xml File. If one already exists, select download. If it a custom commands.xml does NOT exist then select download default.

16. Select Download the Resource

17. When Prompted Select Save to download the XML

18. Select Open Folder

19. Right Click on the Commands.xml file

20. Select Open With

21. Select Notepad

22. In the Commands.xml file Search for the words “custom Scripts”

23. This is the section that needs to be updated to give the Diagnostic agent the location of the script. We have multiple parameters that must be updated in the commands.xml file.

<CmdGroup name=”Custom scripts”” cv_ppms_id=”*”>

<Cmd key=”os.run” name=”Script” desc=”Execute scrips from a standard directory”>

<OsCmd ostype=”Windows” exec=”” path=”<Location of Custom Script>” ” param=”true” runtime=”600″/>

<OsCmd ostype=”UNIX” exec=”” path=”<Location of Custom Script>” param=”true” runtime=”600″/>

</Cmd>

</CmdGroup>

24. We need to create one line for the directory that contains custom scripts with the following parameters. Example of the line below. This must be within the Command Group Custom Scripts in screen shot above.

<OsCmd ostype=”UNIX” exec=”” path=”<Location of Custom Script>” param=”true” runtime=”600″/>

25. The “key” Parameter must be “os.run”

26. First we must ensure we use the correct “OStype” Parameter

  • 2 OS Types are Supported Windows and Linux
  • For Windows Enter “WINDOWS”
  • For Unix type systems like Linux Enter “UNIX”
  • The text is case sensitive.

27. Second we need to provide the directory of the custom script under the parameter “path”, example below.

  • Use forward slashes, not backslashes, for both MS Windows and UNIX type systems
  • Enter only the path up to the folder custom_scripts. Do not include the folder name custom_scripts. This is already known by the DAA.
  • /usr/sap/DAA/

28. The parameter “param” is used to either deactivate or activate the scripts located in the “path” Parameter.

  • Make sure the “Param” parameter is set to “True”
  • Using “False” Deactivates that parameter.

29. Do not change the “runtime” parameter

30. Below is the entire entry we are using for this example. Screen shot below.

<CmdGroup name=”Custom scripts”” cv_ppms_id=”*”>

<Cmd key=”os.run” name=”Script” desc=”Execute scrips from a standard directory”>

<OsCmd ostype=”UNIX” exec=”” path=”/usr/sap/DAA/” param=”true” runtime=”600″/>

</Cmd>

</CmdGroup>

31. Save your changes

32. Upload the “commands.xml” File for the agent that will be executing the script.

33. Make sure you have the correct DAA selected

34. Select Browse

35. Select the Commands.xml file and select open

36. Select Upload

37. Verify you see a message like in the screen shot below. Stating the resource has been updated

38. The Information line should also now say “the Resource has been customized.”

39. Restart the Diagnostic agents that have the command.xml file customized.

40. Anytime you add new scripts to the folder you must also restart the DAA.

Test the Script Execution and Results

1. Execute transaction SOLMAN_WORKCENTER

2. Select RootCause Analysis Workcenter

3. Select Host Analysis

4. Select the Host that has the script activated

5. Select OS Command Console

6. Select the Group “Custom Scripts”a. If you don’t see this group then there is an issue with the DAA configuration. The DAA cannot access the scripts or the XML was misconfigured.

7. Select the script to test under Command

8. Enter any parameters required

9. Select Send Command to execute the script

10. Look for the results you expect to see based on how the script is written.

Activate the Custom Alert to Execute the Script

In this case we are using a metric and alert that already exist in the SAP Router Template. But a custom metric can be created to execute any custom script, using the same Data Collector, “Remote OS Script”. You will also use the same Threshold type, the values will need to match the expected results based on how the script is written. The only difference will be the name of the metric and the alert.

1. Enter Transaction SOLMAN_SETUP in SAPGUI

2. Select Technical Monitoring

3. Select Template Maintenance

4. Select Edit

5. Select Expert Mode

6. Select Technical System Templates

7. Select the custom SAP Router Template

8. Select Metrics

9. Select the SAP Router OS Availability Metric

10. Delete the options under Script Option

11. Make Sure String Return Type is selected

12. Enter the script Name

13. Select the Threshold Tab

14. Select the Text Threshold Type

15. If you are using different values for your custom script, make sure you have the correct rating set for each text pattern that is expected to be output.

16. In this case 1 is good and 0 is bad so we need to setup the threshold to reflect that.

  • Select Add Entry 2 times to add 2 lines
  • Select the Operator “Contains any (case sensitive)
  • Enter text pattern 1 and 0
  • Change the rating to Green for pattern 1
  • Change the rating to red for pattern 0
  • Change the rating to grey for the star option

17. Select save to save your changes

18. Select Next to go to step 5 Define Scope

19. Select the Systems that you want to activate these alerts for.

20. Select Next

21. Select Assign Templates for the system you are activating the alert for

22. Select the custom template you created the custom metric in

23. Select Apply and activate

24. Wait for the status to be change to successful

25. Open the System monitoring Dashboard and verify that the alert is functioning properly

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply