Custom Metrics Walkthrough

Walk through common use cases with custom metrics: publishing, querying, creating an alarm, and triggering the alarm to observe its Firing status.

Task 1: Publish Custom Metrics

See Publishing Custom Metrics.

Task 2: Query the Published Custom Metrics

See Creating a Query for a Custom Metric.

Task 3: Create an Alarm

Create an alarm to get an email when the number of product orders (productOrder) in a 5-minute time period is higher than 100.

The following instructions show how to use Basic mode in the Console. For basic alarm instructions, see Editing the MQL Expression When Creating an Alarm (for Advanced mode, including MQL) and Creating an Alarm (for CLI and API).

  1. Open the Create alarm page:
    1. Open the navigation menu and click Observability & Management. Under Monitoring, click Alarm Definitions.
    2. Click Create alarm.
  2. Provide values for the following fields:
    • Alarm name (under Define alarm): Too Many Product Orders
    • Alarm severity: Info
    • Alarm body: High number of product orders received (over 100 in a five-minute period).
    • Compartment (under Metric description): The compartment containing the resources that you want to monitor. By default, the first accessible compartment is selected.
    • Metric namespace: mymetricsnamespace
    • Resource group: divisionX
    • Metric name: productOrder
    • Interval: 5m
    • Statistic: Sum
    • Trigger rule:
      • Operator: greater than
      • Value: 100
      • Trigger delay minutes: 1
    • Destination (under Define alarm notifications): Select Notifications.
    • Create a topic: Provide values for the following fields:

      • Topic name: extreme-product-order-volume
      • Topic description: Channel to notify of high number of product orders received (over 100 in a five-minute period).
      • Subscription protocol: Email
      • Subscription email: (enter your email address)

    The metric chart under the Define alarm section dynamically displays the last six hours of emitted metrics for productOrder under the resource group DivisionX.

    Example metric chart for an alarm query
  3. Click Save alarm.

    Notifications sends a confirmation request to the email address configured in the new subscription.

  4. Confirm the new email subscription. See Confirming a Subscription.

Trigger the Alarm

Trigger the alarm to observe its Firing status.

  1. Publish a set of data points to trigger the alarm. Send a request that shows over 100 orders within 5 minutes.

    For instructions, see Publishing Custom Metrics.

  2. Get the alarm's details.

    For instructions, see Getting an Alarm's Details.

    The alarm is in Firing state.

  3. Check your email.

    For reference, see Email (Formatted) on the overview page.

    The email indicates that the alarm is in Firing state.