MongoDB data source
MongoDB is a distributed document database. The MongoDB data source plugin allows you to visualize data from MongoDB in Grafana.
The following will help you get started working with MongoDB and Grafana:
Requirements
The MongoDB data source has the following requirements:
- A MongoDB 5.0+ instance with at least one user.
- Any free or paid Grafana Cloud plan or an activated on-prem Grafana Enterprise license. Contracted Cloud customers should refer to their agreement.
- Port 27017 enabled.
Known limitations
- Only
find
andaggregate
read commands are supported - See Diagnostics for a list of currently supported diagnostics commands
- Regex flags
g
ands
are not supported
Install the MongoDB plugin
To install the MongoDB plugin see Installation.
Provision the MongoDB data source
You can define and configure the MongoDB data source in YAML files as part of Grafana’s provisioning system. For more information about provisioning a data source, and for available configuration options, see Provision Grafana.
apiVersion: 1
datasources:
- name: MongoDB
type: grafana-mongodb-datasource
access: proxy
basicAuth: false
editable: true
enabled: true
jsonData:
connection: Connection string
user: user name
secureJsonData:
password: password
Get the most out of the plugin
After installing and configuring MongoDB you can:
- Add Annotations.
- Configure and use Templates and variables.
- Add Transformations.
- Set up Alerting.
- Set up proxying. See Configure a data source connection proxy for configuration instructions.
Note
Proxying requires Grafana v10.x and the feature togglesecureSocksDSProxy
set toEnabled
.