Add main.py
This commit is contained in:
commit
54ce8d38ad
|
@ -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}")
|
Loading…
Reference in New Issue