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>" } )
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.--enableFreeMonitoring
g命令行选项或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()
检查免费监控状态。
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
角色提供此权限。