Skip to content

Commit

Permalink
improve quota output info
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-luna-valero committed Oct 16, 2024
1 parent cd23c96 commit 1292cb3
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions fedcloud_vm_monitoring/site_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,13 +390,18 @@ def show_quotas(self):
if r["Resource"] in resources:
if r["Resource"] == "ram":
quota_info["ram (GB)"] = {
"In Use": int(r["In Use"] / 1024),
"Limit": int(r["Limit"] / 1024)
}
"In Use": int(r["In Use"] / 1024),
"Limit": int(r["Limit"] / 1024)
}
else:
quota_info[r["Resource"]] = {"In Use": r["In Use"], "Limit": r["Limit"]}
for k, v in quota_info.items():
click.echo(f" {k:<14} = {v}")
click.echo(" {:<14} = Limit: {:>3}, Used: {:>3} ({}%)".format(
k,
v["Limit"],
v["In Use"],
round(v["In Use"]/v["Limit"]*100)
))
# checks on quota
if quota_info.get("ram (GB)").get("Limit", 1) / quota_info.get("cores").get("Limit", 1) < self.min_ram_cpu_ratio:
click.secho(
Expand Down

0 comments on commit 1292cb3

Please sign in to comment.