[Openstack] [Ceilometer/Heat] correct format of webhook for alarm-action
Steven Hardy
shardy at redhat.com
Fri Aug 22 08:04:08 UTC 2014
On Thu, Aug 21, 2014 at 09:37:57AM +0000, Duan, Li-Gong (Gary at HPServers-Core-OE-PSC) wrote:
> Hi Folks,
>
>
> For the "ceilometer alarm-threshold-create" cmd, what is the correct
> format of the webhook URL for alarm action, if I want to trigger a
> template in Heat to be executed once this alarm is notified? Are there any
> example of invoking heat template?
Can you explain what you mean by "invoking heat template" in more detail
please?
The URL is expected to be the pre-signed signal URL provided by some heat
resources, e.g the ScalingPolicy resources for AutoScaling.
> -----------------------------
>
> --alarm-action <Webhook URL>
>
> URL to invoke when state transitions to alarm. May be used
> multiple times. Defaults to None.
>
> ----------------------------
>
> I "google"ed for this, but most are related to Heat autoscaling and the
> alarm is defined in Heat template directly.
That is the primary use-case, if you want heat to spin up a new stack in
response to an alarm, the best way to do that is probably via
OS::Heat::AutoScalingGroup, which can scale out heat stacks, here's an
example:
https://github.com/openstack/heat-templates/blob/master/hot/autoscaling.yaml#L65
This will scale out the "lb_server.yaml" template each time ceilometer
posts to the pre-signed URL provided by the OS::Heat::ScalingPolicy
resource:
https://github.com/openstack/heat-templates/blob/master/hot/autoscaling.yaml#L118
However if what you actually want is for ceilometer to spin up a stack by
interacting with the heat API directly triggering the stack create, then I
think currently that is not possible, even if you were to create a
pre-signed stack create call for the heat-api-cfn.
This is because ceilometer inserts a pre-determined request body, which
will only work with the handle_signal methods of the resources which expect
to handle alarm signals from ceilometer:
https://github.com/openstack/heat/blob/master/heat/engine/resources/autoscaling.py#L1028
Steve
More information about the Openstack
mailing list