Updated on 2024-06-28 GMT+08:00

HAProxy Component Access

Application Scenario

Create collection tasks using the built-in HAProxy plug-in. After installing this plug-in, you can monitor HAProxy metrics and connect them to the ready-to-use Grafana dashboard.

Prerequisites

Procedure

  1. Log in to the AOM 2.0 console.
  2. In the navigation pane on the left, choose Access Center. Then click the HAProxy card on the Prometheus Middleware panel. Alternatively, in the navigation pane on the left, choose Collection Management > Collection Tasks. On the displayed page, click Create Collection Task.
  3. On the displayed page, set parameters by referring to the following table and click Next.

    Figure 1 Configuring a collection task
    Table 1 Parameters for creating a collection task

    Operation

    Parameter

    Description

    Select Instance

    Prometheus Instance

    Select a Prometheus instance for ECS to store collected data.

    A collection task will be associated with the Prometheus instance to mark and classify collected data. If no Prometheus instance is available, create one. (When configuring a collection task through Access Center, click Create Instance. When configuring a collection task through Collection Management, click Add Instance.)

    Set Plug-in

    OS

    Operating system of the host. Options: Linux and Windows. To use the HAProxy plug-in, select Linux.

    NOTE:
    • If Linux is used, you can select a middleware or custom plug-in.
    • If Windows is used, you can only select a custom plug-in.

    Collection Plug-in

    • Configuring a collection task through Access Center: The default value is HAPROXY.
    • Configuring a collection task through Collection Management: Click Add Plug-in and choose Middleware > HAPROXY.

    Plug-in Version

    Select a plug-in version.
    NOTE:

    Plug-in versions that have not been released are dimmed and cannot be selected.

    Set Collection Task

    Collection Task Name

    Name of a collection task. Enter 1 to 50 characters and start with a letter. Only letters, digits, underscores (_), and hyphens (-) are allowed.

    Host

    Click Add Host and select a running host for configuring the collection task and installing Exporter.

    Specify host: Select a host that has been connected.

    • On the Specify host page, search for and select a host by the host name, IP address, or Agent status.
    • On the Specify host page, click in the upper right corner to deselect the host if needed.
    • Ensure that the UniAgent of the selected host is running. Otherwise, no data can be collected.
      NOTE:

      If you select a middleware plug-in, only one host can be selected.

    Metric Dimension

    When Collection Plug-in is set to a middleware plug-in, the default metrics of the plug-in are displayed.

    Click and select Built-in or Custom to add a metric dimension.
    • Metric dimension name:
      • Built-in metric dimensions: _app, _comp, and _env are available, which are used to identify applications, components, and environments, respectively.
      • Custom metric dimension: Enter a metric dimension name. Each name can contain 1 to 64 characters. Only letters, digits, and underscores (_) are allowed. Each name must start with a letter or underscore.

      For a host, each metric dimension name must be unique.

    • Metric dimension value: Enter the value of a metric dimension. This value can be duplicate but cannot be empty.

      Each value can contain 1 to 128 characters. The following characters are not allowed: &|><$;'!-()

    Up to 10 dimensions can be added. For example, if the dimension name is label1 and the dimension value is label2, label1:"label2" will be displayed.

    Advanced Settings

    Includes Collection Period (s) and Timeout Period (s).

    • Collection Period (s): O&M data collection period, in seconds. Options: 10s, 30s, and 60s (default).
    • Timeout Period (s): the maximum time for executing a collection task, in seconds. Options: 10s, 30s, and 60s (default).
      NOTE:

      The timeout period must be shorter than or equal to the collection period.

    • Executor: user who executes the collection task, that is, the user of the selected host. The default value is root. Currently, only the root user is supported.

  4. Set Exporter installation parameters and click Install. Click View Log to check Exporter installation logs if the installation fails.

    Exporter collects monitoring data and regulates the data provided for external systems through Prometheus monitoring.
    Figure 2 Installing Exporter

    Parameter

    Description

    HAProxy URL

    HAProxy connection address, which must be in the format of "http://{username}:{password}@{IP address}:{port}/haproxy_stats;csv".

    • {username}: username for logging in to HAProxy.
    • {password}: password for logging in to HAProxy.
    • {IP}:{port}: HAProxy IP address and port number, for example, 10.0.0.1:3306.

    Example: http://admin:**********@10.0.0.1:3306/haproxy_stats;csv

  5. Click Install to connect the HAProxy plug-in. The connected plug-in will be displayed on the collection task page. Click the name of a collection task. On the displayed page, you can check the configuration of the collection task.