解决腾讯云按量ECS采集失败

This commit is contained in:
StarsL.cn 2022-04-21 15:33:03 +08:00
parent df58f61bea
commit b0eea76655
1 changed files with 2 additions and 1 deletions

View File

@ -71,7 +71,8 @@ def ecs(account,region):
ecs_dict_temp = {i.InstanceId:{'name':i.InstanceName,'group':group_dict.get(str(i.Placement.ProjectId),''),
'ostype': 'windows' if 'win' in i.OsName.lower() else 'linux',
'status': i.InstanceState, 'region': region, 'ip':i.PrivateIpAddresses[0],
'cpu': f'{i.CPU}','mem': f'{i.Memory}GB','exp': i.ExpiredTime.split('T')[0]
'cpu': f'{i.CPU}','mem': f'{i.Memory}GB',
'exp': '按量' if i.ExpiredTime is None else i.ExpiredTime.split('T')[0]
} for i in ecs_list}
offset = offset + 100
ecs_dict.update(ecs_dict_temp)