settingsLogin | Registersettings

[Openstack] [Ceilometer/Heat] correct format of webhook for alarm-action

0 votes

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?


--alarm-action
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.

Thanks in advance,
Gary


Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
asked Aug 21, 2014 in openstack by Duan,_Li-Gong_(Gary_ (660 points)   1 2

6 Responses

0 votes

On Thu, Aug 21, 2014 at 09:37:57AM +0000, Duan, Li-Gong (Gary@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

       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

responded Aug 22, 2014 by Steven_Hardy (16,900 points)   2 7 13
0 votes

"Duan, Li-Gong (Gary@HPServers-Core-OE-PSC)" li-gong.duan@hp.com wrote
on 08/21/2014 05:37:57 AM:

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?

Steve's reply pointed to an example of usage. If you just want to see
what the URL looks like, see the examples in patch set 11 of
https://review.openstack.org/#/c/97366/ --- they include such URLs among
the stack outputs.

Regards,
Mike

responded Aug 22, 2014 by Mike_Spreitzer (8,200 points)   2 11 21
0 votes

Hi Steve,

Thanks for your reply.
What I want to do is to define alarm action which will trigger heat to launch a stack, like executing "heat stack-create...".
And by doing this, once the condition of the alarm is met(alarm in ceilometer is triggered), the heat stack will automatically created/launched, as defined in ceilometer action.

If so, the alarms defined in ceilometer and actions(heat workflow) can be associated.
My current issue is how to specify the webhook URL for launching a heat stack in ceilometer alarm action.

If it is impossible, I have to specify alarm and policy in heat template.

Regards,
Gary

-----Original Message-----
From: Steven Hardy [mailto:shardy@redhat.com]
Sent: Friday, August 22, 2014 4:04 PM
To: Duan, Li-Gong (Gary@HPServers-Core-OE-PSC)
Cc: openstack@lists.openstack.org
Subject: Re: [Openstack] [Ceilometer/Heat] correct format of webhook for
alarm-action

On Thu, Aug 21, 2014 at 09:37:57AM +0000, Duan, Li-Gong (Gary@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

       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/a
utoscaling.py#L1028

Steve


Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
responded Aug 27, 2014 by Duan,_Li-Gong_(Gary_ (660 points)   1 2
0 votes

Hi Mike,

Thanks a lot for pointing the examples.
They are very helpful for me to understand what URL looks like.

Regards,
Gary

From: Mike Spreitzer [mailto:mspreitz@us.ibm.com]
Sent: Friday, August 22, 2014 10:19 PM
To: Duan, Li-Gong (Gary@HPServers-Core-OE-PSC)
Cc: openstack@lists.openstack.org
Subject: Re: [Openstack] [Ceilometer/Heat] correct format of webhook for alarm-action

"Duan, Li-Gong (Gary@HPServers-Core-OE-PSC)" li-gong.duan@hp.com wrote on 08/21/2014 05:37:57 AM:

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?

Steve's reply pointed to an example of usage. If you just want to see what the URL looks like, see the examples in patch set 11 of https://review.openstack.org/#/c/97366/ --- they include such URLs among the stack outputs.

Regards,
Mike


Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
responded Aug 27, 2014 by Duan,_Li-Gong_(Gary_ (660 points)   1 2
0 votes

On Wed, Aug 27, 2014 at 10:04:53AM +0000, Duan, Li-Gong (Gary@HPServers-Core-OE-PSC) wrote:
Hi Steve,

Thanks for your reply.
What I want to do is to define alarm action which will trigger heat to launch a stack, like executing "heat stack-create...".
And by doing this, once the condition of the alarm is met(alarm in ceilometer is triggered), the heat stack will automatically created/launched, as defined in ceilometer action.

If so, the alarms defined in ceilometer and actions(heat workflow) can be associated.
My current issue is how to specify the webhook URL for launching a heat stack in ceilometer alarm action.

The only way to do this using only Heat and Ceilometer (as opposed to some
other service handling the alarm then calling Heat) is to use the
OS::Heat::AutoScalingGroup resource, which could be created with an initial
size of zero, then be triggered by ceilometer to scale up (which would be
basically the same as a stack-create on the nested template).

If it is impossible, I have to specify alarm and policy in heat template.

I think that at the least you will need to define the ScalingPolicy
resource in the template, as that is the thing which provides the URL you
can pass to ceilometer.

There is no way to have ceilometer directly interact with heat to create
the stack, as previously mentioned, because it can't provide the necessary
data to create the stack (therefore you have to define it in the template
as described above).

responded Aug 27, 2014 by Steven_Hardy (16,900 points)   2 7 13
0 votes

BTW, I also have a change in review that enhances the existing
autoscaling.yaml example template to include the webhooks in the stack
outputs. This example has the additional virtue of including the
Ceilometer alarms as well as the scaling actions they invoke. See
https://review.openstack.org/#/c/116490/

Regards,
Mike

From: "Duan, Li-Gong (Gary@HPServers-Core-OE-PSC)" li-gong.duan@hp.com
To: Mike Spreitzer/Watson/IBM@IBMUS,
Cc: "openstack@lists.openstack.org" openstack@lists.openstack.org
Date: 08/27/2014 06:09 AM
Subject: RE: [Openstack] [Ceilometer/Heat] correct format of
webhook for alarm-action

Hi Mike,

Thanks a lot for pointing the examples.
They are very helpful for me to understand what URL looks like.

Regards,
Gary

From: Mike Spreitzer [mailto:mspreitz@us.ibm.com]
Sent: Friday, August 22, 2014 10:19 PM
To: Duan, Li-Gong (Gary@HPServers-Core-OE-PSC)
Cc: openstack@lists.openstack.org
Subject: Re: [Openstack] [Ceilometer/Heat] correct format of webhook for
alarm-action

"Duan, Li-Gong (Gary@HPServers-Core-OE-PSC)" li-gong.duan@hp.com wrote
on 08/21/2014 05:37:57 AM:

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?

Steve's reply pointed to an example of usage. If you just want to see
what the URL looks like, see the examples in patch set 11 of
https://review.openstack.org/#/c/97366/ --- they include such URLs among
the stack outputs.

Regards,
Mike


Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
responded Aug 27, 2014 by Mike_Spreitzer (8,200 points)   2 11 21
...