db.disableFreeMonitoring()

On this page本页内容

db.disableFreeMonitoring()

New in version 4.0.在版本4.0中新增

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配置文件设置为运行时。

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: 参阅:
←  Free Monitoring Methodsdb.enableFreeMonitoring() →