Version 1: Install and configure Google Cloud's Agent for SAP on a Compute Engine instance

Google Cloud's Agent for SAP is required for SAP support of SAP systems running on Google Cloud, including SAP NetWeaver, SAP HANA, SAP ASE, SAP MaxDB, and others.

When you install Google Cloud's Agent for SAP on a Compute Engine instance, for SAP Host Agent metrics, the agent combines monitoring data from Cloud Monitoring and the Compute Engine APIs and provides that data to the SAP Host Agent.

If you use the following RHEL or SLES "for SAP" OS images that Google Cloud provides, then Google Cloud's Agent for SAP is packaged with the OS images:

  • RHEL: all "for SAP" images
  • SLES: SLES 15 SP4 for SAP and later versions

For information about the operating systems supported by Google Cloud's Agent for SAP, see Supported operating systems.

To install and configure version 1 of Google Cloud's Agent for SAP on a Bare Metal Solution server, see Install Google Cloud's Agent for SAP on a Bare Metal Solution server.

Installation overview

On Linux, you install Google Cloud's Agent for SAP by using standard operating system package management commands: on RHEL, the yum command; on SLES, the zypper command. The package management command completes the following tasks:

  • Downloads Google Cloud's Agent for SAP.
  • Creates the agent as a Linux systemd service, named google-cloud-sap-agent.
  • Enables and starts the service, google-cloud-sap-agent.

On Windows, you install Google Cloud's Agent for SAP by using the GooGet package management command, googet. The package management command completes the following tasks:

  • Downloads Google Cloud's Agent for SAP.
  • Creates a Windows service named google-cloud-sap-agent and a scheduled task that runs every minute to check if the service is still running and, if necessary, restart it.

Prerequisites for the agent

Before you install Google Cloud's Agent for SAP, you need to ensure that the following prerequisites are met.

Set the required IAM roles

At a minimum, the service account that Google Cloud's Agent for SAP uses must include the Compute Viewer (roles/compute.viewer), Monitoring Viewer (roles/monitoring.viewer), and Workload Manager Insights Writer (roles/workloadmanager.insightWriter) roles.

To add a required role to your service account, follow these steps:

  1. In the Google Cloud console, go to the IAM page.

    Go to IAM

  2. Select your Google Cloud project.

  3. Identify the service account to which you want to add a role.

    • If the service account isn't already on the principals list, then it doesn't have any roles assigned to it. Click Add and enter the email address of the service account.
    • If the service account is already on the principals list, then it has existing roles. Click the Edit button for the service account that you want to edit.
  4. Select the required role from the list of available roles:

    • Compute Engine > Compute Viewer
    • Monitoring > Monitoring Viewer
    • Workload Manager > Workload Manager Insights Writer
  5. Click Add or Save to apply the roles to the service account.

Enable access to Google Cloud APIs

Compute Engine recommends configuring your compute instances to allow all access scopes to all Cloud APIs and using only the IAM permissions of the instance service account to control access to Google Cloud resources. For more information, see Create a VM that uses a user-managed service account.

If you do limit access to the Cloud APIs, then Google Cloud's Agent for SAP requires the following minimum Cloud API access scopes on the host Compute Engine instance:

  • Cloud Platform: Enabled
  • Compute Engine: Read Only
  • Stackdriver Monitoring API: Read Only

If you are running SAP applications on a compute instance that does not have an external IP address, then you need to enable Private Google Access on the subnet of the compute instance so that Google Cloud's Agent for SAP can access Google APIs and services. To enable Private Google Access on a subnet, see Configuring Private Google Access.

Install the agent

We recommend that you install the latest version of Google Cloud's Agent for SAP, which supports more features. For instructions, see Install and configure Google Cloud's Agent for SAP on a Compute Engine instance.

To install version 1 of Google Cloud's Agent for SAP, contact Cloud Customer Care.

After you install Google Cloud's Agent for SAP and the SAP Host Agent, validate the installation of Google Cloud's Agent for SAP, as described in Validate your installation of the agent.

Validate your installation of the agent

To verify that the agent is running, select your operating system, and then follow the steps:

Linux

  1. Establish an SSH connection with your Compute Engine instance.

  2. Run the following command:

    systemctl status google-cloud-sap-agent

    If the agent is functioning properly, then the output contains active (running). For example:

    google-cloud-sap-agent.service - Google Cloud Agent for SAP
    Loaded: loaded (/usr/lib/systemd/system/google-cloud-sap-agent.service; enabled; vendor preset: disabled)
    Active:  active (running)  since Fri 2022-12-02 07:21:42 UTC; 4 days ago
    Main PID: 1337673 (google-cloud-sa)
    Tasks: 9 (limit: 100427)
    Memory: 22.4 M (max: 1.0G limit: 1.0G)
    CGroup: /system.slice/google-cloud-sap-agent.service
           └─1337673 /usr/bin/google-cloud-sap-agent
    

Windows

  1. Use RDP to connect to the Compute Engine instance.

  2. As an administrator, run the following command from PowerShell:

    $(Get-Service -Name 'google-cloud-sap-agent' -ErrorAction Ignore).Status
    If the agent is running, then the status shows Running.

If the agent isn't running, then restart the agent.

Verify that SAP Host Agent is receiving metrics

To verify that the infrastructure metrics are collected by Google Cloud's Agent for SAP and sent correctly to the SAP Host Agent, follow these steps:

  1. In your SAP system, enter transaction ST06.
  2. In the overview pane, check the availability and content of the following fields for the correct end-to-end setup of the SAP and Google monitoring infrastructure:

    • Cloud Provider: Google Cloud Platform
    • Enhanced Monitoring Access: TRUE
    • Enhanced Monitoring Details: ACTIVE

Configure Google Cloud's Agent for SAP on Linux

After you install Google Cloud's Agent for SAP, optionally, you can configure the agent to enable collection of Process Monitoring metrics and Workload Manager evaluation metrics. By default, the collection of only the SAP Host Agent metrics is enabled.

Process Monitoring metrics and Workload Manager evaluation metrics collection is supported only on Linux.

If you enable the Process Monitoring metrics and Workload Manager evaluation metrics collection, then the service account of the host compute instance must include the IAM Monitoring Metric Writer (roles/monitoring.metricWriter) role.

If you use Secret Manager for storing SAP HANA database password, then make sure that the service account of the host compute instance has the IAM Secret Manager Secret Accessor (roles/secretmanager.secretAccessor) role.

The access scopes of the host compute instance must have the write access to publish metric data to your Google Cloud projects. When you create a new Compute Engine compute instance, it is automatically configured with the write access scope, https://www.googleapis.com/auth/monitoring.write.

Set the required IAM roles

To add a required role to your service account, follow these steps:

  1. In the Google Cloud console, go to the IAM page.

    Go to IAM

  2. Select your Google Cloud project.

  3. Identify the service account to which you want to add a role.

    • If the service account isn't already on the principals list, then it doesn't have any roles assigned to it. Click Add and enter the email address of the service account.
    • If the service account is already on the principals list, then it has existing roles. Click the Edit button for the service account that you want to edit.
  4. Select the required role from the list of available roles:

    • Monitoring > Monitoring Metric Writer
    • Secret Manager > Secret Manager Secret Accessor
  5. Click Add or Save to apply the roles to the service account.

Enable Process Monitoring metrics and Workload Manager evaluation metrics collection

To enable the Process Monitoring metrics and Workload Manager evaluation metrics collection, follow these steps:

  1. Establish an SSH connection with your host compute instance.
  2. Open the following configuration file:

    /etc/google-cloud-sap-agent/configuration.json
  3. In the collection_configuration section, set the following parameters to true:

    • collect_process_metrics: enables the agent to collect Process Monitoring metrics. For SAP HANA database metrics collection, to access and query the SAP HANA database, you need to set up additional parameters in the hana_metrics_config section.
    • collect_workload_validation_metrics: enables the agent to collect Workload Manager evaluation metrics.

    For more information about the parameters, see the following table.

  4. Optionally, under cloud_properties, you can update the parameters values that are set automatically. To do so, add the cloud_properties section to your configuration file, and then specify the required parameters and their values.

  5. Save the configuration file.

  6. Restart the agent for the new settings to take effect.

    sudo systemctl restart google-cloud-sap-agent

Configuration parameters

The following table explains the configuration parameters of version 1 of Google Cloud's Agent for SAP.

Parameters
provide_sap_host_agent_metrics

Boolean

To enable the collection of the metrics required by the SAP Host Agent, specify true. Default is true.
Don't set provide_sap_host_agent_metrics to false unless you are directed by Cloud Customer Care or SAP Support.

bare_metal

Boolean

When the agent is installed on a Bare Metal Solution server, specify true. Default is false.

log_level

String

To set the logging level of the agent, set the required value. The available log levels are as follows:

  • DEBUG
  • INFO
  • WARNING
  • ERROR

Default is INFO. Don't change the logging level unless you are directed by Cloud Customer Care.

log_to_cloud

Boolean

To redirect the agent's logs to Cloud Logging, specify true. The default is true.

cloud_properties.project_id

String

If your SAP system is running on a Bare Metal Solution server, then specify the project ID of the Google Cloud project that you are using with Bare Metal Solution.

When the agent runs on a Compute Engine instance, by default, the agent detects the project ID automatically.

cloud_properties.instance_name

String

Specify the name of your Compute Engine instance. The agent automatically detects this upon installation.

cloud_properties.region

String

If your SAP system is running on a Bare Metal Solution server, then specify the region of the Bare Metal Solution server.

When the agent runs on a compute instance, by default, the agent uses the region where the compute instance is deployed.

cloud_properties.zone

String

When the agent runs on a compute instance, by default, the agent uses the zone where the compute instance is deployed.

cloud_properties.image

String

Specify the OS image name of the instance.

When the agent runs on a compute instance, by default, the agent automatically detects the OS image used by the compute instance.

cloud_properties.numeric_project_id

String

Specify the numeric ID of the Google Cloud project where the SAP system is running.

When the agent runs on a compute instance, by default, the agent automatically detects project number.

collection_configuration.collect_process_metrics

Boolean

To enable Process Monitoring metrics collection, specify true. Default is false.
This parameter is applicable only for Linux.

If you enable Process metrics collection for SAP HANA, then you need to set up additional parameters listed under hana_metrics_config.

collection_configuration.process_metrics_frequency

Int

Specify the collection frequency of the Process Monitoring metrics, in seconds. The default value for this parameter is 5 seconds.

Although you can update the collection frequency of the Process Monitoring metrics, we recommend that you use the default value. If you need to modify the default value, then add the process_metrics_frequency parameter under the collection_configuration section and provide the required value.

collection_configuration.hana_metrics_config.hana_db_user

String

Specify the database user account that the agent uses to query SAP HANA. Default is SYSTEM.

collection_configuration.hana_metrics_config.hana_db_password

String

Specify the plain text password for the database user account that the agent uses to query SAP HANA.

Instead of specifying a plain text password, we recommend that you use one of the following options:

  • hana_db_password_secret_name, for which you specify a secret stored in Secret Manager.
collection_configuration.hana_metrics_config.hana_db_password_secret_name

String

To securely provide the password for the database user account that the agent uses to query SAP HANA, specify the name of the secret that contains the security credentials for the database user account.

The agent collects the SAP HANA related metrics only when you specify either hana_db_password_secret_name or hana_db_password.

collection_configuration.hana_metrics_config.sid

String

Specify the SID of your SAP HANA instance.

collection_configuration.collect_workload_validation_metrics

Boolean

To enable Workload Manager evaluation metrics collection, specify true. From version 3.2, the default value is true.
This parameter is applicable only for Linux.

collection_configuration.workload_validation_metrics_frequency

Int

The collection frequency of the Workload Manager evaluation metrics in seconds. The default value is 300 seconds.

If you need to modify the collection frequency of the Workload Manager metrics, then add the workload_validation_metrics_frequency parameter under the collection_configuration section and provide the required value.

collection_configuration.workload_validation_db_metrics_config.hana_db_user

String

Specify the user account that is used to query the SAP HANA instance. The user account must have the read permission to the SAP HANA database.

collection_configuration.workload_validation_db_metrics_config.hana_db_password

String

Specify the password for the user account that is used to query the SAP HANA instance.

collection_configuration.workload_validation_db_metrics_config.hana_db_password_secret_name

String

Specify the name of the secret in Secret Manager that stores the user account's password.

collection_configuration.workload_validation_db_metrics_config.sid

String

Specify the SID of your SAP HANA instance.

collection_configuration.workload_validation_db_metrics_config.hostname

String

Specify the identifier for the machine, either local or remote, that hosts your SAP HANA instance. The following are the supported values:

  • If the host is a local machine, then specify the string localhost or the localhost loopback IP address, like 127.0.0.1.
  • If the host is a remote machine, then specify its internal or external IP address.
collection_configuration.workload_validation_db_metrics_config.port

String

Specify the port on which your SAP HANA instance accepts queries. For the first or only tenant database instance, the port is 3NN15, where NN is the instance number of the SAP HANA instance.

collection_configuration.workload_validation_db_metrics_frequency

Int

The collection frequency of the SAP HANA database metrics, in seconds, for Workload Manager evaluation. Default is 3600 seconds.

Although you can update the collection frequency of the SAP HANA database metrics, we recommend that you use the default value. If you need to modify the default value, then add the workload_validation_db_metrics_frequency parameter under the collection_configuration section and provide the required value. Make sure that you don't set a collection frequency greater than 3600 seconds.

Default configuration

{
  "provide_sap_host_agent_metrics": true,
  "log_level": "INFO",
  "log_to_cloud": true,
  "collection_configuration": {
    "collect_workload_validation_metrics": false,
    "collect_process_metrics": false
  }
}

Example configuration

For installing the agent on a Compute Engine instance, all configuration parameters and values are optional. If the configuration file is not modified, then the default configuration is used. The following example shows a completed configuration file for installing the agent on a compute instance.

{
  "provide_sap_host_agent_metrics": true,
  "bare_metal": false,
  "log_level": "INFO",
  "log_to_cloud": true,
  "collection_configuration": {
    "collect_workload_validation_metrics": false,
    "collect_process_metrics": true,
    "hana_metrics_config": {
      "hana_db_user": "user",
      "hana_db_password_secret_name": "secret-name"
      }
    }
}

View the collected metrics

To visualize the Process Monitoring metrics that the agent collects, you can use the following custom dashboards that Google Cloud provides:

  • Agent for SAP - HANA Overview: This dashboard provides charts that display status overview for the following metrics: SAP HANA Availability, SAP HANA HA Availability, SAP HANA HA Replication, SAP HANA Service Status, HA Cluster - Node State, and HA Cluster - Resource State for SAP Instances.

    The JSON file for this dashboard is sap-agent-status-overview.json.

  • Agent for SAP - HANA Raw Metrics: This dashboard provides charts that display raw metric values for the following metrics: SAP HANA Availability, SAP HANA HA Availability, SAP HANA HA Replication, SAP HANA Service Status, HA Cluster - Node State, and HA Cluster - Resource State for SAP Instances.

    The JSON file for this dashboard is sap-agent-raw-metrics.json.

Install dashboards

To install a custom dashboard, complete the following steps:

Google Cloud console

  1. In the Google Cloud console, go to the Monitoring page:

    Go to Monitoring

  2. In the Monitoring navigation panel, click Dashboards.

  3. Click the Sample library tab.

    Display of the sample library tab selected.

  4. To filter the agent-specific custom dashboards, in the Filter field, type Agent for SAP.

  5. (Optional) To view details about a dashboard or to preview its contents, click Preview.

  6. Select the dashboard that you want to install.

  7. Click Import, and then click Confirm.

    The dashboard is added to the available dashboards in your Google Cloud project. To see your dashboard, follow the instructions in View the installed dashboard.

Google Cloud CLI

  1. Open the Cloud Shell:

    Open Cloud Shell

  2. In the Cloud Shell, clone or download the repository:

    git clone https://github.com/GoogleCloudPlatform/monitoring-dashboard-samples/

  3. In the Cloud Shell, install the required dashboard using the corresponding JSON file:

    gcloud monitoring dashboards create --config-from-file=CONFIG_FROM_FILE

    Replace CONFIG_FROM_FILE with the path to the JSON file that contains the dashboard configuration. Dashboard configuration files can be located at path: monitoring-dashboard-samples/dashboards/google-cloud-agent-for-sap.

    The dashboard is added to the available dashboards in your Google Cloud project. To see your dashboard, follow the instructions in View the installed dashboard.

View the installed dashboards

To view the installed dashboards, follow these steps:

  1. In the Google Cloud console, go to the Monitoring page:

    Go to Monitoring

  2. In the Monitoring navigation panel, click Dashboards.

  3. Click the dashboard name in the list.

If you have a lot of dashboards, then you can filter for custom dashboards or for the name of the new dashboard. For information on filtering this list, see View custom dashboards.

The following image is an example that shows a part of the custom dashboard for SAP HANA metrics in Monitoring.

Screen capture shows the custom dashboard for SAP HANA metrics
in Monitoring

Troubleshooting

For information about diagnosing and resolving issues that you might encounter when you install and configure Google Cloud's Agent for SAP, see Google Cloud's Agent for SAP troubleshooting guide.

Get support

If you need help resolving problems with Google Cloud's Agent for SAP, then collect all available diagnostic information and contact Cloud Customer Care. For information about contacting Customer Care, see Getting support for SAP on Google Cloud.