Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error reporting memory and CPU resources in scripts/malcolm_kubernetes.py #467

Closed
mmguero opened this issue May 1, 2024 · 0 comments
Closed
Assignees
Labels
bug Something isn't working cloud Relating to deployment of Malcolm in the cloud and/or with Kubernetes
Milestone

Comments

@mmguero
Copy link
Collaborator

mmguero commented May 1, 2024

transferred from cisagov#299, thanks to @ya0guang

Here is a code snippet in function pod_stats:


                cpu = 0
                mem = 0
                cpu_mem = stats_api.get_namespaced_custom_object(
                    "metrics.k8s.io", "v1beta1", namespace, "pods", pod_name
                )
                for c in cpu_mem['containers']:
                    if c['usage']['cpu'] == '0':
                        pass
                    else:
                        cpu = +int(c['usage']['cpu'][:-1])
                cpu = str(cpu) + 'n'
                cpu = _nanocore_to_millicore(cpu)
                for m in cpu_mem['containers']:
                    mem = +int(m['usage']['memory'][:-2])
                mem = str(mem) + 'Ki'
                mem = _to_gibibyte_or_mebibyte(mem)

Should cpu = +int(c['usage']['cpu'][:-1]) be cpu += int(c['usage']['cpu'][:-1])? Similarly, mem = +int(m['usage']['memory'][:-2]) may also be mem += int(m['usage']['memory'][:-2])?


@mmguero mmguero added the bug Something isn't working label May 1, 2024
@mmguero mmguero self-assigned this May 1, 2024
@mmguero mmguero added the cloud Relating to deployment of Malcolm in the cloud and/or with Kubernetes label May 1, 2024
@mmguero mmguero added this to the v24.05.0 milestone May 1, 2024
mmguero added a commit to mmguero-dev/Malcolm that referenced this issue May 1, 2024
@mmguero mmguero closed this as completed May 1, 2024
This was referenced May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cloud Relating to deployment of Malcolm in the cloud and/or with Kubernetes
Projects
Status: Released
Development

No branches or pull requests

1 participant