Today’s goal is to write your first Python script.
You will create a Python script that:
- Takes threshold values (CPU, disk, memory) from user input
- Also fetches system metrics using a Python library (example:
psutil) - Compares metrics against thresholds
- Prints the result to the terminal
This is your first step towards thinking like a DevOps engineer using Python.
- One Python script (example:
system_health.py) - Output should be visible in terminal
- Use:
input()for user inputif / elsefor decision makingforloops where required- Functions to keep the code clean
- Keep the script simple and readable
- Do not over-engineer
- Python installation and setup (from live class)
psutildocumentation: https://pypi.org/project/psutil/- Python basics (inputs, conditions, loops, functions)
DevOps engineers frequently write scripts to:
- Check server health
- Validate system conditions
- Generate reports for monitoring and troubleshooting
This task builds the foundation for automation, monitoring, and reliability.
- Fork the repository
- Add your script inside the
day-01folder - Ensure the script runs successfully
- Commit and push your changes to your fork
Share your progress on LinkedIn:
- Post a small code snippet or a story on how you wrote your first Python Script
- Share the output from the terminal
- Write 2–3 lines on what you learned today (can be a blog article as well)
Optional:
- Tag TrainWithShubham or Shubham Londhe
- Use hashtags:
#PythonForDevOps #TrainWithShubham #DevOpsKaJosh(Helps me to filter post and Like/ Comment / Repost / engage)
Happy Learning TrainWithShubham