diff --git a/Basic-python-program.py b/Basic-python-program.py new file mode 100644 index 00000000..55517250 --- /dev/null +++ b/Basic-python-program.py @@ -0,0 +1,19 @@ +import smtplib +import psutil + +# 1. Check the CPU usage +cpu_usage = psutil.cpu_percent(interval=1) + +# 2. Trigger email if it exceeds the limit +if cpu_usage > 80.0: + # Setup the connection + server = smtplib.SMTP('://gmail.com', 587) + server.starttls() + server.login('abc@gmail.com', 'password') + + # Send the raw message + subject = "Subject: CPU Alert\n\n" + body = f"CPU usage is high: {cpu_usage}%" + server.sendmail('abc@gmail.com', 'owner_of_vm@gmail.com', subject + body) + + server.quit() diff --git a/github-api-integration-module.sh b/github-api-integration-module.sh index d94d2951..409329f7 100644 --- a/github-api-integration-module.sh +++ b/github-api-integration-module.sh @@ -8,7 +8,7 @@ # This script will help users to communicate and retrieve information from GitHub # Usage: # Please provide your github token and rest api to the script as input -# +# Added some text # ################################