Created
July 6, 2021 12:30
-
-
Save codemation/da72c7b04457b3e4e4285b4ffd6c1eda to your computer and use it in GitHub Desktop.
updating_chart
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
@scheduler(schedule=every_minute) | |
async def resource_monitor(): | |
time_now=datetime.datetime.now().isoformat()[11:19] | |
# updates CPU & MEM datasets with current time | |
await server.charts.update_dataset( | |
'cpu', | |
label=time_now, | |
data=psutil.cpu_percent() | |
) | |
await server.charts.update_dataset( | |
'mem', | |
label=time_now, | |
data=psutil.virtual_memory().percent | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment