MongoDB receiver 🔗
The MongoDB receiver fetches metrics from standalone MongoDB clusters, including non-Atlas managed MongoDB servers. The supported pipeline type is metrics
. See Process your data with pipelines for more information.
The receiver collects stats with MongoDB’s dbStats
and serverStatus
commands, and uses the golang mongo driver. See more at Mongo Go driver documentation .
Note
Use the MongoDB receiver in place of the deprecated SignalFx Smart Agent mongodb
monitor type.
Prerequisites 🔗
The MongoDB receiver supports MongoDB versions 4.0+ and 5.0.
MongoDB recommends to set up a least privilege user (LPU) with a clusterMonitor
role in order to collect metrics.
For information on MongoDB’s roles, see MongoDB built-in roles .
For an example of how to configure these permissions, see lpu.sh .
Note
If you’re using automatic discovery with MongoDB, see Automatic discovery for MongoDB.
Get started 🔗
Follow these steps to configure and activate the component:
Deploy the Splunk Distribution of the OpenTelemetry Collector to your host or container platform:
Configure the receiver as described in the next section.
Restart the Collector.
Sample configurations 🔗
To activate the MongoDB receiver, add mongodb
to the receivers
section of your configuration file, as shown in the following example:
receivers:
mongodb:
hosts:
- endpoint: localhost:27017
transport: tcp
username: otel
password: ${env:MONGODB_PASSWORD}
collection_interval: 60s
initial_delay: 1s
tls:
insecure: true
insecure_skip_verify: true
To complete the configuration, include the receiver in the metrics
pipeline of the service
section of your configuration file. For example:
service:
pipelines:
metrics:
receivers: [mongodb]
Configuration options 🔗
The following settings are optional:
hosts
.[localhost:27017]
by default. List ofhost:port
or Unix domain socket endpoints.For standalone MongoDB deployments this is the hostname and port of the mongod instance.
For replica sets specify the hostnames and ports of the mongod instances that are in the replica set configuration. If the
replica_set
field is specified, nodes will be autodiscovered.For a sharded MongoDB deployment, specify a list of the
mongos
hosts.
username
: If authentication is required, provide theclusterMonitor
permissions here.password
: If authentication is required, provide the password here.collection_interval
.1m
by default. This receiver collects metrics on an interval. Valid time units arens
,us
(orµs
),ms
,s
,m
,h
. This value must be a string readable by Golang’s time parseDuration. Learn more at ParseDuration .initial_delay
.1s
by default. Defines how long this receiver waits before starting.replica_set
: If the deployment of MongoDB is a replica set, use this to specify the replica set name which allows for autodiscovery of other nodes in the replica set.timeout
.1m
by default. The timeout of running commands against mongo.tls
: TLS control. By default insecure settings are rejected and certificate verification is on. See more at TLS Configuration Settings .
Settings 🔗
The following table shows the configuration options for the MongoDB receiver:
Metrics 🔗
The following metrics, resource attributes, and attributes are available.
mongodb.extent.count
is available for versions under 4.4 with mmapv1 storage engine.
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
Note
Deactivated metrics aren’t sent to Splunk Observability Cloud.
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 #observability user group Slack channel to communicate with customers, partners, and Splunk employees worldwide. To join, see Chat groups in the Get Started with Splunk Community manual.