Browse Source

Update awscloud.py

修复AWS CPU计算错误bug
pull/131/head
Yvan 3 months ago committed by GitHub
parent
commit
1069d0f57a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      flask-consul/units/cloud/awscloud.py

4
flask-consul/units/cloud/awscloud.py

@ -11,7 +11,7 @@ def exp(account,collect_days,notify_days,notify_amount):
def group(account):
try:
now = datetime.datetime.now().strftime('%m.%d/%H:%M')
现在 = datetime.datetime.now().strftime('%m.%d/%H:%M')
group_dict = {"1": "1"} # AWS没有资产组概念
consul_kv.put_kv(f'ConsulManager/assets/awscloud/group/{account}',group_dict)
count = len(group_dict)
@ -60,7 +60,7 @@ def ecs(account,region,isextip=False):
ecs_dict_temp[InstanceId]["status"] = instances["State"]["Name"]
ecs_dict_temp[InstanceId]["region"] = region
ecs_dict_temp[InstanceId]["ip"] = instances["PrivateIpAddress"]
ecs_dict_temp[InstanceId]["cpu"] = f'{instances["CpuOptions"]["CoreCount"]}'
ecs_dict_temp[InstanceId]["cpu"] = f'{instances["CpuOptions"]["CoreCount"]*instances["CpuOptions"]["ThreadsPerCore"]}'
ecs_dict_temp[InstanceId]["mem"] = ""
ecs_dict_temp[InstanceId]["exp"] = "按量" # AWS仅按量
if isextip:

Loading…
Cancel
Save