Updated on 2023-11-03 GMT+08:00

API Monitoring

Introduction

API monitors monitor the API gateway of your service, and control the resolution result of the DNS entry based on the availability of API gateway.

Table 1 Monitoring status description

Monitoring Status

Description

Green

The monitoring is normal.

Red

The monitoring is abnormal. Traffic switchover is automatically triggered when the status changes from normal to failed.

Yellow

The monitor initialization failed. The MAS process cannot detect the service API. In this case, confirm the configurations or contact O&M personnel.

Light gray

Monitor creation or configuration failed

Dark gray

Invocation failed. The ETCD connection status is abnormal.

Creating an API Monitor

  1. Log in to the MAS console. On the Multi-Active Instances page, click an instance to go to its console.
  2. Click the Monitor List tab, and click Create Monitor.
  3. Configure the basic information, then click Next: Data Centers.

    Figure 1 Basic information configurations
    Table 2 Basic information parameters

    Parameter

    Description

    Monitor

    Select API Monitoring.

    Application

    Select the application.

    Monitor Name

    Customize the monitor name.

    Exception Notification

    By default, this option is disabled.

    If it is enabled,

    • monitor and database exceptions will be sent to you in a timely manner with the Huawei Cloud SMN service. Configure a secret key first.
    • Cloud Eye is enabled by default. Ensure that the alarm rules for MAS have been created on the Cloud Eye console. For details, see Creating an Alarm Rule to Monitor an Event.

    Subject

    If Exception Notification is enabled, select a subject from the drop-down list or click Add to create a new one.

    Monitoring

    The default value is Yes. If No, the API gateway status will not be monitored.

  4. Configure the data centers, then click Next: Advanced.

    Figure 2 Data center configurations
    Table 3 Data center parameters

    Parameter

    Description

    Cloud

    Select the environment where the monitored API gateway is deployed.

    Region

    Select the regions of the API gateways.

    Connection Address

    Select HTTP or HTTPS, and enter the connection address of the API gateway.

    Request path

    Health check path of the API gateway.

    Request Methods

    Select GET, POST, DELETE, PATCH, or PUT.

    Status Code

    Set this parameter based on the actual requirements of the monitored API gateway, for example, 200.

    Request Header

    Set this parameter based on the actual requirements of the monitored API gateway.

    Encrypt the request header if it contains sensitive information.

  5. Configure the advanced settings, then click Next: Confirm.

    Figure 3 Advanced configurations
    Table 4 Advanced settings

    Parameter

    Description

    Retry Interval (ms)

    The interval of reconnection attempts, in milliseconds. Default value (recommended): 5000

    Value range: 1 to 300,000

    Healthy Threshold

    If the number of successful consecutive API connections reaches or exceeds the threshold, the API connection is normal.

    NOTE:

    Default value (recommended): 2; Value range: 1 to 5

    Unhealthy Threshold

    If the number of consecutive API connection failures reaches or exceeds the threshold, the API connection is abnormal.

    NOTE:

    Default value (recommended): 3; Value range: 3 to 10

  6. Confirm settings and click Create.

    If the created monitor is not normal, that is, its indicator is not green, its configurations or databases may be abnormal. In this case, rectify the fault.