Docs HomeMongoDB Manual

db.getFreeMonitoringStatus

db.getFreeMonitoringStatus()

Returns information on free monitoring status.返回有关免费监视状态的信息。

mongosh helper db.getFreeMonitoringStatus() is a wrapper around the getFreeMonitoringStatus command.mongosh助手db.getFreeMonitoringStatus()getFreeMonitoringStatus命令的包装器。

Tip

See also: 另请参阅:

db.enableFreeMonitoring()

Access Control访问控制

When running with access control, the user must have the checkFreeMonitoringStatus privilege actions on the cluster. 在使用访问控制运行时,用户必须在群集上具有checkFreeMonitoringStatus权限操作。That is, a user must have a role that grants the following privilege:也就是说,用户必须具有授予以下权限角色

{ resource: { cluster : true }, actions: [ "checkFreeMonitoringStatus" ] }

The built-in role clusterMonitor role provides this privilege.内置的角色clusterMonitor角色提供了此权限。

Output输出

The method returns a document with the following fields:该方法返回一个包含以下字段的文档:

Field字段Description描述
stateThe free monitoring enablement state. 免费监控启用状态。Values are either: "enabled" or "disabled".值为:"enabled""disabled"
messageAny informational message related to your state.任何与您的状态相关的信息性消息。
urlThe unique URL at which your monitoring data can be accessed. 可以访问监控数据的唯一URL。
Note
Anyone with whom you share this unique URL can access your monitored data. 与您共享此唯一URL的任何人都可以访问您监控的数据。
Even when disabled, your unique URL is returned so that if you re-enable monitoring, you can access your previous metrics. 即使被禁用,也会返回您的唯一URL,这样,如果您重新启用监控,您就可以访问以前的指标。
userReminderAny informational message related to your state.任何与您的状态相关的信息性消息。
okStatus of the getFreeMonitoringStatus operation itself. Values are either: getFreeMonitoringStatus操作本身的状态。值为:
  • 1 if the operation was successful.如果操作成功,则为1
  • 0 if the operation was not successful.如果操作不成功,则为0

Example实例

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

db.getFreeMonitoringStatus()

The method returns information on your free monitoring status.该方法返回有关您的免费监控状态的信息。

{
"state" : "enabled",
"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
}
Tip

See also: 另请参阅:

freeMonitoring field returned from db.serverStatus()db.serverStatus()返回的freeMonitoring字段