[Python] Host machine's CPU and other metrices from docker container python

Discussão em 'Python' iniciado por Stack, Junho 30, 2025.

  1. Stack

    Stack Membro Participativo

    I would like to get windows host machine's CPU memory usage from a docker container (for monitoring purpose). I have bind-mount host directory and getting memory usage via psutil like:

    Total_host_disk_space_gb=psutil.disk_usage(docker_root_mounted_folder)[0]/(1024*1024*1024)}
    used_host_disk_space_gb=psutil.disk_usage(docker_root_mounted_folder)[0]/(1024*1024*1024)}
    #where docker_root_mounted_folder is the docker dir where I mounted host


    I am not able to get CPU usage etc. I tried psutil but no luck. Help is appreciate. Thanks.

    Continue reading...

Compartilhe esta Página