How can I automatically scale EC2 instances with system data collected using Sensu?

I want to reduce the size of EC2 instances on AWS. For this, I was offered to use the Sensu framework .

I want to scale an instance based on its CPU usage. For testing, I configured Sensu on both Windows and Ubuntu (V.Box), I am running the client on Ubuntu, following this example . My processor data is successfully transferred to RabbitMQ.

Now I am wondering how can I use this data on the Sensu server so that I can scale or scale? Any suggestion would be appreciated.

In case it matters, I will use it with the Opscode chef.

+4
source share
1 answer

The easiest way to achieve your goal is to link the available components (which will require writing code, see below) and refrain from adding custom solutions as much as possible:

Amazon EC2 offers Auto Scaling , which is located in Rotate Metrics collected through Amazon CloudWatch . So metrics are key here, and that is what Sensu means, see, for example, Sensu and Graphite , which covers two approaches for pushing metrics from Sensu to Graphite:

Remember: think of Sensu as a โ€œcontrol routerโ€. While we're going to show how to click metrics on Graphite, itโ€™s just as simple push metrics for any other system - Librato, Cube, OpenTSDB, etc. In fact, it would not be at all difficult to push the metrics to several. Graphic display of backends in branching mode. [emphasis mine]

Your metrics are already available on the Sensu server, so now you will need to paste them into CloudWatch (as described in Graphite in the article above), and in turn bind the corresponding auto-scaling policies to them.

Currently, the available metric handlers for Sensu are aimed at Graphite and Librato , so you will need to implement the Sensu Handler for Publishing custom metrics to CloudWatch (be sure to share it, it will definitely be widely used over time :)

Good luck

+3
source

Source: https://habr.com/ru/post/1403846/


All Articles