Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Basic-python-program.py
Original file line number Diff line number Diff line change
@@ -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()
2 changes: 1 addition & 1 deletion github-api-integration-module.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
################################

Expand Down