The python script collects and prints CPU or Memory information about Linux OS to console.
The script accepts a single parameter cpu or mem and outputs relevant metrics
- python3
- pip
- psutil
- loguru
- Clone repo [email protected]:moonchildua/gl-camp-python.git
- Make executable
chmod +x python3-package.sh
/python3-package.sh
python3 metrics.py mem(or cpu)
$ python3 metrics.py cpu
system.cpu.idle 26024.38
system.cpu.user 14430.91
system.cpu.guest 0.0
system.cpu.iowait 83.7
system.cpu.stolen 0.0
system.cpu.system 4277.
$ python3 metrics.py mem
virtual total 33569067008
virtual used 8036671488
virtual free 2804436992
virtual shared 1528705024
swap total 1023406080
swap used 0
swap free 1023406080
Please install docker before run script in container.
Docker image you can find follow the link
Passing command to the container for execution You can pass the command to the container from the command line:
docker run -t --rm moonchild/gl-camp-python:tagname cpu
docker run -t --rm moonchild/gl-camp-python:tagname mem