edit-icon download-icon

Integrate with third-party monitoring solutions

Last Updated: Jan 11, 2018

Container Service provides the capability to integrate with third-party open-sourced monitoring solutions.

Note: Currently, Container Service monitoring integration only supports InfluxDB and Prometheus by default.

The following example introduces how to integrate the Container Service monitoring service with third-party monitoring solutions by taking InfluxDB as an example.

Prerequisites

Create an application to be monitored. In this example, create an Nginx application. For more information, see Create an Nginx webserver from an image.

Procedure

  1. Log on to the Container Service console.

  2. Click Applications in the left-side navigation pane.

  3. Click Create Application in the upper-right corner.

    1

  4. Enter the basic information of the application and click Create with Orchestration Template.

    In this example, the name of the application is influxdb.

    1

  5. Enter the following orchestration template and click Create and Deploy.

    Note: In a real production environment, the template in this example needs to be modified. Do not expose the port to the host in the influxdb service definition.

    1. version: '2'
    2. services: #Define influxdb.
    3. influxdb:
    4. image: tutum/influxdb:0.9
    5. volumes:
    6. - /var/lib/docker/influxdb:/data
    7. ports:
    8. - "8083:8083" #Expose Web interface port.
    9. - "8086:8086" #Expose data API Web interface port.
  6. After the application is successfully created, click the application name influxdb on the Application List page to view the application details.

  7. Click the Containers tab to view the node IP and port exposed by this application. Copy the node IP and port. (In this example, copy the node IP and port number of the port 8086. These are the data reporting address exposed by influxdb.)

    1

  8. Return to the Application List page.

  9. Click Update at the right of influxdb. Add the following contents to the template to declare the integration of InfluxDB and the container monitoring service. Then, click OK.

    1. labels:
    2. aliyun.monitoring.addon.influxdb: "http://node IP:port" #The node IP and port are the ones you copied in step 7.
    3. aliyun.monitoring.addon.influxdb_retention_policy: "default"

    Note: Currently, the third-party open-sourced monitoring integration only supports InfluxDB and Prometheus. The labels for InfluxDB and Prometheus integration are aliyun.monitoring.addon.influxdb and aliyun.monitoring.addon.prometheus respectively. The format of the label value must be schema:hostIp:port.

    Container Service cannot use link to identify InfluxDB because the container monitoring service Agent adopts host network mode. Therefore, create the influxdb application and then add the data reporting address exposed by influxdb to the application labels so as to inform the data collection client. Then, the monitoring service automatically writes the running status data of containers collected by application influxdb to influxdb.

  10. On the Application List page, click the application name influxdb and then click the Containers tab. Copy the port exposed by influxdb container.

    1

  11. We recommend that you access InfluxDB by using the Web proxy.

    To access InfluxDB by using Internet, follow these steps:

    1. Perform Internet authentication.

    2. Configure the inbound security group rules of ports 8083 and 8086 for the node in which the application influxdb resides.

    3. Access InfluxDB by using http://EIP:8083 port or http://node public IP:8083 according to the cluster network mode (Virtual Private Cloud (VPC) or Classic).

  12. Access the InfluxDB page in the browser to view the metric data written by the container monitoring service.

    1. Select telegraf. If telegraf does not exist, run CREATE DATABASE telegraf first and then redeploy the application that needs to be monitored.
    2. Click Query Templates and select Show Measurements from the list.
    3. Press Enter.

    You can view the database table.

    influxdbquery

    View detailed data in a table.

    query

Subsequent operations

After Container Service is integrated with InfluxDB, select other data charts and frameworks, such as Grafana, to display your monitoring data based on your own business situation.

Thank you! We've received your feedback.