====== ABAP Gateway monitoring ====== This monitor is dedicated to the RFC gateway of the ABAP application servers, as shown in transaction SMGW. For each instance of the system it reports the number of connections, of connected clients and of remote gateways. When the gateway statistics are active, it also reports the timeouts, the request overflows, the TCP errors and the CPIC errors that occurred since the previous run. It can also raise an alarm when the gateway of an instance cannot be read. **Note:** this monitor is about the RFC gateway (SMGW), not about the SAP Gateway OData framework (''/IWFND''). Each application server has its own gateway. The monitor opens one connection per instance and reads the local gateway of that instance. ===== Prerequisites ===== * The monitoring user needs the authorization ''S_RFC'' for the function group ''SGWY''. * The profile parameter ''gw/monitor'' must not be ''0'' on the monitored instances. The default value ''1'' is enough, because each gateway is read locally. * The timeouts, request overflows, TCP errors and CPIC errors need active gateway statistics on the instance (profile parameter ''gw/stat''). The monitor does not switch the statistics on. ===== Configuration hints ===== * Use the surveillance table to adjust the monitoring settings: * Thresholds * Severity * Filters * The gateways are read once per run and shared by all surveillance lines. Each line only filters the instances, so adding a line does not add any load on the SAP system. * A new line has the threshold ''0'' and raises no alarm until a threshold is set. The metrics are sent whatever the thresholds. * The instances are read one after the other. The default timeout of the monitor is 300 seconds. An instance is not read when less than 70 seconds remain before the timeout: it is reported as a collection failure, and the figures of the other instances are still delivered. Raise the timeout on a system with many instances or slow connections. * The RFC session of the Collector itself is included in the number of connections and of clients. ===== Global parameters ===== ^ Parameter ^ Default ^ Description ^ | Send metrics | enabled | If enabled, the metrics described below are sent to the configured plugins/integrations, one series per instance. | | Collection failure severity | ''MINOR'' | Defines the severity of the alarm raised for each instance whose gateway cannot be read, completely or partly: gateway monitoring disabled, missing authorization, instance not reachable, function module failing. \\ One alarm is raised per failing instance, independently of the surveillance table. It is cleared as soon as the instance can be read again. \\ Inactive gateway statistics are not a failure and raise no alarm. \\ ''Disabled'' turns the alarm off. | ===== Surveillance table ===== ^ Parameter ^ Description ^ | Active | Use this field to activate or deactivate a line of configuration. | | Instance | A filter to match only a given application server instance. | | Metric | The figure watched by this line: ''Connections'', ''Clients'', ''Remote gateways'', ''Timeouts'', ''Request overflows'', ''TCP errors'' or ''CPIC errors''. | | Threshold | The threshold for the figure. An alarm is sent when the figure reaches this value. Several levels can be set with the multi level syntax, such as ''G2W:10 W2M:30''. Leave at ''0'' to disable the line. | | Severity | The severity of the alarm. A line with severity ''Disabled'' raises no alarm. | | Auto clear | If checked, the alarm is cleared automatically once its condition is no longer met. | | Prefix | A custom text added to the alarm message of this line. The variable ''%MSG%'' holds the generated message: ''my_prefix %MSG% my_suffix''. | | Alarm | If checked, this line of surveillance will be used for alarm generation. | **Note:** ''Connections'', ''Clients'' and ''Remote gateways'' are the current numbers at the time of the run. ''Timeouts'', ''Request overflows'', ''TCP errors'' and ''CPIC errors'' are the increase since the previous run of the monitor, so their threshold is a number of events per run. **Note:** the **Instance** filter matches any instance name containing the text, case insensitive. ''*'' matches every instance and a leading ''!'' excludes the instances containing the text. **Note:** an instance can match several lines, and each matching line is evaluated. To alarm on one instance with a different threshold, add a line for that instance and exclude it from the general line with ''!''. **Note:** a line on ''Timeouts'', ''Request overflows'', ''TCP errors'' or ''CPIC errors'' raises no alarm for an instance whose gateway statistics are inactive, and none during the first run. ===== Error counters ===== * The gateway keeps the timeouts, request overflows, TCP errors and CPIC errors as counters that only grow. The monitor keeps the value of the previous run and reports the difference. * The first run of the monitor only records a starting point. The counters are reported from the second run on. * The starting point is kept across a restart of the Collector. * When a counter is lower than at the previous run, the gateway was restarted or its statistics were reset. Nothing is reported for that run and the new value becomes the starting point. * When the statistics of an instance are inactive, nothing is reported for its counters. Inactive statistics are never reported as zero. * A test run of the monitor from the user interface does not move the starting point. ===== Alarm content ===== * One alarm is raised per instance and line. The message contains the figure, the instance, the value and the threshold: * ''Gateway connections on sapprd_PRD_00: 480 (>= 450)'' * ''Gateway clients on sapprd_PRD_00: 130 (>= 100)'' * ''Gateway remote gateways on sapprd_PRD_00: 12 (>= 10)'' * The alarms on the error counters state that the value is the increase since the previous run: * ''Gateway timeouts on sapprd_PRD_00: 14 (>= 10) since the previous run'' * ''Gateway TCP errors on sapprd_PRD_01: 3 (>= 1) since the previous run'' * An instance that cannot be read raises its own alarm, with the cause of each failing call: * ''Gateway data collection failed on sapprd_PRD_01: Gateway monitoring is disabled on sapprd_PRD_01 (profile parameter gw/monitor)'' * ''Gateway data collection failed on sapprd_PRD_02: sapprd_PRD_02: not read because the monitor timeout is too close'' * When no instance at all can be read, the monitor run fails with the first error instead of raising one alarm per instance. A missing ''S_RFC'' authorization is then reported as an RFC authorization error. * In integrations that show the metric of an alarm, a line alarm is reported under the metric of its figure, for example ''GATEWAY_CONNECTIONS'' or ''GATEWAY_TCP_ERROR_COUNT''. The collection failure alarm carries no metric. ===== Examples ===== ==== Example 1 ==== ^ Active ^ Instance ^ Metric ^ Threshold ^ Severity ^ Auto clear ^ Prefix ^ Alarm ^ | true | * | Connections | 400 | MAJOR | true | | true | **Effect**: Sends a MAJOR alarm for each instance whose gateway holds 400 connections or more. Compare the threshold with the maximum number of connections of the gateway (profile parameter ''gw/max_conn''). ==== Example 2 ==== ^ Active ^ Instance ^ Metric ^ Threshold ^ Severity ^ Auto clear ^ Prefix ^ Alarm ^ | true | * | TCP errors | 1 | WARNING | true | | true | | true | * | CPIC errors | 1 | WARNING | true | | true | | true | * | Timeouts | 10 | MAJOR | true | | true | | true | * | Request overflows | 1 | MAJOR | true | | true | **Effect**: Sends a WARNING alarm for each instance with at least one TCP error or one CPIC error since the previous run, and a MAJOR alarm for each instance with 10 timeouts or more, or with at least one request overflow, since the previous run. The alarms are cleared on the first run without a new breach. ==== Example 3 ==== ^ Active ^ Instance ^ Metric ^ Threshold ^ Severity ^ Auto clear ^ Prefix ^ Alarm ^ | true | sapprd_PRD_00 | Connections | 800 | CRITICAL | true | | true | | true | !sapprd_PRD_00 | Connections | 400 | MAJOR | true | | true | **Effect**: The first line sends a CRITICAL alarm when the central instance holds 800 connections or more. The second line sends a MAJOR alarm for each other instance holding 400 connections or more. ===== Generated metrics ===== ^ metricId ^ metricUnit ^ metricTarget ^ metricDescription ^ | GATEWAY_CONNECTIONS | Count | [INSTANCE] | Sends the number of connections held by the gateway of the instance. | | GATEWAY_CLIENTS | Count | [INSTANCE] | Sends the number of clients connected to the gateway of the instance. | | GATEWAY_REMOTE_GATEWAYS | Count | [INSTANCE] | Sends the number of remote gateways connected to the gateway of the instance. | | GATEWAY_TIMEOUT_COUNT | Count | [INSTANCE] | Sends the number of gateway timeouts since the previous run. | | GATEWAY_OVERFLOW_COUNT | Count | [INSTANCE] | Sends the number of request overflows since the previous run. | | GATEWAY_TCP_ERROR_COUNT | Count | [INSTANCE] | Sends the number of TCP errors since the previous run. | | GATEWAY_CPIC_ERROR_COUNT | Count | [INSTANCE] | Sends the number of CPIC errors since the previous run. | **Note:** the INSTANCE target holds the name of the application server instance. **Note:** the metrics are sent for every instance, whether a surveillance line matches it or not. **Note:** an instance with no value for a metric is not sent, rather than being sent as zero. This applies to the four error counters during the first run, after a restart of the gateway, and as long as the gateway statistics of the instance are inactive. It also applies to any figure the monitor could not read. **Note:** the three numbers of connections, clients and remote gateways correspond to the SAP Cloud ALM health monitoring metrics ''hm.abap.gateway.connections'', ''hm.abap.gateway.clients'' and ''hm.abap.gateway.remote_gateway''. The gateway memory usage is not reported by this monitor.