77 lines
2.0 KiB
YAML
77 lines
2.0 KiB
YAML
heat_template_version: 2013-05-23
|
|
|
|
parameters:
|
|
KeyName:
|
|
type: string
|
|
InstanceType:
|
|
type: string
|
|
ImageId:
|
|
type: string
|
|
SecurityGroup:
|
|
type: string
|
|
Subnet:
|
|
type: string
|
|
|
|
resources:
|
|
my_asg:
|
|
type: OS::Heat::AutoScalingGroup
|
|
properties:
|
|
resource:
|
|
type: OS::Nova::Server
|
|
properties:
|
|
metadata: {"metering.stack": {get_param: "OS::stack_id"}}
|
|
key_name: { get_param: KeyName }
|
|
image: { get_param: ImageId }
|
|
flavor: { get_param: InstanceType }
|
|
security_groups:
|
|
- get_param: SecurityGroup
|
|
networks:
|
|
- network: {get_param: Subnet}
|
|
min_size: 1
|
|
max_size: 2
|
|
|
|
scale_up_policy:
|
|
type: OS::Heat::ScalingPolicy
|
|
properties:
|
|
adjustment_type: change_in_capacity
|
|
auto_scaling_group_id: {get_resource: my_asg}
|
|
cooldown: 60
|
|
scaling_adjustment: 1
|
|
|
|
scale_down_policy:
|
|
type: OS::Heat::ScalingPolicy
|
|
properties:
|
|
adjustment_type: change_in_capacity
|
|
auto_scaling_group_id: {get_resource: my_asg}
|
|
cooldown: 60
|
|
scaling_adjustment: '-1'
|
|
|
|
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: [scale_up_policy, alarm_url]}
|
|
matching_metadata: {'metadata.user_metadata.stack': {get_param: "OS::stack_id"}}
|
|
comparison_operator: gt
|
|
|
|
cpu_alarm_low:
|
|
type: OS::Ceilometer::Alarm
|
|
properties:
|
|
description: Scale-down if the average CPU < 15% for 1 minutes
|
|
meter_name: cpu_util
|
|
statistic: avg
|
|
period: 60
|
|
evaluation_periods: 1
|
|
threshold: 15
|
|
alarm_actions:
|
|
- {get_attr: [scale_down_policy, alarm_url]}
|
|
matching_metadata: {'metadata.user_metadata.stack': {get_param: "OS::stack_id"}}
|
|
comparison_operator: lt
|
|
|