Autoscaling using Ceilometer/Aodh

As a telemetry service, the ceilometer project consists of several sub-projects
which provide metering, monitoring and alarming services in the telemetry
space. This section walks you through the steps to build an auto-scaling
solution by integrating senlin with ceilometer/aodh.

Note this spec file assumes that you have a working nova key-pair named
“oskey” and there is a network named “private”. You may need to change
these values based your environment settings. To create a profile using this
spec:

The next step is to create receivers for the cluster for triggering actions on
the cluster. Each receiver is usually created for a specific purpose, so for
different purposes you may need to create more than receivers.

The following command creates a receiver for scaling out the specified cluster
by two nodes every time it is triggered:

At present, all property values shown for a receiver are read only. You cannot
change their values once the receiver is created. The only type of receivers
senlin understands is “webhook”. For the “action” parameter, there are
many choices:

CLUSTER_SCALE_OUT

CLUSTER_SCALE_IN

CLUSTER_RESIZE

CLUSTER_CHECK

CLUSTER_UPDATE

CLUSTER_DELETE

CLUSTER_ADD_NODES

CLUSTER_DEL_NODES

NODE_CREATE

NODE_DELETE

NODE_UPDATE

NODE_CHECK

NODE_RECOVER

Senlin may add supports to more action types in future.

After a receiver is created, you can check its “channel” property value to
find out how to trigger that receiver. For a receiver of type “webhook”
(the default and the only supported type as for now), this means you will
check the “alarm_url” value. We will use that value later for action
triggering. For convenience, we export that value to an environment variable:

Once we have the cluster created and prepared to receive external signals, we
can proceed to create alarms using the software/service you deployed. The
following command creates a threshold alarm using aodh alarm service so that:

aodh will evaluate the CPU utilization (i.e. cpu_util) metric across the
specified cluster;

aodh will compute the CPU utilization using the average value during a given
period (i.e. 60 seconds here);

Note that we are referencing the two environment variables MYCLUSTER_ID
and ALRM_URL01 in this command.

Note

To make aodh aware of the cluster_id metadata senlin injects into each
and every VM server created, you may need to add the following line into
your /etc/ceilometer/ceilometer.conf file:

reserved_metadata_keys=cluster_id

Also note that to make sure your CPU utilization driven metrics are
evaluated at least once per 60 seconds, you will need to change the
interval value for the cpu_source in the file
/etc/ceilometer/pipeline.yaml. For example, you can change it from
the default value 600 to 60:

After a while after the CPU workloads on cluster nodes are started, you will
notice that the cluster has been automatically scaled. Two new nodes are
created and added to the cluster. This can be verified by running the
following command:

$ openstack cluster show $MYCLUSTER_ID

Optionally, you can use the following command to check if the anticipated
action was triggered and executed: