This lab guides the student through Python examples that utilize metrics gathered from Prometheus. The Python Sci-Learn library is used for a Linear Regression example.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Install pip3.
The command to install pip3 is:
sudo apt install python3-pip
- Install Sci-Kit and Pandas Python modules.
Use the pip3 command to install Sci-Kit Learn:
pip3 install scikit-learn
And:
pip3 install pandas
- Review and run the check.py program.
To review the code, you can navigate to the GitHub repository and view the
check.py
file. The link is:https://github.com/linuxacademy/content-aiops-essentials/blob/master/check.py
The command to run the program is:
python3 check.py
- Review and run the predictcpu.py and predictmem.py programs.
To review the programs, you may use the following links:
For
predictcpu
:https://github.com/linuxacademy/content-aiops-essentials/blob/master/predictcpu.py
For
predictmem
:https://github.com/linuxacademy/content-aiops-essentials/blob/master/predictmem.py
To run the programs, the command is:
python3 predictcpu.py
And:
python3 predictmem.py
- Change the number of replicas to project.
To change the number of replicas to project, edit the following file:
[vi or nano] promql2.csv
And then change the data column for replicas to the values you want to project.