---
title: SAP HANA
description: Monitor memory, network, volume, and other metrics from your SAP HANA system.
breadcrumbs: Docs > Integrations > SAP HANA
---

# SAP HANA
Supported OS Integration version5.5.0
## Overview{% #overview %}

This check monitors [SAP HANA](https://www.sap.com/products/hana.html) 2.0, SPS 2 through the Datadog Agent.

**Minimum Agent version:** 7.16.1

## Setup{% #setup %}

### Installation{% #installation %}

The SAP HANA check is included in the [Datadog Agent](https://app.datadoghq.com/account/settings/agent/latest) package. To use this integration, you need to manually install the [hdbcli](https://pypi.org/project/hdbcli/) library.

For Unix:

```text
sudo -Hu dd-agent /opt/datadog-agent/embedded/bin/pip install hdbcli==2.21.28
```

For Windows:

```text
"C:\Program Files\Datadog\Datadog Agent\embedded<PYTHON_MAJOR_VERSION>\python.exe" -m pip install hdbcli==2.21.28
```

#### Prepare HANA{% #prepare-hana %}

To query certain views, specific privileges must be granted to the chosen HANA monitoring user. For more information, see Granting privileges.

To learn how to set the port number for HANA tenant, single-tenant, and system databases, see the [Connect to SAP documentation](https://help.sap.com/viewer/0eec0d68141541d1b07893a39944924e/2.0.02/en-US/d12c86af7cb442d1b9f8520e2aba7758.html).

##### User creation{% #user-creation %}

1. Connect to the system database and run the following command to create a user:

   ```shell
   CREATE RESTRICTED USER <USER> PASSWORD <PASSWORD>;
   ```

1. Run the following command to allow the user to connect to the system:

   ```shell
   ALTER USER <USER> ENABLE CLIENT CONNECT;
   ```

1. (optional) To avoid service interruption you may want to make the password long-lived:

   ```shell
   ALTER USER <USER> DISABLE PASSWORD LIFETIME;
   ```

##### Granting privileges{% #granting-privileges %}

1. Run the following command to create a monitoring role (named `DD_MONITOR` for these examples):

   ```shell
   CREATE ROLE DD_MONITOR;
   ```

1. Run the following command to grant read-only access to all system views:

   ```shell
   GRANT CATALOG READ TO DD_MONITOR;
   ```

1. Then run the following commands to grant select privileges on each system view:

   ```shell
   GRANT SELECT ON SYS.M_DATABASE TO DD_MONITOR;
   GRANT SELECT ON SYS.M_DATABASES TO DD_MONITOR;
   GRANT SELECT ON SYS_DATABASES.M_BACKUP_PROGRESS TO DD_MONITOR;
   GRANT SELECT ON SYS_DATABASES.M_CONNECTIONS TO DD_MONITOR;
   GRANT SELECT ON SYS_DATABASES.M_DISK_USAGE TO DD_MONITOR;
   GRANT SELECT ON SYS_DATABASES.M_LICENSES TO DD_MONITOR;
   GRANT SELECT ON SYS_DATABASES.M_RS_MEMORY TO DD_MONITOR;
   GRANT SELECT ON SYS_DATABASES.M_SERVICE_COMPONENT_MEMORY TO DD_MONITOR;
   GRANT SELECT ON SYS_DATABASES.M_SERVICE_MEMORY TO DD_MONITOR;
   GRANT SELECT ON SYS_DATABASES.M_SERVICE_STATISTICS TO DD_MONITOR;
   GRANT SELECT ON SYS_DATABASES.M_VOLUME_IO_TOTAL_STATISTICS TO DD_MONITOR;
   ```

1. Finally, run the following command to assign the monitoring role to the desired user:

   ```shell
   GRANT DD_MONITOR TO <USER>;
   ```

### Configuration{% #configuration %}

1. Edit the `sap_hana.d/conf.yaml` file, in the `conf.d/` folder at the root of your Agent's configuration directory to start collecting your sap_hana performance data. See the [sample sap_hana.d/conf.yaml](https://github.com/DataDog/integrations-core/blob/master/sap_hana/datadog_checks/sap_hana/data/conf.yaml.example) for all available configuration options.

1. [Restart the Agent](https://docs.datadoghq.com/agent/guide/agent-commands.md#start-stop-restart-the-agent).

#### Log collection{% #log-collection %}

1. In your SAP HANA database, to make sure you can read audit logs, run the following command:

   ```shell
   GRANT AUDIT READ TO DD_MONITOR;
   GRANT SELECT ON SYS.AUDIT_LOG TO DD_MONITOR
   ```

1. Collecting logs is disabled by default in the Datadog Agent. Enable it in `datadog.yaml`:

   ```yaml
   logs_enabled: true
   ```

1. Add this configuration block to your `sap_hana.d/conf.yaml` file to start collecting your SAP HANA logs, adjusting the `service` value to configure them for your environment:

   ```yaml
   logs:
     - type: integration
       source: sap_hana
       service: sap_hana
   ```

See the [sample sap_hana.d/conf.yaml](https://github.com/DataDog/integrations-core/blob/master/sap_hana/datadog_checks/sap_hana/data/conf.yaml.example) for all available configuration options.

1. [Restart the Agent](https://docs.datadoghq.com/agent/guide/agent-commands.md#start-stop-restart-the-agent).

### Validation{% #validation %}

Run the [Agent's status subcommand](https://docs.datadoghq.com/agent/guide/agent-commands.md#agent-status-and-information) and look for `sap_hana` under the Checks section.

## Data Collected{% #data-collected %}

### Metrics{% #metrics %}

|  |
|  |
| **sap\_hana.backup.latest**(gauge)                                    | The time elapsed since the latest database backup was completed.*Shown as second*                                                          |
| **sap\_hana.connection.empty**(gauge)                                 | Historic connections that are removed after a period of time.*Shown as connection*                                                         |
| **sap\_hana.connection.idle**(gauge)                                  | The current number of idle connections.*Shown as connection*                                                                               |
| **sap\_hana.connection.open**(gauge)                                  | The current number of connections.*Shown as connection*                                                                                    |
| **sap\_hana.connection.queuing**(gauge)                               | The current number of queued connections.*Shown as connection*                                                                             |
| **sap\_hana.connection.running**(gauge)                               | The current number of running connections.*Shown as connection*                                                                            |
| **sap\_hana.cpu.service.utilized**(gauge)                             | The CPU utilization of services as a percentage.*Shown as percent*                                                                         |
| **sap\_hana.disk.free**(gauge)                                        | The total free size of the disk in bytes.*Shown as byte*                                                                                   |
| **sap\_hana.disk.size**(gauge)                                        | The total size of the disk in bytes.*Shown as byte*                                                                                        |
| **sap\_hana.disk.used**(gauge)                                        | The total used size of the disk in bytes.*Shown as byte*                                                                                   |
| **sap\_hana.disk.utilized**(gauge)                                    | The utilization of the disk as a percentage.*Shown as percent*                                                                             |
| **sap\_hana.file.service.open**(gauge)                                | The number of open files.*Shown as file*                                                                                                   |
| **sap\_hana.license.expiration**(gauge)                               | The time until license expiration.*Shown as second*                                                                                        |
| **sap\_hana.license.size**(gauge)                                     | The total size of the license in gibibytes.*Shown as gibibyte*                                                                             |
| **sap\_hana.license.usable**(gauge)                                   | The total usable size of the license in gibibytes.*Shown as gibibyte*                                                                      |
| **sap\_hana.license.used**(gauge)                                     | The total used size of the license in gibibytes.*Shown as gibibyte*                                                                        |
| **sap\_hana.license.utilized**(gauge)                                 | The utilization of the license as a percentage.*Shown as percent*                                                                          |
| **sap\_hana.memory.row\_store.free**(gauge)                           | The total free amount of row store memory in bytes.*Shown as byte*                                                                         |
| **sap\_hana.memory.row\_store.total**(gauge)                          | The total amount of row store memory in bytes.*Shown as byte*                                                                              |
| **sap\_hana.memory.row\_store.used**(gauge)                           | The total used amount of row store memory in bytes.*Shown as byte*                                                                         |
| **sap\_hana.memory.row\_store.utilized**(gauge)                       | The utilization of row store memory as a percentage.*Shown as percent*                                                                     |
| **sap\_hana.memory.service.compactor.free**(gauge)                    | The total free part of the service memory pool that can potentially be freed on memory shortage in bytes.*Shown as byte*                   |
| **sap\_hana.memory.service.compactor.total**(gauge)                   | The total part of the service memory pool that can potentially be freed on memory shortage in bytes.*Shown as byte*                        |
| **sap\_hana.memory.service.compactor.used**(gauge)                    | The total used part of the service memory pool that can potentially be freed on memory shortage in bytes.*Shown as byte*                   |
| **sap\_hana.memory.service.compactor.utilized**(gauge)                | The utilization of the part of the service memory pool that can potentially be freed on memory shortage as a percentage.*Shown as percent* |
| **sap\_hana.memory.service.component.used**(gauge)                    | The total used amount of memory by service components in bytes.*Shown as byte*                                                             |
| **sap\_hana.memory.service.heap.free**(gauge)                         | The total free amount of service heap memory in bytes.*Shown as byte*                                                                      |
| **sap\_hana.memory.service.heap.total**(gauge)                        | The total amount of service heap memory in bytes.*Shown as byte*                                                                           |
| **sap\_hana.memory.service.heap.used**(gauge)                         | The total used amount of service heap memory in bytes.*Shown as byte*                                                                      |
| **sap\_hana.memory.service.heap.utilized**(gauge)                     | The utilization of service heap memory as a percentage.*Shown as percent*                                                                  |
| **sap\_hana.memory.service.overall.free**(gauge)                      | The total free amount of service memory in bytes.*Shown as byte*                                                                           |
| **sap\_hana.memory.service.overall.physical.total**(gauge)            | The total amount of service physical RAM in bytes.*Shown as byte*                                                                          |
| **sap\_hana.memory.service.overall.total**(gauge)                     | The total amount of service memory in bytes.*Shown as byte*                                                                                |
| **sap\_hana.memory.service.overall.used**(gauge)                      | The total used amount of service memory in bytes.*Shown as byte*                                                                           |
| **sap\_hana.memory.service.overall.utilized**(gauge)                  | The utilization of service memory as a percentage.*Shown as percent*                                                                       |
| **sap\_hana.memory.service.overall.virtual.total**(gauge)             | The total amount of service virtual RAM in bytes.*Shown as byte*                                                                           |
| **sap\_hana.memory.service.shared.free**(gauge)                       | The total free amount of service shared memory in bytes.*Shown as byte*                                                                    |
| **sap\_hana.memory.service.shared.total**(gauge)                      | The total amount of service shared memory in bytes.*Shown as byte*                                                                         |
| **sap\_hana.memory.service.shared.used**(gauge)                       | The total used amount of service shared memory in bytes.*Shown as byte*                                                                    |
| **sap\_hana.memory.service.shared.utilized**(gauge)                   | The utilization of service shared memory as a percentage.*Shown as percent*                                                                |
| **sap\_hana.network.service.request.active**(gauge)                   | The number of active requests to services.*Shown as request*                                                                               |
| **sap\_hana.network.service.request.external.total\_finished**(count) | The number of completed external requests to services.*Shown as request*                                                                   |
| **sap\_hana.network.service.request.internal.total\_finished**(count) | The number of completed internal requests to services.*Shown as request*                                                                   |
| **sap\_hana.network.service.request.pending**(gauge)                  | The number of pending requests to services.*Shown as request*                                                                              |
| **sap\_hana.network.service.request.per\_second**(gauge)              | The average number of requests per second of services over the last 1000 requests.*Shown as request*                                       |
| **sap\_hana.network.service.request.response\_time**(gauge)           | The average request response time of services over the last 1000 requests.*Shown as millisecond*                                           |
| **sap\_hana.network.service.request.total\_finished**(count)          | The total number of completed requests to services.*Shown as request*                                                                      |
| **sap\_hana.thread.service.active**(gauge)                            | The number of active threads used by services.*Shown as thread*                                                                            |
| **sap\_hana.thread.service.inactive**(gauge)                          | The number of inactive threads used by services.*Shown as thread*                                                                          |
| **sap\_hana.thread.service.total**(gauge)                             | The number of total threads used by services.*Shown as thread*                                                                             |
| **sap\_hana.uptime**(gauge)                                           | The time elapsed since the database was started.*Shown as second*                                                                          |
| **sap\_hana.volume.io.read.count**(count)                             | The number of reads from the volume within the last interval.*Shown as read*                                                               |
| **sap\_hana.volume.io.read.size.count**(count)                        | The number of bytes read from the volume within the last interval.*Shown as byte*                                                          |
| **sap\_hana.volume.io.read.size.total**(gauge)                        | The total number of bytes read from the volume.*Shown as byte*                                                                             |
| **sap\_hana.volume.io.read.total**(gauge)                             | The total number of reads from the volume.*Shown as read*                                                                                  |
| **sap\_hana.volume.io.read.utilized**(gauge)                          | The percentage of time spent reading from the volume.*Shown as percent*                                                                    |
| **sap\_hana.volume.io.throughput**(gauge)                             | The overall throughput of a volume in bytes per second.*Shown as byte*                                                                     |
| **sap\_hana.volume.io.utilized**(gauge)                               | The percentage of time spent accessing the volume.*Shown as percent*                                                                       |
| **sap\_hana.volume.io.write.count**(count)                            | The number of writes to the volume within the last interval.*Shown as write*                                                               |
| **sap\_hana.volume.io.write.size.count**(count)                       | The number of bytes written to the volume within the last interval.*Shown as byte*                                                         |
| **sap\_hana.volume.io.write.size.total**(gauge)                       | The total number of bytes written to the volume.*Shown as byte*                                                                            |
| **sap\_hana.volume.io.write.total**(gauge)                            | The total number of writes to the volume.*Shown as write*                                                                                  |
| **sap\_hana.volume.io.write.utilized**(gauge)                         | The percentage of time spent writing to the volume.*Shown as percent*                                                                      |

### Events{% #events %}

SAP HANA does not include any events.

### Service Checks{% #service-checks %}

**sap\_hana.can\_connect**

Returns `CRITICAL` if the Agent is unable to connect to the monitored SAP HANA system, or `OK` otherwise.

*Statuses: ok, critical*

**sap\_hana.status**

Returns `OK` if the monitored SAP HANA database is up, or `CRITICAL` otherwise.

*Statuses: ok, critical*

## Troubleshooting{% #troubleshooting %}

Need help? Contact [Datadog support](https://docs.datadoghq.com/help/).
