IBM Db2 scraper
Install and configure the IBM Db2 scraper to send database metrics and query events through an OpenTelemetry Collector to Splunk Observability Cloud.
How Db2 data reaches Splunk Observability Cloud
The splunk-otel-db2 scraper is a standalone Java application. It connects to an IBM Db2 database, collects metrics and optional query events, and sends the data over OTLP/gRPC to an OpenTelemetry Collector. The Collector forwards metrics and events to Splunk Observability Cloud.
The scraper is not an OpenTelemetry Collector receiver. Run it as a JAR on a Linux host or as a container in Kubernetes. Configure a separate Collector to receive its OTLP data.
IBM Db2 scraper version
These instructions use IBM Db2 scraper (splunk-otel-db2) v0.1.10 for both deployment methods:
-
Linux/EC2 JAR: splunk-otel-db2-0.1.10.jar
-
Kubernetes Helm deployment:
splunk-otel-db2chart v0.1.10
This is the scraper version; the OpenTelemetry Collector has its own separate version.
Supported versions and prerequisites
The scraper supports IBM Db2 LUW 10.5 and later. It is tested with Db2 LUW 11.5.
- For a JAR or systemd installation, install Java 11 or later.
- For a Kubernetes installation, install Helm 3.12 or later.
- Create a Db2 monitoring account and grant the permissions listed below. The account does not need SYSADM or DBADM at runtime.
Create the monitoring account and grant permissions
Db2 uses operating system or directory authentication. Create the db2mon account with your authentication provider. Then connect to the database as an administrator and grant the following permissions to that account:
GRANT CONNECT ON DATABASE TO USER db2mon;
-- Called when the scraper opens a connection.
GRANT EXECUTE ON PROCEDURE SYSPROC.WLM_SET_CLIENT_INFO TO USER db2mon;
-- Core metrics.
GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_DATABASE TO USER db2mon;
GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_CONNECTION TO USER db2mon;
GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_BUFFERPOOL TO USER db2mon;
GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_TABLESPACE TO USER db2mon;
GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_TRANSACTION_LOG TO USER db2mon;
-- Query samples. Blocking-session detection is included when query sampling is enabled.
GRANT SELECT ON TABLE SYSIBMADM.MON_CURRENT_SQL TO USER db2mon;
GRANT SELECT ON TABLE SYSIBMADM.MON_LOCKWAITS TO USER db2mon;
-- Top queries and idle-blocker statement lookup.
GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_PKG_CACHE_STMT TO USER db2mon;
-- Optional: run only if the dedicated DB2MON schema does not already exist.
CREATE SCHEMA DB2MON AUTHORIZATION DB2MON;
-- Run as a Db2 administrator.
GRANT EXECUTE ON PROCEDURE SYSPROC.EXPLAIN_FROM_SECTION TO USER db2mon;
-- Connect to the target database as db2mon.
SET CURRENT SCHEMA DB2MON;
CALL SYSPROC.SYSINSTALLOBJECTS('EXPLAIN', 'C', NULL, CURRENT SCHEMA);
To collect the optional query wait-time attribute on Db2 10.5 and later, also grant this permission:
GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_ACTIVITY TO USER db2mon;
DATAACCESS. Grant only the listed object privileges. If Db2 returns SQLCODE=-551, ask a Db2 administrator to check the grant for the named object.
Configure the scraper
Choose the configuration for the environment where the scraper runs. The Linux JAR configuration and Helm values use different field names and file formats.
- Linux host with a JAR
-
Save this scraper configuration as
/etc/splunk-otel-db2/config.yaml. Set the database values to match your environment.Query samples and top-query events are deactivated by default. These examples activaate both. To collect query plans, create the explain tables and set
max_explain_each_intervalto a value greater than0.YAMLreceivers: db2: hostname: "<DB2_HOST>" hostport: <DB2_PORT> username: "<DB2_USER>" password: "<DB2_PASSWORD>" database: "<DB2_DATABASE>" service_instance_id: "<DB2_INSTANCE_ID>" tls: insecure: false events: db.server.query_sample: enabled: true db.server.top_query: enabled: true top_query_collection: max_explain_each_interval: 5 explain_schema: "DB2MON" exporters: otlp: endpoint: "http://127.0.0.1:4317" tls: insecure: truetls.insecurecontrols the connection between the scraper and Db2. For an encrypted Db2 connection, use the Db2 SSL listener port configured byssl_svcenameand settls.insecure: false. For a cleartext Db2 connection, use the cleartext listener port (commonly50000) and settls.insecure: true. Theotlp.tls.insecuresetting controls the separate connection from the scraper to the OpenTelemetry Collector. - Kubernetes with Helm
-
Save these scraper values in a local Helm values file. Set the database and Collector values to match your environment.
Query samples and top-query events are deactivated by default. These examples activaate both. To collect query plans, create the explain tables and set
max_explain_each_intervalto a value greater than0.YAMLreceivers: - name: "prod" hostname: "<DB2_HOST_REACHABLE_FROM_POD>" port: <DB2_PORT> database: "<DB2_DATABASE>" serviceInstanceId: "<DB2_INSTANCE_ID>" username: "<DB2_USER>" password: "<DB2_PASSWORD>" tls: insecure: false events: dbServerQuerySample: enabled: true dbServerTopQuery: enabled: true topQueryCollection: maxExplainEachInterval: 5 explainSchema: "DB2MON" otlp: endpoint: "http://<COLLECTOR_SERVICE>.<NAMESPACE>.svc.cluster.local:4317" tls: insecure: trueSet
<DB2_HOST_REACHABLE_FROM_POD>to the database address reachable from the Pod. Set the Db2tls.insecurevalue totrueonly for a cleartext Db2 listener. Theotlp.tls.insecurevalue controls the connection from the scraper to the Collector.
Keep the following scraper collection settings at their default values:
collection_interval(30s)query_sample_collection.collection_interval(10s)query_sample_collection.max_rows_per_query(100)top_query_collection.collection_interval(60s)top_query_collection.max_query_sample_count(1000)top_query_collection.top_query_count(250)
These defaults limit collection overhead and event volume. Increasing row limits can increase Db2 query work and Collector load. Changing intervals changes collection cadence and data freshness. The examples set max_explain_each_interval to 5 because its default value of 0 disables query plan enrichment.
Set service_instance_id or serviceInstanceId to a stable, unique value for each scraper. Otherwise, the scraper derives the instance identity from the Db2 host, port, and database.
Configure the OpenTelemetry Collector
Configure a Collector to receive the scraper's OTLP/gRPC data on port 4317. The Collector sends metrics to the SignalFx exporter and query events to the Splunk Observability Cloud event endpoint. Use the configuration for your deployment.
- Collector on a Linux host
-
Add these components to the Collector configuration file. If you use an existing Collector, merge the components and pipelines with its configuration.
YAMLreceivers: otlp: protocols: grpc: endpoint: "0.0.0.0:4317" processors: batch: {} exporters: signalfx/db2: access_token: "<SPLUNK_ACCESS_TOKEN>" api_url: "https://api.<SPLUNK_REALM>.signalfx.com" ingest_url: "https://ingest.<SPLUNK_REALM>.signalfx.com" otlp_http/dbmon: logs_endpoint: "https://ingest.<SPLUNK_REALM>.signalfx.com/v3/event" headers: X-SF-Token: "<SPLUNK_ACCESS_TOKEN>" X-splunk-instrumentation-library: "dbmon" service: pipelines: metrics: receivers: [otlp] processors: [batch] exporters: [signalfx/db2] logs: receivers: [otlp] processors: [batch] exporters: [otlp_http/dbmon] - Collector in Kubernetes with Helm
-
Add these values to the Collector Helm values file. Keep the Collector OTLP/gRPC Service on port 4317. Install or upgrade the Collector by using your organization's Collector chart.
YAMLmode: deployment image: repository: otel/opentelemetry-collector-contrib tag: "<COLLECTOR_VERSION>" command: name: otelcol-contrib config: receivers: otlp: protocols: grpc: endpoint: "0.0.0.0:4317" processors: batch: {} exporters: signalfx/db2: access_token: "<SPLUNK_ACCESS_TOKEN>" api_url: "https://api.<SPLUNK_REALM>.signalfx.com" ingest_url: "https://ingest.<SPLUNK_REALM>.signalfx.com" otlp_http/dbmon: logs_endpoint: "https://ingest.<SPLUNK_REALM>.signalfx.com/v3/event" headers: X-SF-Token: "<SPLUNK_ACCESS_TOKEN>" X-splunk-instrumentation-library: "dbmon" service: pipelines: metrics: receivers: [otlp] processors: [batch] exporters: [signalfx/db2] logs: receivers: [otlp] processors: [batch] exporters: [otlp_http/dbmon] service: type: ClusterIP
Replace the access token, realm, and Collector version placeholders before starting the services. Keep configuration files readable only by the service accounts that need them.
Install and run the scraper
Install the scraper on Linux as a systemd service or deploy it to Kubernetes with Helm.
- Linux host with systemd
-
Install Java 11 or later. The following example installs Java 17 on Debian or Ubuntu. For RHEL or Fedora, use the shown
dnfcommand instead.BASH# Debian or Ubuntu sudo apt-get install -y openjdk-17-jre-headless # RHEL or Fedora: sudo dnf install -y java-17-openjdk-headless VERSION="<release-version>" sudo useradd -r -s /usr/sbin/nologin -M splunk-otel-db2 sudo install -d -o root -g splunk-otel-db2 -m 0750 /opt/splunk-otel-db2 sudo curl -fsSL -o /opt/splunk-otel-db2/splunk-otel-db2.jar \\ "https://github.com/signalfx/splunk-otel-db2/releases/download/splunk-otel-db2-${VERSION}/splunk-otel-db2-${VERSION}.jar" sudo install -d -o root -g splunk-otel-db2 -m 0750 /etc/splunk-otel-db2Save the JAR scraper configuration from the Linux scraper configuration as
/etc/splunk-otel-db2/config.yaml. Restrict file permissions so only the scraper service account can read it.BASHsudo curl -fsSL -o /etc/systemd/system/splunk-otel-db2.service \\ "https://raw.githubusercontent.com/signalfx/splunk-otel-db2/splunk-otel-db2-${VERSION}/packaging/systemd/splunk-otel-db2.service" sudo systemctl daemon-reload sudo systemctl enable --now splunk-otel-db2 sudo journalctl -u splunk-otel-db2 -fThe service unit runs the JAR as the unprivileged
splunk-otel-db2account. See the scraper repository README for the complete systemd unit details. - Kubernetes with Helm
-
Save the scraper values from the Kubernetes scraper configuration as
my-values.yaml. Replace the credential placeholders, then add the chart and install the scraper:BASHhelm repo add splunk-otel-db2 https://signalfx.github.io/splunk-otel-db2 helm repo update splunk-otel-db2 helm install <SCRAPER_RELEASE> splunk-otel-db2/splunk-otel-db2 -n <NAMESPACE> -f my-values.yaml kubectl logs -n <NAMESPACE> -l app.kubernetes.io/name=splunk-otel-db2 -fThe Helm chart runs the scraper as a separate Deployment and sends OTLP data to the Collector that you configured. The chart does not install a Collector unless you use it as a dependency of the Splunk OpenTelemetry Collector chart.