Docs HomeMongoDB Manual

db.disableFreeMonitoring()

On this page本页内容

db.disableFreeMonitoring()

Disables free Cloud monitoring.禁用免费的云监控

Important

To run db.disableFreeMonitoring(), you must have specified --enableFreeMonitoring command-line option or cloud.monitoring.free.state configuration file set to runtime.若要运行db.disableFreeMonitoring(),必须将--enableFreeMonitoring命令行选项或cloud.monitoring.free.state配置文件设置为runtime

Otherwise, you can only enable or disable at startup. 否则,您只能在启动时启用或禁用。See --enableFreeMonitoring command-line option or cloud.monitoring.free.state for details.有关详细信息,请参阅--enableFreeMonitoring命令行选项或cloud.monitoring.free.state

The db.disableFreeMonitoring() method is a wrapper around the setFreeMonitoring command.db.disableFreeMonitoring()方法是setFreeMonitoring命令的包装器。

Access Control访问控制

When running with access control, the user must have the setFreeMonitoring privilege actions on the cluster. 在使用访问控制运行时,用户必须在集群上具有setFreeMonitoring权限操作。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.内置的角色clusterMonitor角色提供了此权限。

Example实例

To disable free monitoring, run the following in mongosh:要禁用免费监控,请在mongosh中运行以下操作:

db.disableFreeMonitoring()

You can use db.getFreeMonitoringStatus() to check your of free monitoring status:您可以使用db.getFreeMonitoringStatus()来检查您的免费监控状态:

db.getFreeMonitoringStatus()

If free monitoring is disabled, the method returns a document similar to:如果禁用了自由监视,则该方法将返回类似于以下内容的文档:

{
"state" : "disabled",
"message" : "To see your monitoring data, navigate to the unique URL below.\nAnyone you share the URL with will also be able to view this page.\n\nhttps://cloud.mongodb.com/freemonitoring/mongo/MSBjZTZhNTJmOS0yODg1\n\nYou can disable monitoring at any time by running db.disableFreeMonitoring().",
"url" : "https://cloud.mongodb.com/freemonitoring/mongo/MSBjZTZhNTJmOS0yODg1",
"userReminder" : "",
"ok" : 1
}

Even when disabled, your unique URL is returned so that if you re-enable monitoring at a later time, you can access your previous metrics that has not expired within the past 24 hours.即使在禁用时,也会返回您的唯一URL,这样,如果您稍后重新启用监控,您就可以访问过去24小时内未过期的先前指标。

Tip

See also: 另请参阅:

db.enableFreeMonitoring()