Summary: Introduction Now many customers are concerned about the application of automatic elasticity, some customers also have their own monitoring framework, and want to be able to integrate with the Aliyun container services. The Aliyun Container Service provides a service resilient scaling trigger, and can be integrated with the monitoring framework to implement customized services for automatic elasticity scaling. The Aliyun Container service automatically collects the monitoring data of the container and can send the monitoring data to the three-party monitoring framework through integration. With the monitoring ... Brief introduction
There are many customers who are concerned with the automatic elasticity of the application, and some have their own monitoring framework, and want to integrate with the Aliyun container service. The Aliyun Container Service provides a service resilient scaling trigger, and can be integrated with the monitoring framework to implement customized services for automatic elasticity scaling.
The Aliyun Container service automatically collects the monitoring data of the container and can send the monitoring data to the three-party monitoring framework through integration. With the monitoring data, we can define our own alarm rules in the monitoring framework, and call the Aliyun container service-provided triggers to enlarge or shrink the container when the indicator alarm occurs. The following is a influxdb,kapacitor to introduce how to implement a custom elastic scaling with a trigger and a monitoring framework integration. Generating scaling triggers for services
In the Aliyun container Service Application list, click on the application for automatic expansion control and click "Create TRIGGER" after entering
Then select "Resource Scaling" and select the service name to be scaled
The generated triggers are as follows:
You need to add a parameter &type=scale_out&step=2 when calling sale out. Deploy INFLUXDB and monitor
Including Monitoring time series database INFLUXDB, monitoring alarm frame kapacitor, and interface display Grafana. We can use a template to deploy:
Version: ' 2 '
services:
influxdb:
image:influxdb:0.13
ports:
-"8083:8083"
-"8,086:8,086"
container_name: "Influxdb"
Labels:
aliyun.monitoring.addon.influxdb: "http://influxdb:8086"
Grafana:
image:grafana/grafana:3.0.3-1463994644
ports:
-"3000:3000"
Links:
-Influxdb
kapacitor:
image:kapacitor:0.13
ports:
-"9092:9092"
volumes:
-/etc/acs/:/etc/ acs/
Environment:
-kapacitor_influxdb_0_urls_0=http://influxdb:8086
command:kapacitord-config/ Etc/kapacitor/kapacitor.conf
In the template, the label "Aliyun.monitoring.addon.influxdb" is used to specify that the monitoring data in the Aliyun container service be sent to the influxdb.
Add a template to the Aliyun container service and create an application from the template:
Deployment of good applications:
Configure the Kapacitor alert rule to create an alert rule file. Configure the alert rule in Kapacitor and when the alarm is called the expansion trigger URL.
Through the Web remote terminal or Docker exec into the Kapacitor container, add alarm rules, such as our CPU indicators set alarm rules, create/etc/acs/cpu.tick files, the contents are as follows:
Stream Select just the CPU measurement from our Exa
Mple database.
|from () . Measurement (' Docker_con
Tainer_cpu ')
|groupby (' Aliyun.cluster ', ' aliyun.service.id ') |alert () . Crit (Lambda: "Aliyun.cluster" = "xxxxx" and "aliyun.service.id" = = ' xxxxx ' and usage_percent ' > 70) . Post (' Https://cs.console.aliyun.com/hook/trigger?triggerUr
L=yzm5nmrindg YywrhodqwmdjhnjrmnwvhZjcxzju1ztllfg5naw54lwrlzmf1bhr8cmvkzxbsb3l8mthtzhfxbxjknxj
Kahw=&secret=xxx&&type=scale_out&step=1 ') . log ('/tmp/alerts . Log ')
The CPU indicator "DOCKER_CONTAINER_CPU" is aggregated by cluster and service, then the service is expanded when usage_percent>70.
Similarly, we can also add an alarm rule with a reduced volume. Define alert rules and enable the following commands in the Kapacitor container to define and enable alert rules.
Kapacitor define Cpu_alert-type stream -tick CPU_ALERT.TICK-DBRP telegraf.default;
Kapacitor Enable Cpu_alert
In this way, when the CPU usage exceeds 70%, the expansion trigger is automatically invoked to enlarge the container.
Sweep me, and cloud habitat online exchange "cloud Habitat Express" the first Alibaba online technology summit, will be held on July 19-21st 20:00-21:30 online. The Summit invited to Ali Group 9-bit Technology V, sharing the electric business framework, security, data processing, database, multiple application deployment, interactive technology, Docker continuous delivery and micro-services, such as front-line combat experience, interpretation of the latest technology in the Ali Group application practice. For more information, please click