ZStack Cloud支持通过系统登录或第三方API工具(例如Postman)使用HTTP方式调用API创建弹性伸缩组。本文主要以管理员身份(admin)登录管理节点系统,介绍如何创建弹性伸缩组。您也可以使用云平台其他已授权账户/用户身份登录系统创建。
curl -H "Content-Type: application/json;charset=UTF-8" \ -X PUT -d '{"logInByAccount":{"accountName":"admin","password":"b109f3bbbc244eb82441917ed06d618b9008dd09b3befd1b5e07394c706a8bb980b1d7785e5976ec049b46df5f1326af5a2ea6d103fd07c95385ffab0cacbc86" }}' \ http://localhost:8080/zstack/v1/accounts/login其中:{"inventory":{"uuid":"c1475b57580c41df99f3cfe7d17d4286","accountUuid":"36c27e8ff05c4780bf6d2fa65700f22e","userUuid":"36c27e8ff05c4780bf6d2fa65700f22e","expiredDate":"Nov 4, 2022 3:13:56 PM","createDate":"Nov 4, 2022 1:13:56 PM","noSessionEvaluation":false}}其中:curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth c1475b57580c41df99f3cfe7d17d4286" \ -X POST -d '{"params":{"name":"test-group","description":"just for test","scalingResourceType":"VmInstance","minResourceSize":2.0,"maxResourceSize":10.0,"defaultCooldown":60.0,"removalPolicy":"OldestInstance","defaultEnable":false}}' \ http://172.20.18.200:8080/zstack/v1/autoscaling/groups其中:{"inventory":{"name":"test-group","uuid":"9621e83f31944a09b293de9c4d76efa6","scalingResourceType":"VmInstance","state":"Disabled","defaultCooldown":60,"description":"just for test","minResourceSize":2,"maxResourceSize":10,"removalPolicy":"OldestInstance","createDate":"Nov 4, 2022 1:20:01 PM","lastOpDate":"Nov 4, 2022 1:20:01 PM","attachedTemplates":[],"systemTags":[]}}其中:curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth c1475b57580c41df99f3cfe7d17d4286" \ -X POST -d '{"params":{"adjustmentType":"PercentChangeInCapacity","adjustmentValue":1.0,"name":"addingNewInstance","description":"just for test","autoScalingGroupUuid":"9621e83f31944a09b293de9c4d76efa6","cooldown":10.0}}' \ http://localhost:8080/zstack/v1/autoscaling/rules/adding-new-instance其中:{"inventory":{"adjustmentType":"PercentChangeInCapacity","adjustmentValue":1,"type":"AddingNewInstanceRule","description":"just for test","cooldown":10,"state":"Enabled","status":"Created","systemTags":[],"createDate":"Nov 4, 2022 3:13:02 PM","lastOpDate":"Nov 4, 2022 3:13:02 PM","name":"addingNewInstance","uuid":"d5f19827d6f448e69ae79d1c8e65d09c","scalingGroupUuid":"9621e83f31944a09b293de9c4d76efa6","ruleTriggers":[]}}curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth c1475b57580c41df99f3cfe7d17d4286" \ -X POST -d '{"params":{"adjustmentType":"PercentChangeInCapacity","adjustmentValue":1.0,"removalPolicy":"MinimumMemoryUsageInstance","name":"removalInstance","description":"just for test","autoScalingGroupUuid":"9621e83f31944a09b293de9c4d76efa6","cooldown":10.0}}' \ http://localhost:8080/zstack/v1/autoscaling/rules/removal-instance其中:{"inventory":{"removalPolicy":"MinimumMemoryUsageInstance","adjustmentType":"PercentChangeInCapacity","adjustmentValue":1,"type":"RemovalInstanceRule","description":"just for test","cooldown":10,"state":"Enabled","status":"Created","systemTags":[],"createDate":"Nov 4, 2022 1:38:16 PM","lastOpDate":"Nov 4, 2022 1:38:16 PM","name":"removalInstance","uuid":"1bbf6119e90745f8808332ce1715627d","scalingGroupUuid":"9621e83f31944a09b293de9c4d76efa6","ruleTriggers":[]}}curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth c1475b57580c41df99f3cfe7d17d4286" \ -X POST -d '{"params":{"namespace": "ZStack/VM","metricName": "MemoryUsedInPercent","description": "","period": 60,"threshold": 70,"repeatInterval": 60,"comparisonOperator": "GreaterThan","actions": [],"labels": [{"key": "VMUuid","op": "Regex","value": "none"}],"name": "test-Expansion-Strategy-Alarm","type": "Average"}}' \ http://localhost:8080/zstack/v1/zwatch/alarms其中:{"inventory":{"uuid":"1c587aa959dc44faad8130b6e056ff7c","name":"test-Expansion-Strategy-Alarm","description":"","comparisonOperator":"GreaterThan","period":60,"namespace":"ZStack/VM","metricName":"MemoryUsedInPercent","threshold":70.0,"repeatInterval":60,"repeatCount":-1,"status":"OK","state":"Enabled","enableRecovery":false,"createDate":"Nov 4, 2022 3:15:48 PM","lastOpDate":"Nov 4, 2022 3:15:48 PM","labels":[{"uuid":"284828fdd2644c368590577787578298","key":"VMUuid","operator":"Regex","value":"none","alarmUuid":"1c587aa959dc44faad8130b6e056ff7c"}],"actions":[],"emergencyLevel":"Important"}}curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth c1475b57580c41df99f3cfe7d17d4286" \ -X POST -d '{"params":{"name":"Expansion-Strategy-Alarm-Rule","ruleUuid":"1bbf6119e90745f8808332ce1715627d ","alarmUuid":"1c587aa959dc44faad8130b6e056ff7c "}}' \ http://172.20.18.200:8080/zstack/v1/zwatch/alarms/1c587aa959dc44faad8130b6e056ff7c/autoscaling/rules/1bbf6119e90745f8808332ce1715627d其中:{"inventory":{"alarmUuid":"1c587aa959dc44faad8130b6e056ff7c","name":"Expansion-Strategy-Alarm-Rule","uuid":"ecd46ef2a77b4511913d9914d5e043db","type":"Alarm","ruleUuid":"1bbf6119e90745f8808332ce1715627d","state":"Enabled","createDate":"Nov 4, 2022 3:18:40 PM","lastOpDate":"Nov 4, 2022 3:18:40 PM"}}curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth c1475b57580c41df99f3cfe7d17d4286" \ -X POST -d '{"params":{"namespace":"ZStack/VM","metricName":"MemoryUsedInPercent","description":"","period":60,"threshold":70,"repeatInterval":60,"comparisonOperator":"LessThan","actions":[],"labels":[{"key":"VMUuid","op":"Regex","value":"none"}],"name":"Shrinkage-Strategy-Alarm","type":"Average"}}' \ http://172.20.18.200:8080/zstack/v1/zwatch/alarms其中:{"inventory":{"uuid":"caf304f3660e4604808f362238e0099c","name":"Shrinkage-Strategy-Alarm","description":"","comparisonOperator":"LessThan","period":60,"namespace":"ZStack/VM","metricName":"MemoryUsedInPercent","threshold":70.0,"repeatInterval":60,"repeatCount":-1,"status":"OK","state":"Enabled","enableRecovery":false,"createDate":"Nov 4, 2022 2:22:54 PM","lastOpDate":"Nov 4, 2022 2:22:54 PM","labels":[{"uuid":"b9c2ca6bac0f45eba4e40b9faf6569b7","key":"VMUuid","operator":"Regex","value":"none","alarmUuid":"caf304f3660e4604808f362238e0099c"}],"actions":[],"emergencyLevel":"Important"}}curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth 2af952a8dbbf4851a4bd705d2bfbece6" \ -X POST -d '{"params":{"name":"test-Shrinkage-Strategy-Alarm-Rule","ruleUuid":"1bbf6119e90745f8808332ce1715627d","alarmUuid":"caf304f3660e4604808f362238e0099c"}}' \ http://172.20.18.200:8080/zstack/v1/zwatch/alarms/caf304f3660e4604808f362238e0099c/autoscaling/rules/1bbf6119e90745f8808332ce1715627d其中:{"inventory":{"alarmUuid":"caf304f3660e4604808f362238e0099c","name":"test-Shrinkage-Strategy-Alarm-Rule","uuid":"0888ca83ee8748a184d43d4fec02eb2f","type":"Alarm","ruleUuid":"1bbf6119e90745f8808332ce1715627d","state":"Enabled","createDate":"Nov 4, 2022 2:37:39 PM","lastOpDate":"Nov 4, 2022 2:37:39 PM"}}curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth c1475b57580c41df99f3cfe7d17d4286" \ -X POST -d '{"params":{"name":"test","description":"","vmInstanceName":"slb","vmInstanceDescription":"","vmInstanceOfferingUuid":"20bd1274177b4e7fa312ff2ab147cef3","imageUuid":"d8495a014ef34d88aa28c239ccbdbfc3","l3NetworkUuids":["786ddcec73224307929ac2ee63be0955"],"defaultL3NetworkUuid":"786ddcec73224307929ac2ee63be0955","strategy":"InstantStart","type":"UserVm","systemTags":[]},"systemTags":[]}' \ http://172.20.18.200:8080/zstack/v1/autoscaling/vmtemplate其中:{"inventory":{"vmInstanceName":"slb","vmInstanceType":"UserVm","vmInstanceDescription":"","vmInstanceOfferingUuid":"20bd1274177b4e7fa312ff2ab147cef3","imageUuid":"d8495a014ef34d88aa28c239ccbdbfc3","l3NetworkUuids":["786ddcec73224307929ac2ee63be0955"],"dataDiskOfferingUuids":[],"defaultL3NetworkUuid":"786ddcec73224307929ac2ee63be0955","strategy":"InstantStart","uuid":"f8f324a60e7f429aa4cab3d54ac6a823","name":"test","description":"","type":"UserVm","state":"Enabled","createDate":"Nov 4, 2022 2:57:41 PM","lastOpDate":"Nov 4, 2022 2:57:41 PM"}}curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth c1475b57580c41df99f3cfe7d17d4286" \ -X POST -d '{"params":{}}' \ http://localhost:8080/zstack/v1/autoscaling/template/f8f324a60e7f429aa4cab3d54ac6a823/groups/9621e83f31944a09b293de9c4d76efa6其中:{"inventory":{"name":"test-group","uuid":"9621e83f31944a09b293de9c4d76efa6","scalingResourceType":"VmInstance","state":"Disabled","defaultCooldown":60,"description":"just for test","minResourceSize":2,"maxResourceSize":10,"removalPolicy":"OldestInstance","createDate":"Nov 4, 2022 1:20:01 PM","lastOpDate":"Nov 4, 2022 1:20:01 PM","attachedTemplates":["f8f324a60e7f429aa4cab3d54ac6a823"],"systemTags":[]}}curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth c1475b57580c41df99f3cfe7d17d4286" \ -X PUT -d '{"changeAutoScalingGroupState":{"stateEvent":"enable"}}' \ http://localhost:8080/zstack/v1/autoscaling/groups/9621e83f31944a09b293de9c4d76efa6/actions其中:{"inventory":{"name":"test-group","uuid":"9621e83f31944a09b293de9c4d76efa6","scalingResourceType":"VmInstance","state":"Enabled","defaultCooldown":60,"description":"just for test","minResourceSize":2,"maxResourceSize":10,"removalPolicy":"OldestInstance","createDate":"Nov 4, 2022 1:20:01 PM","lastOpDate":"Nov 4, 2022 3:23:18 PM","attachedTemplates":["f8f324a60e7f429aa4cab3d54ac6a823"],"systemTags":[]}}学习路径
ZStack Cloud 产品学习路径
快速梳理文档,点击相应文本链接,快速跳转到相应文档的页面,学习 ZStack Cloud 产品。
业务咨询:
400-962-2212 转 1售后咨询:
400-962-2212 转 2其他(漏洞提交、投诉举报等)
400-962-2212 转 3业务咨询:
400-962-2212 转 1ZStack学院:
training@zstack.io业务咨询:
400-962-2212 转 1售后咨询:
400-962-2212 转 2其他(漏洞提交、投诉举报等)
400-962-2212 转 3业务咨询:
400-962-2212 转 1售后咨询:
400-962-2212 转 2其他(漏洞提交、投诉举报等)
400-962-2212 转 3业务咨询:
400-962-2212 转 1商务联系:
channel@zstack.io业务咨询:
400-962-2212 转 1商务联系:
channel@zstack.io下载链接已发送至您的邮箱。
如未收到,请查看您的垃圾邮件、订阅邮件、广告邮件。 当您收到电子邮件后,请点击 URL 链接,以完成下载。感谢您使用 ZStack 产品和服务。
成功提交申请。
我们将安排工作人员尽快与您取得联系。感谢您使用 ZStack 产品和服务。
信息提交成功。
我们将安排工作人员尽快与您取得联系,请保持电话畅通。感谢您使用 ZStack 产品和服务。
商务咨询:
400-962-2212 转 1售后咨询:
400-962-2212 转 2商务联系:
sales@zstack.io成功提交申请。
我们将安排工作人员尽快与您取得联系。感谢您使用 ZStack 产品和服务。