IBM Cloud Docs
Parameter harvesting, troubleshooting, and maintenance

Parameter harvesting, troubleshooting, and maintenance

Use the following information for SAP parameter determination, troubleshooting, and maintenance.

Determining SAP parameters

Use the following commands to determine SAP parameters on your SAP HANA database and SAP application servers.

List the sapstartsrv services and operating system user of the processes

As a user root, use the following command to list the sapstartsrv services and the operating system user.

ps aux|grep sapstartsrv

List details such as SID, Nr, Instance, SAPLOCALHOST, Version, DIR_EXECUTABLE

As a root user, use the following command to list SAP HANA database and SAP application server details.

/usr/sap/hostctrl/exe/lssap

Log in as an SAP administrator

Use the following command to log in as an SAP administrator.

su - <SID>adm

List HTTP/HTTPS ports of an SAP instance

As an SAP administrator, use the following command to list the HTTP/HTTPS ports of an SAP instance.

sapcontrol -nr <instance_nr> -function GetSystemInstanceList

The following details are displayed: hostname, instanceNr, httpPort, httpsPort, startPriority, features, and dispstatus.

Determine the SQL ports of the SAP SYSTEMDB and TenantDB

As an SAP administrator, use the following commands to determine the SQL ports of the SAP SYSTEMDB and TenantDB.

hdbsql -i <instance_nr> -d SYSTEMDB -u SYSTEM -p <sap_hana_sql_systemdb_password>

SELECT * FROM SYS_DATABASES.M_SERVICES

The following details are displayed: DATABASE_NAME, HOST, PORT, SERVICE_NAME, PROCESS_ID, DETAIL, ACTIVE_STATUS, SQL_PORT, COORDINATOR_TYPE, IS_DATABASE_LOCAL.

quit

Show the status of an SAP HANA database

As an SAP administrator, use the following commands to show the status of an SAP HANA database.

hdbsql -i <instance_nr> -d SYSTEMDB -u SYSTEM -p  <sap_hana_sql_systemdb_password>
SELECT * FROM SYS.M_DATABASES

The following details are displayed: DATABASE_NAME, DESCRIPTION, ACTIVE_STATUS, ACTIVE_STATUS_DETAILS, OS_USER, OS_GROUP, RESTART_MODE, FALLBACK_SNAPSHOT_CREATE_TIME.

quit

Troubleshooting missing data on the monitoring dashboards

If you don't see any metric data on the dashboard and all exporters are configured and running, the missing data might be due to one of the following reasons.

  • Network ports are not open due to firewall settings or VPC ACL settings.
  • Incorrect port numbers or credentials.

Check whether the SAP HANA database is running

To check whether the SAP HAHA database is running, log in to the SAP HANA host and run the following commands.

su - <SID>adm
HDB info
ps aux|grep -i hdb

Check a connection to an SAP HANA database with hdbsql

To check a connection to an SAP HANA database with hdbsql, run the following command as an SAP administrator.

hdbsql -i <instance_nr> -d SYSTEMDB -u SYSTEM -p <sap_hana_sql_systemdb_password>

List processes of the SAP Control instances and the sapstartsrv services

To list the processes of the SAP Control instances and the sapstartsrv services, run the following command as the root user.

ps aux|grep sapstartsrv

View listening ports of an SAP HANA host or application server

To show the listening ports of an SAP HANA host or application server, use the following command.

ss -tulpen | grep sap

Test the `hanadb_exporter' manually

To manually test the hanabd_exporter, use the following command.

hanadb_exporter -c /etc/hanadb_exporter/config-${sap_monitoring_nr}-SQL.json \
-m /etc/hanadb_exporter/metrics.json

View the status of the Prometheus daemons on the monitoring host

Use the following commands to show the status of the prometheus daemons on the monitoring host.

systemctl status prometheus@${sap_monitoring_nr}
systemctl status prometheus-hanadb_exporter@config-${sap_monitoring_nr}-SQL
systemctl status sap_host_exporter@sap_host_exporter-${sap_monitoring_nr}-HANA
systemctl status sap_host_exporter@sap_host_exporter-${sap_monitoring_nr}-ASCS
systemctl status sap_host_exporter@sap_host_exporter-${sap_monitoring_nr}-DI-01

View the status of firewalld service

To show the status of the firewalld service, use the following command.

systemctl status firewalld

Display SAP exporter metrics on the monitoring host

To show the SAP exporter metrics on the monitoring host, use the following command.

Use the variables <sap_monitoring_nr> and the last two digits (default: 01) for service "Prometheus agent" that are in Table 2.

curl http://localhost:5${sap_monitoring_nr}01/metrics

List the HTTP/HTTPS ports of each SAP instance on the SAP systems

To list the HTTPS port of each SAP instance, use the following command.

sapcontrol -nr <instance_nr> -function GetSystemInstanceList

View details about each running SAP instance on the SAP systems

sapcontrol -nr <instance_nr> -function GetProcessList

You can also debug the status of SAP HANA database and application service by using the commands that are in Determine SAP Parameters.

Remove monitoring for an SAP system

To remove monitoring for an SAP system, you must stop and remove the corresponding Prometheus exporter on the monitoring host. After you stop the exporter, the metrics will no longer be sent to the IBM Cloud® monitoring instance.

To stop the Prometheus server for an SAP system, use the following command.

sudo systemctl stop prometheus@${sap_monitoring_nr}

Remove the Prometheus server systemd configuration for an SAP system by using the following command.

sudo systemctl remove prometheus@${sap_monitoring_nr}

To delete the corresponding Prometheus configuration, use the following command.

sudo rm /etc/prometheus/${sap_monitoring_nr}.yml

To stop and remove the hanadb_exporter systemd configuration, use the following commands.

sudo systemctl stop prometheus-hanadb_exporter@config-${sap_monitoring_nr}-SQL
sudo systemctl remove prometheus-hanadb_exporter@config-${sap_monitoring_nr}-SQL

To delete the handb_exporter configuration, use the following command.

sudo rm /etc/hanadb_exporter/config-${sap_monitoring_nr}-SQL.json

To stop and remove the sap_host_exporter systemd configuration, use the following commands.

sudo systemctl stop sap_host_exporter@sap_host_exporter-${sap_monitoring_nr}-HANA
sudo systemctl remove sap_host_exporter@sap_host_exporter-${sap_monitoring_nr}-HANA
sudo systemctl stop sap_host_exporter@sap_host_exporter-${sap_monitoring_nr}-ASCS
sudo systemctl remove sap_host_exporter@sap_host_exporter-${sap_monitoring_nr}-ASCS
sudo systemctl stop sap_host_exporter@sap_host_exporter-${sap_monitoring_nr}-DI-01
sudo systemctl remove sap_host_exporter@sap_host_exporter-${sap_monitoring_nr}-DI-01
sudo systemctl stop sap_host_exporter@sap_host_exporter-${sap_monitoring_nr}-DI-02
sudo systemctl remove sap_host_exporter@sap_host_exporter-${sap_monitoring_nr}-DI-02

To delete the sap_host_exporter configurations, use the following commands.

sudo rm /etc/sap_host_exporter/sap_host_exporter-${sap_monitoring_nr}-HANA.yaml
sudo rm /etc/sap_host_exporter/sap_host_exporter-${sap_monitoring_nr}-ASCS.yaml
sudo rm /etc/sap_host_exporter/sap_host_exporter-${sap_monitoring_nr}-DI-01.yaml
sudo rm /etc/sap_host_exporter/sap_host_exporter-${sap_monitoring_nr}-DI-02.yaml

Optional changes to /etc/services

You can use the /etc/services file to map service names to port numbers on the local host. The current setup doesn't require any changes to this file, but you can add the following optional changes.

SAP_prometheus_agent_<sap_monitoring_nr> 	5<sap_monitoring_nr>01/tcp  # SAP monitoring \ prometheus agent to <sap_monitoring_nr>
SAP_prometheus_agent_<sap_monitoring_nr>	5<sap_monitoring_nr>01/udp  # SAP monitoring \ prometheus agent to <sap_monitoring_nr>
SAP_hanadb_exporter_<sap_monitoring_nr>   5<sap_monitoring_nr>02/tcp  # SAP monitoring \ hanadb_exporter to <sap_monitoring_nr>
SAP_hanadb_exporter_<sap_monitoring_nr>  5<sap_monitoring_nr>02/udp  # SAP monitoring \ hanadb_exporter to <sap_monitoring_nr>
SAP_sap_host_exporter_HANA_<sap_monitoring_nr>   5<sap_monitoring_nr>03/tcp  # SAP monitoring \ sap_host_exporter HANA to <sap_monitoring_nr>
SAP_sap_host_exporter_HANA_<sap_monitoring_nr>   5<sap_monitoring_nr>03/udp  # SAP monitoring \ sap_host_exporter HANA to <sap_monitoring_nr>
SAP_sap_host_exporter_ASCS_<sap_monitoring_nr>   5<sap_monitoring_nr>04/tcp  # SAP monitoring \ sap_host_exporter ASCS to <sap_monitoring_nr>
SAP_sap_host_exporter_ASCS_<sap_monitoring_nr>   5<sap_monitoring_nr>04/udp  # SAP monitoring \ sap_host_exporter ASCS to <sap_monitoring_nr>
SAP_sap_host_exporter_DI_01_<sap_monitoring_nr>  5<sap_monitoring_nr>05/tcp  # SAP monitoring \  sap_host_exporter DI 01 to <sap_monitoring_nr>
SAP_sap_host_exporter_DI_01_<sap_monitoring_nr>  5<sap_monitoring_nr>05/udp  # SAP monitoring \ \ sap_host_exporter DI 01 to <sap_monitoring_nr>
SAP_sap_host_exporter_DI_n_<sap_monitoring_nr>   5<sap_monitoring_nr>06/tcp  # SAP monitoring \ sap_host_exporter DI 02 to <sap_monitoring_nr>
SAP_sap_host_exporter_DI_n_<sap_monitoring_nr>   5<sap_monitoring_nr>06/udp  # SAP monitoring \ sap_host_exporter DI 02 to <sap_monitoring_nr>