Add main.py

This commit is contained in:
heckeralt 2024-09-08 17:40:53 -04:00
commit 54ce8d38ad
1 changed files with 26 additions and 0 deletions

26
main.py Normal file
View File

@ -0,0 +1,26 @@
import psutil
from discord_webhook import DiscordWebhook
# Replace with your actual webhook URL
webhook_url = "your_webhook_url"
# Get RAM usage
ram = psutil.virtual_memory()
ram_usage = f"RAM Usage: {ram.percent}%"
# Get Disk usage
disk = psutil.disk_usage('/')
disk_usage = f"Disk Usage: {disk.percent}%"
# Prepare the content to send
content = f"{ram_usage}\n{disk_usage}"
# Create a webhook and send the data
webhook = DiscordWebhook(url=webhook_url, content=content)
response = webhook.execute()
# Check response
if response.status_code == 204:
print("Data sent successfully.")
else:
print(f"Failed to send data: {response.status_code}")