¿ù°£ Àα⠰Խù°

°Ô½Ã¹° 715°Ç
   
HEAT API Âü°í
±Û¾´ÀÌ : ÃÖ°í°ü¸®ÀÚ ³¯Â¥ : 2016-01-19 (È­) 14:56 Á¶È¸ : 3309
                                
Heat Stack »ý¼º
heat stack-create -f ${ÂüÁ¶ÆÄÀϸí} -P flavor='${FLAVOR_ID}' -P image='${IMAGE_ID}' -P public_net_id='${¿ÜºÎ³×Æ®¿öÅ©ID}' ${HEAT_STACKNAME}

EX) CMD
root@controller:~# heat stack-create -f autoscailing.yaml -P flavor='IWINV.SINGLE' -P image='302f7646-acdc-4895-b1b9-3d45ca2be637' -P public_net_id='4b10f8a3-f9c1-4cbd-9a26-93b37c3051d4^CAutoscailing_1

API
# curl -g -i -X POST http://controller:8004/v1/3617c692ea1b4886b16ae77d5cbc3fb0/stacks -H "User-Agent: python-heatclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}630289cc2a58e3f9cc8ba4c6049e0b4b72b8262a" -d '{"files": {}, "disable_rollback": true, "parameters": {"flavor": "IWINV.SINGLE", "public_net_id": "e2f0d382-3a9d-4ddd-aa8c-bb5c660d57df", "image": "6137bff9-c30a-483b-a64f-a7141ea985cb"}, "stack_name": "Autoscailing_1", "environment": {}, "template": {"outputs": {"scale_dn_url": {"description": "Webhook URL to scale down the group. You can invoke the scale-down operation by doing an HTTP POST to this URL.\n", "value": {"get_attr": ["scale_down_policy", "alarm_url"]}}, "scale_up_url": {"description": "Webhook URL to scale up the group. You can invoke the scale-up operation by doing an HTTP POST to this URL.\n", "value": {"get_attr": ["scale_up_policy", "alarm_url"]}}, "server_list": {"description": "List of server names that are part of the group.\n", "value": {"get_attr": ["asg", "outputs_list", "name"]}}}, "heat_template_version": "2015-10-15", "description": "This is a very simple template that illustrates automatic scaling up and down using OS::Heat::AutoScalingGroup. CPU load is generated for 15 mins after each instance is spawned, triggering a scale-up event. Once the max number of instances has been reached and the CPU load generation has finished, the number of instances will be scaled back down to 1.\n", "parameters": {"flavor": {"default": "IWINV.SINGLE", "type": "string", "description": "Flavor of the servers"}, "public_net_id": {"default": "4b10f8a3-f9c1-4cbd-9a26-93b37c3051d4", "type": "string", "description": "ID of the public network to use", "label": "Public network ID"}, "image": {"default": "302f7646-acdc-4895-b1b9-3d45ca2be637", "type": "string", "description": "Image used to boot the servers"}}, "resources": {"cpu_alarm_high": {"type": "OS::Ceilometer::Alarm", "properties": {"meter_name": "cpu_util", "alarm_actions": [{"get_attr": ["scale_up_policy", "alarm_url"]}], "description": "Scale-up if the average CPU > 50% for 1 minute", "matching_metadata": {"metadata.user_metadata.stack": {"get_param": "OS::stack_id"}}, "evaluation_periods": 1, "period": 60, "statistic": "avg", "threshold": 50, "comparison_operator": "gt"}}, "scale_up_policy": {"type": "OS::Heat::ScalingPolicy", "properties": {"auto_scaling_group_id": {"get_resource": "asg"}, "adjustment_type": "change_in_capacity", "scaling_adjustment": 1, "cooldown": 60}}, "router_interface": {"type": "OS::Neutron::RouterInterface", "properties": {"router_id": {"get_resource": "router"}, "subnet_id": {"get_resource": "private_subnet"}}}, "cpu_alarm_low": {"type": "OS::Ceilometer::Alarm", "properties": {"meter_name": "cpu_util", "alarm_actions": [{"get_attr": ["scale_down_policy", "alarm_url"]}], "description": "Scale-down if the average CPU < 15% for 10 minutes", "matching_metadata": {"metadata.user_metadata.stack": {"get_param": "OS::stack_id"}}, "evaluation_periods": 1, "period": 60, "statistic": "avg", "threshold": 15, "comparison_operator": "lt"}}, "asg": {"depends_on": "private_subnet", "type": "OS::Heat::AutoScalingGroup", "properties": {"min_size": 1, "resource": {"type": "OS::Nova::Server", "properties": {"user_data_format": "RAW", "image": {"get_param": "image"}, "metadata": {"metering.stack": {"get_param": "OS::stack_id"}}, "user_data": {"get_resource": "cloud_config_stress"}, "flavor": {"get_param": "flavor"}, "networks": [{"network": {"get_resource": "private_net"}}]}}, "max_size": 3}}, "private_subnet": {"type": "OS::Neutron::Subnet", "properties": {"network_id": {"get_resource": "private_net"}, "cidr": "172.16.0.0/24", "dns_nameservers": ["8.8.8.8", "8.8.4.4"], "name": "private_subnet", "enable_dhcp": true}}, "private_net": {"type": "OS::Neutron::Net", "properties": {"name": "private_net", "admin_state_up": true}}, "cloud_config_stress": {"type": "OS::Heat::CloudConfig", "properties": {"cloud_config": {"package_update": true, "packages": ["stress"], "runcmd": ["stress --cpu 1 --timeout 15m"]}}}, "router": {"type": "OS::Neutron::Router", "properties": {"name": "router", "admin_state_up": true}}, "scale_down_policy": {"type": "OS::Heat::ScalingPolicy", "properties": {"auto_scaling_group_id": {"get_resource": "asg"}, "adjustment_type": "change_in_capacity", "scaling_adjustment": "-1", "cooldown": 60}}, "router_gw": {"type": "OS::Neutron::RouterGateway", "properties": {"network_id": {"get_param": "public_net_id"}, "router_id": {"get_resource": "router"}}}}}}'



CPU ºÎÇÏÀ² ¼öÄ¡È®ÀÎ
root@controller:~# ceilometer --debug sample-list -q 'resource_id=${RESOURCE_ID}' -m cpu_util

root@controller:~# ceilometer alarm-list
+--------------------------------------+--------------------------------------------+-------------------+----------+---------+------------+--------------------------------+------------------+
| Alarm ID                             | Name                                       | State             | Severity | Enabled | Continuous | Alarm condition                | Time constraints |
+--------------------------------------+--------------------------------------------+-------------------+----------+---------+------------+--------------------------------+------------------+
| 056c42bc-2c0f-4616-9a96-2e6592747497 | Autoscailing_1-cpu_alarm_low-gqwsmrn2bdk3  | insufficient data | low      | True    | True       | cpu_util < 15.0 during 1 x 60s | None             |
| 9c683fd6-45fc-4226-a4f2-46ea3d0a77c3 | Autoscailing_1-cpu_alarm_high-2x3miz3vtpdo | insufficient data | low      | True    | True       | cpu_util > 50.0 during 1 x 60s | None             |
+--------------------------------------+--------------------------------------------+-------------------+----------+---------+------------+--------------------------------+------------------+


À̸§ Æнº¿öµå
ºñ¹Ð±Û (üũÇÏ¸é ±Û¾´À̸¸ ³»¿ëÀ» È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.)
¿ÞÂÊÀÇ ±ÛÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä.
   

 



 
»çÀÌÆ®¸í : ¸ðÁö¸®³× | ´ëÇ¥ : ÀÌ°æÇö | °³ÀÎÄ¿¹Â´ÏƼ : ·©Å°´åÄÄ ¿î¿µÃ¼Á¦(OS) | °æ±âµµ ¼º³²½Ã ºÐ´ç±¸ | ÀüÀÚ¿ìÆí : mojily°ñ¹ðÀÌchonnom.com Copyright ¨Ï www.chonnom.com www.kyunghyun.net www.mojily.net. All rights reserved.