Ask Your Question
0

Wrong ScalingPolicy alarm_url

asked 2014-09-22 04:48:15 -0600

PatRock gravatar image

I wrote a minimal example for a triggered ScalingGroup, but with the alarm_url is something wrong.

   heat_template_version: 2013-05-23

parameters:
  key:
    type: string
    default: demo-key
  flavor:
    type: string
    default: m1.small
  image:
    type: string
    default: cirros-0.3.2-x86_64
  network:
    type: string
    default: int-net1

resources:
  myServerGroup:
    type: OS::Heat::AutoScalingGroup
    properties:
      max_size: 5
      desired_capacity: 1
      min_size: 1
      resource:
        type: OS::Nova::Server
        properties:
          key_name: {get_param: key}
          image: {get_param: image}
          flavor: {get_param: flavor}
          networks: [ {network: {get_param: network}} ]

  scale_UP_policy:
    type: OS::Heat::ScalingPolicy
    properties:
      adjustment_type: change_in_capacity
      auto_scaling_group_id: { get_resource: myServerGroup }
      cooldown: 10
      scaling_adjustment: 1

outputs:
  UPscalingURL:
    value: {get_attr: [scale_UP_policy, alarm_url]}

The output is: http://controller:8000/v1/signal/arn%3Aopenstack%3Aheat%3A%3Aad948ee0c33749508d76b95f33e7e02d%3Astacks%2Ftest%2F9ec989d2-ce9d-4d73-be6c-06ba7702b60a%2Fresources%2Fscale_UP_policy?Timestamp=2014-09-22T09%3A27%3A52Z&SignatureMethod=HmacSHA256&AWSAccessKeyId=ec9371233baf46bd95b3150ff00f79d4&SignatureVersion=2&Signature=p0zVObaO5wMpniREfOrZs4jfFrCH9UIvfcCmHqG35vM%3D (http://controller:8000/v1/signal/arn%...)

I see that there is html-code in it ( %3A = ":" %2F = "/" ), but how can i fix this? And even when i change all the HTML code to the correct symbols the Link doesn't work.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-09-22 07:56:50 -0600

larsks gravatar image

Preliminaries

First, there is absolutely nothing wrong with finding encoded characters in a URL. If I want to include one URL (say, http://google.com/) as a parameter in another URL, i.e.:

http://example.com/THE_URL

I need to encode the special characters (such as :, /, etc) inside the first URL, giving me something like this:

http://example.com/http%3A%2F%2Fgoogle.com%2F

...and hopefully that explains some of what you're seeing above.

Answers

With that out of the way, the URL that you've posted look entirely valid. You don't say why you believe the URL is invalid, but it is possible you are calling it incorrectly. Given an alarm URL from my own environment:

alarm_url='http://192.168.200.1:8000/v1/signal/arn%3Aopenstack%3Aheat%3A%...'

If I naively try to call that using curl I get an error:

curl "$alarm_url"
HTTP/1.1 403 AccessDenied
Content-Type: application/xml; charset=UTF-8
Content-Length: 149
Date: Mon, 22 Sep 2014 12:55:48 GMT

<ErrorResponse><Error>
<Message>User is not authorized to perform action</Message>
<Code>AccessDenied</Code>
<Type>Sender</Type>
</Error></ErrorResponse>

That's because Heat expects a POST request:

$ curl -XPOST -i "$alarm_url"
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Content-Length: 0
Date: Mon, 22 Sep 2014 12:56:22 GMT

And that successfully triggers the scaling policy.

edit flag offensive delete link more

Comments

"$ curl -XPOST -i http://10.0.100.77:8000/v1/signal/....%22 (http://10.0.100.77:8000/v1/signal/....")

"$ curl: (7) couldn't connect to host"

Do i need to add some special rules to the security groups?

I have allready allowed TCP at Port 8000 for 0.0.0.0/0

PatRock gravatar imagePatRock ( 2014-09-22 10:16:15 -0600 )edit

Is 10.0.100.77 the appropriate ip address for the instance to use? You can change the address used in these URLs via the heat_metadata_server_url option in /etc/heat/heat.conf. Is something actually listening on port 8000 on that host? You must be running the heat-api-cfn service.

larsks gravatar imagelarsks ( 2014-09-22 10:37:33 -0600 )edit

ok i changed the ip adress and added some Ceilometer::Alarms to it. Now it scales up and down. Thank you for your help.

PatRock gravatar imagePatRock ( 2014-09-23 02:01:33 -0600 )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-09-22 04:48:15 -0600

Seen: 787 times

Last updated: Sep 22 '14