setFreeMonitoring
On this page本页内容
Free monitoring is deprecated
Free monitoring was deprecated in April 2023 and will be decommissioned in August 2023.
Beginning in April 2023, you can’t enable free monitoring on MongoDB Community instances. Deployments currently using free monitoring can continue to access the free monitoring UI until August 2023.
You can choose another monitoring option for your deployment:
- Deploy a MongoDB Atlas dedicated cluster. Migrate your data to a MongoDB Atlas dedicated cluster sized M10 or greater, which includes several advanced monitoring and alerting features:
Get $100 in Atlas credits by applying the code
FREE-MONITORING-100. Limited to the first 300 users. - Deploy a MongoDB Atlas free cluster. A free Atlas cluster includes basic monitoring and alerting capabilities. After you create a free cluster, use
mongodumpandmongorestoreto manually create a backup of your database and import your data from your MongoDB Community instance. - Use MongoDB Cloud Manager. The MongoDB Cloud Manager free tier includes basic monitoring capabilities.
Definition
setFreeMonitoringNew in version 4.0: Available for MongoDB Community Edition.
Enables or disables free Cloud monitoring for standalones and replica sets.
The command is run against the
admindatabase.ImportantTo run
setFreeMonitoring, you must have specified--enableFreeMonitoringcommand-line option orcloud.monitoring.free.stateconfiguration file set toruntime.Otherwise, you can only enable or disable at startup. See
--enableFreeMonitoringcommand-line option orcloud.monitoring.free.statefor details.
Syntax
The command has the following syntax:
db.adminCommand(
{
setFreeMonitoring: 1,
action: "<enable|disable>"
}
)
Behavior
Once enabled, the free monitoring state remains enabled until explicitly disabled. That is, you do not need to re-enable each time you start the server.
mongosh provides the following helper methods for setFreeMonitoring:
You can use db.getFreeMonitoringStatus() to check your free monitoring status.
Access Control
When running with access control, the user must have the setFreeMonitoring privilege actions on the cluster. That is, a user must have a role that grants the following privilege:
{ resource: { cluster : true }, actions: [ "setFreeMonitoring" ] }
The built-in role clusterMonitor role provides this privilege.