Menu
Grafana Cloud

SAP HANA® integration for Grafana Cloud

SAP HANA is an enterprise in-memory database designed to process large volumes of data in real time. This integration for Grafana Cloud allows users to collect metrics and trace logs for monitoring an SAP HANA system.

Metrics include CPU usage by core, disk and memory usage, network and disk throughput, average query execution time, connections, alerts, replica status and ship delay. Visualizations for the system and for individual hosts are included.

This integration supports SAP HANA 2.0 SPS06+
This integration supports the SUSE/hanadb_exporter 0.8.0+

SAP HANA is the trademark or registered trademark of SAP SE or its affiliates in Germany and in other countries.

This integration includes 8 useful alerts and 2 pre-built dashboards to help monitor and visualize SAP HANA® metrics and logs.

Before you begin

In order for the integration to work properly, you must set up the SUSE hanadb exporter on your primary host.

Using the example config, metrics will be available on port 9668 by default.

Once deployed, Grafana Alloy will be able to scrape the endpoint.

Install SAP HANA® integration for Grafana Cloud

  1. In your Grafana Cloud stack, click Connections in the left-hand menu.
  2. Find SAP HANA® and click its tile to open the integration.
  3. Review the prerequisites in the Configuration Details tab and set up Grafana Agent to send SAP HANA® metrics and logs to your Grafana Cloud instance.
  4. Click Install to add this integration’s pre-built dashboards and alerts to your Grafana Cloud instance, and you can start monitoring your SAP HANA® setup.

Configuration snippets for Grafana Alloy

Simple mode

These snippets are configured to scrape a single SAP HANA® instance running locally with default ports.

First, manually copy and append the following snippets into your alloy configuration file.

Metrics snippets

alloy
discovery.relabel "metrics_integrations_integrations_sap_hana" {
	targets = [{
		__address__ = "localhost:9668",
	}]

	rule {
		target_label = "instance"
		replacement  = constants.hostname
	}
}

prometheus.scrape "metrics_integrations_integrations_sap_hana" {
	targets      = discovery.relabel.metrics_integrations_integrations_sap_hana.output
	forward_to   = [prometheus.remote_write.metrics_service.receiver]
	job_name     = "integrations/sap-hana"
	metrics_path = "/"
}

Logs snippets

linux

alloy
local.file_match "logs_integrations_integrations_sap_hana" {
	path_targets = [{
		__address__ = "localhost",
		__path__    = "/opt/hana/shared/*/HDB*/*/trace/*.trc",
		instance    = constants.hostname,
	}]
}

loki.source.file "logs_integrations_integrations_sap_hana" {
	targets    = local.file_match.logs_integrations_integrations_sap_hana.targets
	forward_to = [loki.write.grafana_cloud_loki.receiver]
}

Advanced mode

The following snippets provide examples to guide you through the configuration process.

To instruct Grafana Alloy to scrape your SAP HANA® instances, manually copy and append the snippets to your alloy configuration file, then follow subsequent instructions.

Advanced metrics snippets

alloy
discovery.relabel "metrics_integrations_integrations_sap_hana" {
	targets = [{
		__address__ = "localhost:9668",
	}]

	rule {
		target_label = "instance"
		replacement  = constants.hostname
	}
}

prometheus.scrape "metrics_integrations_integrations_sap_hana" {
	targets      = discovery.relabel.metrics_integrations_integrations_sap_hana.output
	forward_to   = [prometheus.remote_write.metrics_service.receiver]
	job_name     = "integrations/sap-hana"
	metrics_path = "/"
}

To monitor your SAP HANA® instance, you must use a discovery.relabel component to discover your SAP HANA® Prometheus endpoint and apply appropriate labels, followed by a prometheus.scrape component to scrape it.

Configure the following properties within each discovery.relabel component:

  • __address__: The address to your SAP HANA® Prometheus metrics endpoint.
  • instance label: constants.hostname sets the instance label to your Grafana Alloy server hostname. If that is not suitable, change it to a value uniquely identifies this SAP HANA® instance. Make sure this label value is the same for all telemetry data collected for this instance.

If you have multiple SAP HANA® servers to scrape, configure one discovery.relabel for each and scrape them by including each under targets within the prometheus.scrape component.

Advanced logs snippets

linux

alloy
local.file_match "logs_integrations_integrations_sap_hana" {
	path_targets = [{
		__address__ = "localhost",
		__path__    = "/opt/hana/shared/*/HDB*/*/trace/*.trc",
		instance    = constants.hostname,
	}]
}

loki.source.file "logs_integrations_integrations_sap_hana" {
	targets    = local.file_match.logs_integrations_integrations_sap_hana.targets
	forward_to = [loki.write.grafana_cloud_loki.receiver]
}

To monitor your SAP HANA® instance logs, you will use a combination of the following components:

  • local.file_match defines where to find the log file to be scraped. Change the following properties according to your environment:

    • __address__: The SAP HANA® instance address
    • __path__: Select which trace files you would like to include with a path like .../trace/{filename.trc, nameserver*.trc, ...}. You can also set __path_exclude__ patterns.
    • instance label: constants.hostname sets the instance label to your Grafana Alloy server hostname. If that is not suitable, change it to a value uniquely identifies this SAP HANA® instance. Make sure this label value is the same for all telemetry data collected for this instance.
  • loki.source.file sends logs to Loki.

On linux, you must add the alloy user to the sapsys group with sudo usermod -a -G sapsys alloy

Verify that the /opt/hana/shared/<sid>/HDB<insnr> directory has read permission for the sapsys group (with ls -la, or set with chmod g+r HDB<insnr>)

Ensure that the path from that directory to each trace log you are monitoring also has read permission set for the sapsys group

If you have issues with setting permissions, contact your system administrator or run the Grafana Agent as the root user.

Grafana Agent static configuration (deprecated)

The following section shows configuration for running Grafana Agent in static mode which is deprecated. You should use Grafana Alloy for all new deployments.

Dashboards

The SAP HANA® integration installs the following dashboards in your Grafana Cloud instance to help monitor your system.

  • SAP HANA instance overview
  • SAP HANA system overview

SAP HANA system overview (replicas)

SAP HANA system overview (replicas)

SAP HANA system overview (alerts)

SAP HANA system overview (alerts)

SAP HANA instance overview (logs)

SAP HANA instance overview (logs)

Alerts

The SAP HANA® integration includes the following useful alerts:

AlertDescription
SapHanaHighCpuUtilizationCritical: CPU utilization is high.
SapHanaHighPhysicalMemoryUsageCritical: Current physical memory usage of the host is approaching capacity.
SapHanaMemAllocLimitBelowRecommendationWarning: Memory allocation limit set below recommended limit.
SapHanaHighMemoryUsageCritical: Current SAP HANA memory usage is approaching capacity.
SapHanaHighDiskUtilizationCritical: SAP HANA disk is approaching capacity.
SapHanaHighSqlExecutionTimeCritical: SAP HANA SQL average execution time is high.
SapHanaHighReplicationShippingTimeCritical: SAP HANA system replication log shipping delay is high.
SapHanaReplicationStatusErrorCritical: SAP HANA system replication status signifies an error.

Metrics

The most important metrics provided by the SAP HANA® integration, which are used on the pre-built dashboards and Prometheus alerts, are as follows:

  • hanadb_alerts_current_rating
  • hanadb_connections_total_count
  • hanadb_cpu_busy_percent
  • hanadb_disk_io_throughput_kb_second
  • hanadb_disk_total_size_mb
  • hanadb_disk_total_used_size_mb
  • hanadb_host_memory_alloc_limit_mb
  • hanadb_host_memory_physical_total_mb
  • hanadb_host_memory_resident_mb
  • hanadb_host_memory_swap_free_mb
  • hanadb_host_memory_swap_used_mb
  • hanadb_host_memory_used_total_mb
  • hanadb_network_receive_rate_kb_per_seconds
  • hanadb_network_transmission_rate_kb_per_seconds
  • hanadb_schema_used_memory_mb
  • hanadb_sql_service_elap_per_exec_avg_ms
  • hanadb_sql_service_lock_per_exec_ms
  • hanadb_sql_top_time_consumers_mu
  • hanadb_sr_replication
  • hanadb_sr_ship_delay
  • hanadb_table_cs_top_mem_total_mb
  • up

Changelog

md
# 0.0.3 - September 2023

* New Filter Metrics option for configuring the Grafana Agent, which saves on metrics cost by dropping any metric not used by this integration. Beware that anything custom built using metrics that are not on the snippet will stop working.
* New hostname relabel option, which applies the instance name you write on the text box to the Grafana Agent configuration snippets, making it easier and less error prone to configure this mandatory label.

# 0.0.2 - August 2023

* Add regex filter for logs datasource

# 0.0.1 - June 2023

* Initial release

Cost

By connecting your SAP HANA® instance to Grafana Cloud, you might incur charges. To view information on the number of active series that your Grafana Cloud account uses for metrics included in each Cloud tier, see Active series and dpm usage and Cloud tier pricing.