# SAP # Introduction The purpose of this document is to describe the monitoring of SAP systems with Pandora FMS through Discovery. The **pandora\_sap\_deset** plugin as a wrapper of the **Deset\_SAP\_Plugin** plugin for its use in Discovery, allows to monitor SAP systems and servers remotely without the need to install anything in the equipments that host SAP, using RFC (Remote Function Call) functions. # Prerrequisites - **Dependencies** The **lib** folder that should contain files **Deset\_SAP\_Plugin.jar, libsapjco3.so, sapjco3.jar and the jre folder** (java runtime environment), should be in the same path where the plugin is executed. This folder is attached with the plugin in the package that can be downloaded from the Pandora FMS library. - **Connectivity** Since the monitoring is done from outside the SAP system, it is necessary to ensure the communication with it. Making use of the RFC functions, the connectivity is done from the equipment that executes the plugin (for example, the Pandora FMS server) and the gateway of the SAP system through the port **33XX TCP**, being **XX** the number of the SAP system to which it is connected (by default the 3300 TCP). Therefore the range of possible connection ports will go from 3300 to 3399. - **User** In order to be able to execute the RFC functions of the SAP system it will be necessary to have a user and password. This user must be of type "B-System" (System) in SAP ECC or S/4HANA versions, or of type "C-Communication / CPI-C/RFC" in earlier SAP versions. It is recommended that the user is of type "B-System" whenever possible because for this type of users their passwords do not expire, which in the case of happening would force to change them also in the configuration of the plugin in Pandora FMS. For the creation of the user in the SAP system, it will be necessary to have the following authorization objects: - - Authorization Object "**S\_RFC**": - Field "**ACTVT**" with value "**16 Execute**". - Field "**RFC\_TYPE**" with value "**X FUGR**". - **"RFC\_NAME**" field with values "**I\***", "**R\***", "**S\***", "**O\***", "**T\***". - Authorization object "**S\_TABU\_DIS**": - Field "**ACTVT**": value "**03 Display**". - Field "**DICBERCLS**": value "**\***". - Authorization object "**S\_XMI\_LOG**": - All its fields with values "**\***". - Authorization object "**S\_XMI\_PROD**": - All its fields with values "**\***". - Authorization object "**S\_TCODE**": - "**TCD**" field with value "**SM50**". - Authorization Object "**S\_TABU\_RFC**": - - Field "**ACTVT**": value "**03 Display**" - **License** Deset\_SAP\_Plugin is exclusive for Pandora FMS Enterprise customers that have contracted it. Therefore it is necessary to have a valid license key to run the plugin. To obtain a valid license, please contact Pandora FMS team at: [https://pandorafms.com/es/](https://pandorafms.com/es/) # Parameters and configuration **Parámeters**
--confPath to the configuration file
--custom\_modulesPath to the file in which the custom modules are to be defined
**Configuration file (--conf)** The contents of the file will be as follows: ``` agents_group_id = < ID of the group in which the task agent will be created > threads = < Number of threads to be used for module creation > interval = < Agent monitoring interval in seconds > server = < SAP server IP > client = < SAP client number > system = < SAP system number > license = < License code > credentials = < Base 64 of the JSON with credentials > agent = < Target agent name > modules = < JSON list of predefined modules to be monitored > ``` Example ``` agents_group_id = 10 threads = 5 interval = 300 server = 192.168.80.191 client = 001 system = 00 license = 022220743456700424 credentials = asJ1c2VyIjoiGBTREjUiLCJwYXNzd29yZCI6IklOKJNJQUwifQ== agent = SAP_R3 modules = [192,195] ``` Credentials The credentials to be entered in the "credentials" option of the configuration file described above are a code base 64 of a JSON with the following format: ``` {"user":"< user >","password":"< password >"} ``` JSON example ``` {"user":"SAP_USER","password":"JhGBf76@db!"} ``` This JSON should be converted to base 64 and the result would be a string like the following, which is what should be entered in the "credentials" option of the : ``` eyJ1c2VyIjoiU0FQX1VTRVIiLCJwYXNzd29yZCI6IkpoR0JmNzZAZGIhIn0= ``` **List of customized modules (--custom\_modules)** The content of the file will be a list of modules, separating the creation of each one in different lines. This format must be used for the creation of these modules: ``` < Module name >;< Module type >;< SAP module creation parameters > ``` Example ``` SAP info;generic_data_string;-m 120 SAP Mem Max;generic_data;-m 101 SAP Login users;generic_data_string;-m 103 ```

The list of available modules and the parameters to be used for each one is defined in the attached documentation of the SAP plugin located in the Pandora FMS library, available at the following link : [https://pandorafms.com/library/sap-r3-monitoring-agent/](https://pandorafms.com/library/sap-r3-monitoring-agent/)

# Manual execution The format of the plugin execution is as follows: ```shell ./pandora_sap_deset \ --conf < path to the configuration file > \ [ --custom_modules < path to the file containing the list of custom modules to monitor > ] ``` Example ```shell ./pandora_sap_deset \ --conf /usr/share/pandora_server/util/plugin/sap.conf \ --custom_modules /usr/share/pandora_server/util/plugin/sap_custom_modules.conf ``` # Discovery This plugin can be integrated with Pandora FMS Discovery. To do so, you must load the ".disco" package that you can download from the Pandora FMS library: [https://pandorafms.com/library/](https://pandorafms.com/library/) [![image-1687944659047.png](https://pandorafms.com/guides/public/uploads/images/gallery/2023-06/scaled-1680-/image-1687944659047.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2023-06/image-1687944659047.png) Once loaded, SAP environments can be monitored by creating Discovery tasks from the Management > Discovery > Applications section. [![image-1687944773252.png](https://pandorafms.com/guides/public/uploads/images/gallery/2023-06/scaled-1680-/image-1687944773252.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2023-06/image-1687944773252.png) The following minimum data will be requested for each task: - **SAP Hostname**:IP or FQDN of the SAP environment to monitor. - **SAP Client**: SAP client/commander to monitor. - **SAP System Number**: Number of the SAP system to monitor. - **SAP License:** License provided by Pandora FMS to use the plugin. If you do not have a license, you can use the trial mode using the "trial" value. - **SAP Credentials**: SAP credentials to connect to the environment to monitor. These credentials will be created in the Pandora FMS console credentials store. [![image-1684835243175.png](https://pandorafms.com/guides/public/uploads/images/gallery/2023-05/scaled-1680-/image-1684835243175.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2023-05/image-1684835243175.png) You can also adjust the task configuration to customize the desired monitoring: - **Max threads**: to optimize execution time, multiple threads may be configured to monitor the task modules. Keep in mind that configuring multiple threads may increase the task CPU usage. - **Target agent:** Name of the target agent in which the indicated modules will be created. If no agent name is specified, the SAP Hostname will be used instead. - **SAP modules**: From a list of predefined modules, the elements to be monitored in the SAP environment can be selected. - **Custom modules definitions**: Custom modules definition block. Each line of the block will be a module to monitor, indicating for each case name, data type and SAP plugin parameters to obtain the data. Each line must have the format: `;;` Example: `SAP info;generic_data_string;-m 120` [![image-1686146755320.png](https://pandorafms.com/guides/public/uploads/images/gallery/2023-06/scaled-1680-/image-1686146755320.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2023-06/image-1686146755320.png) Tasks that are successfully completed will have an execution summary with the following information: - **SAP Target**: Monitored SAP target environment. - **SAP Client**: Monitored SAP client/commander. - **SAP System**: Number of monitored SAP system. - **Total modules**: Total modules generated for the target SAP environment. [![image-1684835265625.png](https://pandorafms.com/guides/public/uploads/images/gallery/2023-05/scaled-1680-/image-1684835265625.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2023-05/image-1684835265625.png) Tasks that are not completed successfully will have an execution summary recording the errors that occurred. # Vista de SAP Allows you to view the general status of SAP servers: [![image-1689072476966.png](https://pandorafms.com/guides/public/uploads/images/gallery/2023-07/scaled-1680-/image-1689072476966.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2023-07/image-1689072476966.png) This view shows a panel with the available SAP modules of the selected SAP agent. You can select the refresh time and the interval to display in the graphs. # Módules generated by the plugin The plugin will create an agent for the target server. This agent will contain the following predefined modules (if they have been included in the "modules" option in the configuration file):
Average time of SAPGUI response102
Dialog Logged users103
SAP Idoc erroneus104
SAP IDOC OK105
SAP Dumps109
SAP List lock111
SAP Cancel Jobs113
Number of Update WPs in error116
SAP Batch input erroneus121
SAP WP without active restart150
SAP WP stopped151
SAP Login OK160
SYSFAIL, delivery attempts tRFC wrong entries number192
SYSFAIL, queue qRFC INPUT, wrong entries number195
The plugin will also create a module for each custom module defined in the configuration file that is called using the --custom\_modules parameter.

The list of total available modules that can be included in the customized module monitoring is defined in the attached documentation of the SAP plugin located in the Pandora library, which can be found at the following link: [https://pandorafms.com/library/wp-content/uploads/2022/03/Guia\_instalacion\_SAP\_EN.Anexos\_v4.pdf](https://pandorafms.com/library/wp-content/uploads/2022/03/Guia_instalacion_SAP_EN.Anexos_v4.pdf)