PostgreSQL receiver
The PostgreSQL receiver collects metrics from PostgreSQL through its statistics collector.
The PostgreSQL receiver is a component of the Splunk Distribution of the OpenTelemetry Collector. It collects metrics from PostgreSQL using the PostgreSQL statistics collector. The supported pipeline type is metrics.
postgresql monitor type.Requirements
Use PostgreSQL version 9.6 and higher.
To let the receiver collect data, grant the monitoring user
SELECTpermissions forpg_stat_database. Learn more at the official PostgreSQL statistics collector documentation.
Deploy the collector
See Deploy the Splunk Distribution of the OpenTelemetry Collector.
Configure the receiver
In your OpenTelemetry configuration file, add
postgresqlto thereceiverssection:receivers: postgresql: endpoint: localhost:5432 transport: tcp username: otel password: ${env:PGSQL_PASSWORD} databases: - otel collection_interval: 10s tls: insecure: false insecure_skip_verify: false ca_file: /home/otel/authorities.crt cert_file: /home/otel/mypostgrescert.crt key_file: /home/otel/mypostgreskey.keyusernameandpasswordare mandatory.endpointis the address at which receiver searches for a PostgreSQL server. Its default value islocalhost:5432. You can specify a different value here.
Add
postgresqlto themetricspipeline:service: pipelines: metrics: receivers: [postgresql]
Restart the collector
To apply your configuration changes, restart the collector. The command to restart the Splunk Distribution of the OpenTelemetry Collector varies depending on what platform you deployed it on and what tool you used to deploy it, but here are general examples of the restart command:
-
sudo systemctl restart splunk-otel-collector -
Windows with installer script:
stop-service splunk-otel-collector start-service splunk-otel-collector -
sudo systemctl restart splunk-otel-collector
Settings
The following table shows the configuration options for the PostgreSQL:
included
https://raw.githubusercontent.com/splunk/collector-config-tools/main/cfg-metadata/receiver/postgresql.yaml
Metrics
The following metrics, resource attributes, and attributes are available.
included
https://raw.githubusercontent.com/splunk/collector-config-tools/main/metric-metadata/postgresqlreceiver.yaml
Activate or deactivate specific metrics
You can activate or deactivate specific metrics by setting the enabled field in the metrics section for each metric. For example:
receivers:
samplereceiver:
metrics:
metric-one:
enabled: true
metric-two:
enabled: false
The following is an example of host metrics receiver configuration with activated metrics:
receivers:
hostmetrics:
scrapers:
process:
metrics:
process.cpu.utilization:
enabled: true
-
If you’re in a MTS-based subscription, all metrics count towards metrics usage.
-
If you’re in a host-based plan, metrics listed as active (Active: Yes) on this document are considered default and are included free of charge.
Learn more at Infrastructure Monitoring subscription usage (Host and metric plans).
Troubleshooting
If you are a Splunk Observability Cloud customer and are not able to see your data in Splunk Observability Cloud, you can get help in the following ways.
Available to Splunk Observability Cloud customers
Submit a case in the Splunk Support Portal.
Contact Splunk Support.
Available to prospective customers and free trial users
Ask a question and get answers through community support at Splunk Answers.
Join the Splunk community #observability Slack channel to communicate with customers, partners, and Splunk employees worldwide.