setFreeMonitoring

On this page本页内容

setFreeMonitoring

New in version 4.0.在版本4.0中新增 Available for MongoDB Community Edition.可用于MongoDB社区版。

Enables or disables free Cloud monitoring for standalones and replica sets.启用或禁用单机版和副本集的免费云监控

The command is run against the admin database and has the form:该命令针对admin数据库运行,格式如下:

db.adminCommand( { setFreeMonitoring: 1, action: "<enable|disable>" } )
Important重要

To run setFreeMonitoring, you must have specified --enableFreeMonitoring command-line option or cloud.monitoring.free.state configuration file set to runtime.要运行setFreeMonitoring,必须将--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.有关详细信息,请参阅--enableFreeMonitoringg命令行选项或cloud.monitoring.free.state

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:setFreeMonitoring提供了以下帮助器方法:

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

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角色提供此权限。

←  getFreeMonitoringStatusSystem Events Auditing Commands →