文档菜单
文档首页
/ /
MongoDB CLI
/ / / /

mongocli ops-manager alerts settings update

本页面内容

  • 语法
  • 参数
  • 选项
  • 继承选项
  • 输出
  • 示例

修改项目中指定的警报配置的详细信息。

使用此命令,您必须使用具有项目所有者角色的用户帐户或API密钥进行认证。

命令语法
mongocli ops-manager alerts settings update <alertConfigId> [options]
名称
类型
必需
描述
alertConfigId
string
true
您要更新的警报配置的唯一标识符。
名称
类型
必需
描述
--apiKey
string
false
Datadog API密钥、Opsgenie API密钥或VictorOps API密钥。如果通知类型是DATADOG、OPS_GENIE或VICTOR_OPS,则必须提供。
--enabled
false
标志,表示是否启用警报配置。
--event
string
false
触发警报的事件类型。要了解CLI接受的值,请参阅Atlas API文档中的可能的事件类型名称值(https://dochub.mongodb.org/core/atlas-event-names), 运维管理器 (https://dochub.mongodb.org/core/om-event-names), 或云管理器 (https://dochub.mongodb.org/core/cm-event-names).
-h, --help
false
更新帮助
--matcherFieldName
string
false
目标对象中用于匹配的字段名称。要了解有效值,请运行 mongocli atlas alerts settings fields 类型。
--matcherOperator
string
false
当检查当前指标与匹配值之间的比较运算符时应用。有效值是 CONTAINS,ENDS_WITH,EQUALS,NOT_CONTAINS,NOT_EQUALS,REGEX,STARTS_WITH。
--matcherValue
string
false
与指定运算符一起测试的值。如果将 matcherFieldName 设置为 TYPE_NAME,则可以匹配以下值:CONFIG,MONGOS,PRIMARY,SECONDARY,STANDALONE。
--metricMode
string
false
指示 Atlas 是否将当前指标值计算为平均值的选项。有效值是 AVERAGE。
--metricName
string
false
此命令检查配置的警报的指标名称。有关有效值,请参阅https://dochub.mongodb.org/core/alert-host-metrics-atlas。此选项仅适用于事件设置为 OUTSIDE_METRIC_THRESHOLD 的情况。
--metricOperator
string
false
检查当前指标值时应用的比较运算符。有效值是 LESS_THAN 和 GREATER_THAN。
--metricThreshold
float
false
触发警报的阈值。
--metricUnits
string
false
阈值值的单位。有效值是 BITS、BYTES、DAYS、GIGABITS、GIGABYTES、HOURS、KILOBITS、KILOBYTES、MEGABITS、MEGABYTES、MILLISECONDS、MINUTES、PETABYTES、RAW、SECONDS、TERABYTES。
--notificationChannelName
string
false
Slack 频道名称。对于 SLACK 通知类型是必需的。
--notificationDelayMin
int
false
检测到警报条件后等待多少分钟才发送第一条通知。
--notificationEmailAddress
string
false
发送警报通知的电子邮件地址。
--notificationEmailEnabled
false
启用电子邮件通知的标志。可配置为 GROUP 和 USER 通知类型。
--notificationIntervalMin
int
false
等待连续通知之间的分钟数,对于未解决且未确认的警报。
--notificationMobileNumber
string
false
发送警报通知的手机号码。
--notificationRegion
string
false
指示使用哪个 API URL 的区域。
--notificationServiceKey
string
false
PagerDuty 服务密钥。
--notificationSmsEnabled
false
启用短信通知的标志。
--notificationTeamId
string
false
团队的唯一标识符。
--notificationToken
string
false
Slack API 令牌或机器人令牌。
--notificationType
string
false
警报通知类型。有效值是 DATADOG、EMAIL、GROUP(项目)、ORG、OPS_GENIE、PAGER_DUTY、SLACK、SMS、USER 或 VICTOR_OPS。
--notificationUsername
string
false
发送通知的 Atlas 用户名。
--notificationVictorOpsRoutingKey
string
false
与您的 Splunk On-Call 账户关联的路由键。
-o, --output
string
false
输出格式。有效值是 json、json-path、go-template 或 go-template-file。要查看完整输出,请使用 -o json 选项。
--projectId
string
false
用于识别项目的十六进制字符串。此选项覆盖配置文件或环境变量的设置。
名称
类型
必需
描述
-P, --profile
string
false
从配置文件中使用的配置文件名。有关MongoCLI配置文件的配置文件信息,请参阅 https://dochub.mongodb.org/core/atlas-cli-configuration-file.

如果命令成功执行,CLI将返回类似以下示例的输出。括号中的值代表您的值。

Alert configuration '<ID>' updated.
# Modify the alert configuration with the ID 5d1113b25a115342acc2d1aa so that it notifies a user when they join a group for the project with the ID 5df90590f10fab5e33de2305:
mongocli [ops-manager|cloud-manager] alerts settings update 5d1113b25a115342acc2d1aa --event JOINED_GROUP --enabled \
--notificationType USER --notificationEmailEnabled \
--notificationUsername john@example.com \
--output json --projectId 5df90590f10fab5e33de2305

返回

列表