cms-grafana-builder icon indicating copy to clipboard operation
cms-grafana-builder copied to clipboard

获取 ecs 失败, 已给账号所有读权限了

Open oslet opened this issue 5 years ago • 5 comments

环境: ubuntu 18.04 python: 3.6.9

我这边除了 mongodb 没有实例外, 其它都有, ecs 有经典网络与vpc网络, 是否在获取地址这里报错了 ?

执行 cms refresh, 提示如下

refresh all init DB 请求阿里云失败,%s 'NetworkInterfaces' 获取ECS信息失败,%s near "None": syntax error refresh info of rds rowcount = 32 refresh info of slb rowcount = 34 refresh info of eip rowcount = 114 refresh info of redis rowcount = 9 refresh info of mongodb 获取mongodb信息失败,incomplete input refresh all init DB 请求阿里云失败,%s 'NetworkInterfaces' 获取ECS信息失败,%s near "None": syntax error refresh info of rds rowcount = 32 refresh info of slb rowcount = 34 refresh info of eip rowcount = 114 refresh info of redis rowcount = 9 refresh info of mongodb 获取mongodb信息失败,incomplete input

oslet avatar May 21 '20 01:05 oslet

可能是经典网络ECS的原因,我这里没有经典网络的实例,可能是API结构有问题

sunny0826 avatar May 21 '20 02:05 sunny0826

我修复一下

sunny0826 avatar May 21 '20 02:05 sunny0826

测试确实是 经典网络 ecs 获取不到的问题, 非常感谢

oslet avatar May 21 '20 02:05 oslet

好像现在已经买不到经典网络的ECS了,你能把API的输出格式让我看下吗?https://api.aliyun.com/?#/?product=Ecs&search=DescribeInstances&api=DescribeInstances 上面,结构类似

{
	"Instances": {
		"Instance": [
			{
				"ResourceGroupId": "rg-231321321",
				"Memory": 8192,
				"InstanceChargeType": "PrePaid",
				"Cpu": 4,
				"OSName": "CentOS  7.6 64位",
				"InstanceNetworkType": "vpc",
				"InnerIpAddress": {
					"IpAddress": []
				},
				"ExpiredTime": "20T16",
				"ImageId": "centos_7_06_64_20G_alibase_20190711.vhd",
				"EipAddress": {
					"AllocationId": "",
					"IpAddress": "",
					"InternetChargeType": ""
				},
				"HostName": "1231321321321",
				"Tags": {},
                                  ...

请把敏感信息脱敏处理

sunny0826 avatar May 21 '20 02:05 sunny0826

{
	"Instances": {
		"Instance": [
			{
				"ResourceGroupId": "",
				"Memory": 4096,
				"InstanceChargeType": "PrePaid",
				"Cpu": 2,
				"OSName": "CentOS  6.8 64位",
				"InstanceNetworkType": "classic",
				"InnerIpAddress": {
					"IpAddress": [
						"10.82.12.53"
					]
				},
				"ExpiredTime": "2020-06-12T16:00Z",
				"ImageId": "m-bp14s0hny0qmonti",
				"EipAddress": {
					"AllocationId": "",
					"IpAddress": "",
					"InternetChargeType": ""
				},
				"HostName": "iZbp1d0jk52vw62caZ",
				"VlanId": "",
				"Status": "Running",
				"MetadataOptions": {
					"HttpTokens": "",
					"HttpEndpoint": ""
				},
				"InstanceId": "i-bp1d0jkped5b52vw62ca",
				"StoppedMode": "Not-applicable",
				"CpuOptions": {
					"Numa": ""
				},
				"StartTime": "2020-02-19T23:33Z",
				"DeletionProtection": false,
				"SecurityGroupIds": {
					"SecurityGroupId": [
						"sg-23t95p"
					]
				},
				"VpcAttributes": {
					"PrivateIpAddress": {
						"IpAddress": []
					},
					"VpcId": "",
					"VSwitchId": "",
					"NatIpAddress": ""
				},
				"InternetChargeType": "PayByTraffic",
				"InstanceName": "redis001",
				"DeploymentSetId": "",
				"InternetMaxBandwidthOut": 20,
				"SerialNumber": "fcfba297-9026-4ef6-83b9-b22544b9b05b",
				"OSType": "linux",
				"CreationTime": "2018-10-31T15:11Z",
				"AutoReleaseTime": "",
				"Description": "",
				"InstanceTypeFamily": "ecs.n4",
				"DedicatedInstanceAttribute": {
					"Tenancy": "",
					"Affinity": ""
				},
				"PublicIpAddress": {
					"IpAddress": [
						"119.30.103.152"
					]
				},
				"GPUSpec": "",
				"SpotPriceLimit": 0,
				"DeviceAvailable": true,
				"SaleCycle": "",
				"InstanceType": "ecs.n4.large",
				"OSNameEn": "CentOS  6.8 64 bit",
				"SpotStrategy": "NoSpot",
				"IoOptimized": true,
				"ZoneId": "cn-hangzhou-b",
				"ClusterId": "",
				"EcsCapacityReservationAttr": {
					"CapacityReservationPreference": "",
					"CapacityReservationId": ""
				},
				"DedicatedHostAttribute": {
					"DedicatedHostId": "",
					"DedicatedHostName": ""
				},
				"GPUAmount": 0,
				"OperationLocks": {
					"LockReason": []
				},
				"InternetMaxBandwidthIn": 500,
				"Recyclable": false,
				"RegionId": "cn-hangzhou",
				"CreditSpecification": ""
			},

oslet avatar May 21 '20 09:05 oslet