Navigation

Alpha Release of MongoDB CLI

This is a pre-release early version of MongoDB CLI. Do not use MongoDB CLI to manage production environments.

mongocli ops-manager alerts configs create

On this page

The alerts configs create command creates one alert configuration in the specified Ops Manager project. You can also create one alert configuration in a project through the Ops Manager API.

Syntax

mongocli ops-manager|om alert|alerts config|configs create
     [ --event <event> ]
     [ --enabled ]
     [ --matcherField <fieldName> ]
     [ --matcherOperator <operator> ]
     [ --matcherValue <value> ]
     [ --notification* (notification flags) ]
     [ --projectId <id-of-project> ]
     [ --profile|-P <profile-name> ]

Options

Option Type Description Required?
--apiKey string Datadog, OpsGenie, or VictorOps API key. only if notificationType is DATADOG, ``OPS_GENIE, or VICTOR_OPS.
--enabled boolean Flag that determines whether the alert configuration is enabled. If present, the alert configuration is enabled. If omitted, the configuration is disabled. no
--event string

Type of event that triggers an alert.

For a complete list of alert events, see Alert Conditions.

yes
--matcherFieldName string

Name of the field in the target object to match on.

Use the List alert configuration matcher fields to return the accepted values.

no
--matcherOperator string

Operator to test the field’s value. Accepted values are:

  • EQUALS
  • NOT_EQUALS
  • CONTAINS
  • NOT_CONTAINS
  • STARTS_WITH
  • ENDS_WITH
  • REGEX
no
--matcherValue string

Value to test with the specified operator.

If matcherFieldName is set to TYPE_NAME, you can match on the following values:

  • PRIMARY
  • SECONDARY
  • STANDALONE
  • CONFIG
  • MONGOS
no
--metricMode string Set to AVERAGE to compute the average of this metric. no
--metricName string

The name of the metric whose value went outside the threshold. Only applicable if --event is OUTSIDE_METRIC_THRESHOLD. Accepted values are:

  • ASSERT_MSG
  • ASSERT_REGULAR
  • ASSERT_USER
  • ASSERT_WARNING
  • BACKGROUND_FLUSH_AVG
  • CACHE_BYTES_READ_INTO
  • CACHE_BYTES_WRITTEN_FROM
  • CACHE_DIRTY_BYTES
  • CACHE_USED_BYTES
  • COMPUTED_MEMORY
  • CONNECTIONS
  • CURSORS_TOTAL_CLIENT_CURSORS_SIZE
  • CURSORS_TOTAL_OPEN
  • CURSORS_TOTAL_TIMED_OUT
  • DB_DATA_SIZE_TOTAL
  • DB_STORAGE_TOTAL
  • DISK_PARTITION_SPACE_USED_DATA
  • DISK_PARTITION_SPACE_USED_INDEX
  • DISK_PARTITION_SPACE_USED_JOURNAL
  • DISK_PARTITION_UTILIZATION_DATA
  • DISK_PARTITION_UTILIZATION_INDEX
  • DISK_PARTITION_UTILIZATION_JOURNAL
  • EXTRA_INFO_PAGE_FAULTS
  • GLOBAL_ACCESSES_NOT_IN_MEMORY
  • GLOBAL_LOCK_CURRENT_QUEUE_READERS
  • GLOBAL_LOCK_CURRENT_QUEUE_TOTAL
  • GLOBAL_LOCK_CURRENT_QUEUE_WRITERS
  • GLOBAL_LOCK_PERCENTAGE
  • GLOBAL_PAGE_FAULT_EXCEPTIONS_THROWN
  • INDEX_COUNTERS_BTREE_ACCESSES
  • INDEX_COUNTERS_BTREE_HITS
  • INDEX_COUNTERS_BTREE_MISS_RATIO
  • INDEX_COUNTERS_BTREE_MISSES
  • JOURNALING_COMMITS_IN_WRITE_LOCK
  • JOURNALING_MB
  • JOURNALING_WRITE_DATA_FILES_MB
  • LOGICAL_SIZE
  • MEMORY_RESIDENT
  • MEMORY_VIRTUAL
  • MEMORY_MAPPED
  • NETWORK_BYTES_IN
  • NETWORK_BYTES_OUT
  • NETWORK_NUM_REQUESTS
  • NORMALIZED_SYSTEM_CPU_USER
  • OPCOUNTER_CMD
  • OPCOUNTER_DELETE
  • OPCOUNTER_INSERT
  • OPCOUNTER_QUERY
  • OPCOUNTER_REPL_UPDATE
  • OPCOUNTER_REPL_DELETE
  • OPCOUNTER_REPL_INSERT
  • OPCOUNTER_UPDATE
  • OPLOG_MASTER_LAG_TIME_DIFF
  • OPLOG_MASTER_TIME
  • OPLOG_RATE_GB_PER_HOUR
  • OPLOG_SLAVE_LAG_MASTER_TIME
  • RESTARTS_IN_LAST_HOUR
  • TICKETS_AVAILABLE_READS
  • TICKETS_AVAILABLE_WRITES
only if --event is OUTSIDE_METRIC_THRESHOLD.
--metricOperator string

Operator to apply when checking the current metric value against the threshold value. Accepted values are:

  • GREATER_THAN
  • LESS_THAN
no
--metricThreshold float Threshold value outside of which an alert is triggered. no
--metricUnits string

Units for the threshold value. Depends on the type of metric.

Example

A metric that measures memory consumption would have a byte measurement, while a metric that measures time would have a time unit.

Accepted values are:

  • RAW
  • BITS
  • BYTES
  • KILOBITS
  • KILOBYTES
  • MEGABITS
  • MEGABYTES
  • GIGABITS
  • GIGABYTES
  • TERABYTES
  • PETABYTES
  • MILLISECONDS
  • SECONDS
  • MINUTES
  • HOURS
  • DAYS
no
--notificationToken string Slack API or Bot token or Flowdock personal API token. If the token later becomes invalid, Ops Manager sends an email to the Project owner and eventually removes the token. only if notificationType is SLACK or FLOWDOCK.
--notificationChannelName string Slack channel name. only if notificationType is SLACK.
--notificationdelayMin int Minutes to wait after an alert condition is detected before sending out the first notification. no
--notificationEmailAddress string Email address to which Ops Manager sends notifications. only if notificationType is EMAIL.
--notificationEmailEnabled boolean Flag determining if Ops Manager sends email notifications. If present, Ops Manager sends email notifications. If absent, Ops Manager doesn’t send email notifications. Configurable for GROUP and USER notifications types. no
--notificationsFlowName string Flow name, in lower-case letters. The flow name appears after the organization name in the URL string: www.flowdock.com/app/<organization-name>/<flow-name>. only if notificationType is ``FLOWDOCK.
--notificationIntervalMin int Minutes to wait between successive notifications for unacknowledged alerts that are not resolved. no
--notificationMobileNumber string Mobile number to send SMS messages to. only if notificationType is SMS.
--notificationOrgName string Flowdock organization name in lower-case letters. This is the name that appears after www.flowdock.com/app/ in the URL string. only if notificationType is FLOWDOCK.
--notificationRole string

One or more project roles that receive the configured alert. Accepted values include:

GROUP_AUTOMATION_ADMIN GROUP_BACKUP_ADMIN GROUP_BILLING_ADMIN GROUP_DATA_ACCESS_ADMIN GROUP_DATA_ACCESS_READ_ONLY GROUP_DATA_ACCESS_READ_WRITE GROUP_MONITORING_ADMIN GROUP_OWNER GROUP_READ_ONLY GROUP_USER_ADMIN

If you include this field, Ops Manager sends alerts only to users assigned the roles you specify in the array. If you omit this field, Ops Manager sends alerts to users assigned any role.

Configurable for GROUP notifications types.

no
--notificationServiceKey string PagerDuty service key. only if notificationType is PAGER_DUTY.
--notificationSmsEnabled boolean Flag indicating SMS notifications must be sent.

only if:

  • notificationType is GROUP
  • notificationType is USER
--notificationTeamId string Unique identifier of a team. no
--notificationType string

Type of alert notification. Accepted values are:

  • DATADOG
  • EMAIL
  • FLOWDOCK
  • GROUP (Project)
  • HIPCHAT
  • OPS_GENIE
  • ORG
  • PAGER_DUTY
  • SLACK
  • SMS
  • SNMP
  • USER
  • VICTOR_OPS
  • WEBHOOK
yes
--notificationUsername string Name of an Ops Manager user to which to send notifications. Specify a user in the Project that owns the alert configuration. Only if notificationType is USER.
--notificationVictorOpsRoutingKey string VictorOps routing key Only if notificationType is VICTOR_OPS.
--profile, -P string Name of the profile where the public and private keys for the project are saved. If omitted, uses the default profile. To learn more about creating a profile, see Configure the MongoDB CLI. no
--projectId string

Unique identifier of the project containing the alert configuration you want to create.

Note

You can retrieve the list of projects, including their IDs, using the mongocli iam project list command.

yes

Output

If the command succeeds, it prints the subset of the following fields to the terminal in JSON format that describes the alert configuration. If the command returns an error, see Troubleshooting for recommended solutions.

Name Type Description
created string Timestamp in ISO 8601 date and time format in UTC when this alert configuration was created.
enabled boolean Flag indicating this alert configuration enabled.
eventTypeName string

Type of event that triggers an alert.

For a complete list of alert events, see Alert Conditions.

groupId string Unique identifier of the Project that owns this alert configuration.
id string Unique identifier for this alert configuration.
matchers.fieldName string

Name of the field in the target object to match on.

Use the List alert configuration matcher fields to return the possible values.

matchers.operator string

Operator to test the field’s value. Accepted values are:

  • EQUALS
  • NOT_EQUALS
  • CONTAINS
  • NOT_CONTAINS
  • STARTS_WITH
  • ENDS_WITH
  • REGEX
matchers.value string

Value to test with the specified operator.

If matcherFieldName is set to TYPE_NAME, you can match on the following values:

  • PRIMARY
  • SECONDARY
  • STANDALONE
  • CONFIG
  • MONGOS
matchers object array

Rules to apply when matching an object against this alert configuration. Only entities that match all these rules are checked for an alert condition.

You can filter using the matchers array only when the eventTypeName specifies an event for a host, replica set, or sharded cluster.

metricThreshold.metricName string

The name of the metric whose value went outside the threshold. Only applicable if --event is OUTSIDE_METRIC_THRESHOLD. Possible values are:

  • ASSERT_MSG
  • ASSERT_REGULAR
  • ASSERT_USER
  • ASSERT_WARNING
  • BACKGROUND_FLUSH_AVG
  • CACHE_BYTES_READ_INTO
  • CACHE_BYTES_WRITTEN_FROM
  • CACHE_DIRTY_BYTES
  • CACHE_USED_BYTES
  • COMPUTED_MEMORY
  • CONNECTIONS
  • CURSORS_TOTAL_CLIENT_CURSORS_SIZE
  • CURSORS_TOTAL_OPEN
  • CURSORS_TOTAL_TIMED_OUT
  • DB_DATA_SIZE_TOTAL
  • DB_STORAGE_TOTAL
  • DISK_PARTITION_SPACE_USED_DATA
  • DISK_PARTITION_SPACE_USED_INDEX
  • DISK_PARTITION_SPACE_USED_JOURNAL
  • DISK_PARTITION_UTILIZATION_DATA
  • DISK_PARTITION_UTILIZATION_INDEX
  • DISK_PARTITION_UTILIZATION_JOURNAL
  • EXTRA_INFO_PAGE_FAULTS
  • GLOBAL_ACCESSES_NOT_IN_MEMORY
  • GLOBAL_LOCK_CURRENT_QUEUE_READERS
  • GLOBAL_LOCK_CURRENT_QUEUE_TOTAL
  • GLOBAL_LOCK_CURRENT_QUEUE_WRITERS
  • GLOBAL_LOCK_PERCENTAGE
  • GLOBAL_PAGE_FAULT_EXCEPTIONS_THROWN
  • INDEX_COUNTERS_BTREE_ACCESSES
  • INDEX_COUNTERS_BTREE_HITS
  • INDEX_COUNTERS_BTREE_MISS_RATIO
  • INDEX_COUNTERS_BTREE_MISSES
  • JOURNALING_COMMITS_IN_WRITE_LOCK
  • JOURNALING_MB
  • JOURNALING_WRITE_DATA_FILES_MB
  • LOGICAL_SIZE
  • MEMORY_RESIDENT
  • MEMORY_VIRTUAL
  • MEMORY_MAPPED
  • NETWORK_BYTES_IN
  • NETWORK_BYTES_OUT
  • NETWORK_NUM_REQUESTS
  • NORMALIZED_SYSTEM_CPU_USER
  • OPCOUNTER_CMD
  • OPCOUNTER_DELETE
  • OPCOUNTER_INSERT
  • OPCOUNTER_QUERY
  • OPCOUNTER_REPL_UPDATE
  • OPCOUNTER_REPL_DELETE
  • OPCOUNTER_REPL_INSERT
  • OPCOUNTER_UPDATE
  • OPLOG_MASTER_LAG_TIME_DIFF
  • OPLOG_MASTER_TIME
  • OPLOG_RATE_GB_PER_HOUR
  • OPLOG_SLAVE_LAG_MASTER_TIME
  • RESTARTS_IN_LAST_HOUR
  • TICKETS_AVAILABLE_READS
  • TICKETS_AVAILABLE_WRITES
metricThreshold.mode string Average value of this metric.
metricThreshold.operator string

Operator to apply when checking the current metric value against the threshold value. Accepted values are:

  • GREATER_THAN
  • LESS_THAN
metricThreshold.threshold number Threshold value outside of which an alert is triggered.
metricThreshold.units string

Units for the threshold value. Depends on the type of metric.

Example

A metric that measures memory consumption would have a byte measurement, while a metric that measures time would have a time unit.

Accepted values are:

  • RAW
  • BITS
  • BYTES
  • KILOBITS
  • KILOBYTES
  • MEGABITS
  • MEGABYTES
  • GIGABITS
  • GIGABYTES
  • TERABYTES
  • PETABYTES
  • MILLISECONDS
  • SECONDS
  • MINUTES
  • HOURS
  • DAYS
metricThreshold object Threshold that will cause an alert to be triggered. Populated if "eventTypeName" : "OUTSIDE_METRIC_THRESHOLD".
notifications.apiToken string Slack API token or Bot token. Populated for SLACK notifications. If the token later becomes invalid, Ops Manager sends an email to the Project owner and eventually removes the token.
notifications.channelName string Slack channel name. Populated for SLACK notifications.
notifications.datadogApiKey string DataDog API Key. Found in the DataDog dashboard. Populated for DATADOG notifications.
notifications.delayMin number Number of minutes to wait after an alert condition is detected before sending out the first notification.
notifications.emailAddress string Email address to which to send notification. Populated for EMAIL notifications.
notifications.emailEnabled boolean Flag indicating email notifications must be sent. Populated for ORG, GROUP, and USER notifications.
notifications.flowdockApiToken string Flowdock “personal API token.” Populated for FLOWDOCK notifications. If the token later becomes invalid, Ops Manager sends an email to the Project owner and eventually removes the token.
notifications.flowName string Flow name, in lower-case letters. Populated for FLOWDOCK notifications. The flow name appears after the organization name in the URL string: www.flowdock.com/app/<organization-name>/<flow-name>.
notifications.intervalMin number Number of minutes to wait between successive notifications for unacknowledged alerts that are not resolved.
notifications.notificationToken string HipChat API token. Populated for HIP_CHAT notifications. If the token later becomes invalid, Ops Manager sends an email to the Project owner and eventually removes the token.
notifications.orgName string Flowdock organization name in lower-case letters. This is the name that appears after www.flowdock.com/app/ in the URL string. Populated for FLOWDOCK notifications.
notifications.role string Ops Manager role in current Project. Populated for GROUP notifications.
notifications.roomName string HipChat room name. Populated for HIP_CHAT notifications.
notifications.serviceKey string PagerDuty service key. Populated for PAGER_DUTY notifications. If the key later becomes invalid, Ops Manager sends an email to the Project owner and eventually removes the key.
notifications.smsEnabled boolean Flag indicating SMS notifications must be sent. Populated for ORG, GROUP, and USER notifications.
notifications.snmpAddress string Hostname and port to send SNMP traps to. At this time, Ops Manager is only able to send SNMP traps to the standard SNMP port (162). Populated for SNMP notifications. Ops Manager uses SNMP v2c.
notifications.typeName string

Type of alert notification. Accepted values are:

  • DATADOG
  • EMAIL
  • FLOWDOCK
  • GROUP (Project)
  • HIPCHAT
  • OPS_GENIE
  • ORG
  • PAGER_DUTY
  • SLACK
  • SMS
  • SNMP
  • USER
  • VICTOR_OPS
  • WEBHOOK
notifications.username string Name of an Ops Manager user to which to send notifications. Only a user in the Project that owns the alert configuration is allowed here. Populated for USER notifications.
notifications object array Notifications to send when an alert condition is detected.
threshold.operator string

Operator to apply when checking the current metric value against the threshold value.

  • GREATER_THAN
  • LESS_THAN
threshold.threshold number Threshold value outside of which an alert is triggered.
threshold object

Threshold that will cause an alert to be triggered. Populated if

  • "eventTypeName" : "TOO_FEW_HEALTHY_MEMBERS"
  • "eventTypeName" : "TOO_MANY_UNHEALTHY_MEMBERS"
typeName string This field is deprecated and are ignored.
updated string Timestamp in ISO 8601 date and time format in UTC when this alert configuration was last updated.

Examples

The following example uses the mongocli om alerts configs create command to create one alert configuration the specified project. It uses the profile named myprofile for accessing the Ops Manager project.

mongocli om alert configs create --event JOINED_GROUP --enabled \
--notificationType USER --notificationEmailEnabled \
--notificationUsername john@example.com \
--projectId 5df90590f10fab5e33de2305 --profile myprofile

The above command prints the following fields in JSON format to the terminal. To learn more about these fields, see Output.

{
     "id": "5eaafc90da10757c5fc51e70",
     "groupId": "5df90590f10fab5e33de2305",
     "eventTypeName": "JOINED_GROUP",
     "created": "2020-05-01T14:34:57Z",
     "updated": "2020-05-01T14:34:57Z",
     "enabled": true,
     "notifications": [
             {
                     "delayMin": 0,
                     "emailEnabled": true,
                     "smsEnabled": false,
                     "typeName": "USER",
                     "username": "john@example.com"
             }
     ]
}