26 lines
761 B
Python
26 lines
761 B
Python
import psutil
|
|
from discord_webhook import DiscordWebhook
|
|
|
|
# Replace with your actual webhook URL
|
|
webhook_url = "https://discord.com/api/webhooks/1283416699403636788/fOdCjvFoLeb3GsOO-QzV0q-N9J6L8kg0jlXuOOx9qaIPYltzIkaPfkrN0nNyFrfVNHEz"
|
|
|
|
# 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}") |