Ask Your Question
0

heat template alarm

asked 2014-10-01 06:56:35 -0500

PatRock gravatar image

so i wrote a Heat Template with a simple alarm that triggers my upscaling Policy when the CPU is above 75% for 60s. It works fine, but i never thought about what CPU the alarm monitors. Is it the CPU of the Instance thats upscaled? (I don't think so because i haven't define a instance in the alarm) or is it the CPU of all Resources in the Stack? so when my Main Server is fully occupied but the other Resources are fine there will be no new instance?

  CPU_Alarm_HIGH:
    type: OS::Ceilometer::Alarm
    properties:
      meter_name: cpu_util
      statistic: avg
      period: 60
      evaluation_periods: 1
      threshold: 75
      alarm_actions:
        - {get_attr: [Scale_UP_Policy, alarm_url]}
      comparison_operator: gt
edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
2

answered 2014-10-01 08:25:40 -0500

larsks gravatar image

When you create an alarm, you need to tell Ceilometer what resources to monitor. With the alarm in your question, Ceilometer will be looking at all values of the cpu_util meter (and then averaging them), which is probably not what you want.

You would typically use the matching_metadata property to provide Ceilometer with information about which values to consider. For example:

cpu_alarm_high:
  type: OS::Ceilometer::Alarm
  properties:
    description: Scale-up if the average CPU > 50% for 1 minute
    meter_name: cpu_util
    statistic: avg
    period: 60
    evaluation_periods: 1
    threshold: 50
    alarm_actions:
      - get_attr:
      - web_server_scaleup_policy
      - alarm_url
    matching_metadata:
      'metadata.user_metadata.stack': {get_param: "OS::stack_id"}
    comparison_operator: gt

You need to explicitly add this metadata to the things you want to monitor.

This alarm will only consider values for resources that have a stack metadata matching the value of the OS::stack_id parameter (which is a "virtual parameter" provided by Heat that contains the stack UUID).

You need to explicitly add this metadata to things you wish to monitor. For the above alarm definition, we might create instances like this:

server:
  type: OS::Nova::Server
  properties:
    metadata: {"metering.stack": {get_param: "OS::stack_id"}}

I ran a hangout on Heat last month that has this example (and others) in more detail. You can find the examples templates and slide sources here:

You can see the hangout itself here:

edit flag offensive delete link more

Comments

Thank you for the answer and the additional information.

PatRock gravatar imagePatRock ( 2014-10-01 08:38:02 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2014-10-01 06:56:35 -0500

Seen: 1,269 times

Last updated: Oct 01 '14