Last active
April 5, 2020 02:28
-
-
Save gregonarash/0633757f9142ba53b9d8538feadc39f6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import psutil | |
import requests | |
data_to_send = {} | |
data_to_send["date"] = str(datetime.datetime.now()) | |
data_to_send["disk_usage"] = psutil.disk_usage("/").percent | |
data_to_send["cpu_data"] = {} | |
data_to_send["cpu_data"]["cpu_usage"] = psutil.cpu_percent(1) | |
data_to_send["cpu_data"]["cpu_temp"] = psutil.sensors_temperatures()["cpu-thermal"][0].current | |
data_to_send["memory_usage"] = psutil.virtual_memory().percent | |
print(data_to_send) | |
r = requests.post("https://your.webhook.url", json = data_to_send) | |
print(r.status_code) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment