1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
{
"stack_name": "$ENVIRON['STACK_NAME']",
"template": {
"heat_template_version": "2013-05-23",
"description": "Integration Test AutoScaling with heat+ceilometer+prometheus+aodh",
"resources": {
"asg": {
"type": "OS::Heat::AutoScalingGroup",
"properties": {
"min_size": 1,
"max_size": 2,
"resource": {
"type": "OS::Nova::Server",
"properties": {
"networks": [{ "network": "$ENVIRON['NEUTRON_NETWORK']" }],
"flavor": "$ENVIRON['NOVA_FLAVOR_REF']",
"image": "$ENVIRON['GLANCE_IMAGE_NAME']",
"metadata": {
"metering.server_group": { "get_param": "OS::stack_id" }
},
"user_data_format": "RAW",
"user_data": {"Fn::Join": ["", [
"#!/bin/sh\n",
"echo 'Loading CPU'\n",
"set -v\n",
"cat /dev/urandom > /dev/null & sleep $ENVIRON['LOAD_LENGTH'] ; kill $! \n"
]]}
}
}
}
},
"web_server_scaleup_policy": {
"type": "OS::Heat::ScalingPolicy",
"properties": {
"adjustment_type": "change_in_capacity",
"auto_scaling_group_id": { "get_resource": "asg" },
"cooldown": 60,
"scaling_adjustment": 1
}
},
"cpu_alarm_high": {
"type": "OS::Aodh::PrometheusAlarm",
"properties": {
"description": "Scale-up if the mean CPU is higher than the threshold",
"threshold": $ENVIRON["AODH_THRESHOLD"],
"comparison_operator": "gt",
"alarm_actions": [
{
"str_replace": {
"template": "trust+url",
"params": {
"url": { "get_attr": [ "web_server_scaleup_policy", "signal_url" ] }
}
}
}
],
"query": $ENVIRON["QUERY"]
}
},
"web_server_scaledown_policy": {
"type": "OS::Heat::ScalingPolicy",
"properties": {
"adjustment_type": "change_in_capacity",
"auto_scaling_group_id": { "get_resource": "asg" },
"cooldown": 60,
"scaling_adjustment": -1
}
},
"cpu_alarm_low": {
"type": "OS::Aodh::PrometheusAlarm",
"properties": {
"description": "Scale-down if the mean CPU is lower than the threshold",
"threshold": $ENVIRON["SCALEDOWN_THRESHOLD"],
"comparison_operator": "lt",
"alarm_actions": [
{
"str_replace": {
"template": "trust+url",
"params": {
"url": { "get_attr": [ "web_server_scaledown_policy", "signal_url" ] }
}
}
}
],
"query": $ENVIRON["QUERY"]
}
}
}
}
}
|