Skip to content

Instantly share code, notes, and snippets.

@codemation
Created July 6, 2021 12:30
Show Gist options
  • Save codemation/da72c7b04457b3e4e4285b4ffd6c1eda to your computer and use it in GitHub Desktop.
Save codemation/da72c7b04457b3e4e4285b4ffd6c1eda to your computer and use it in GitHub Desktop.
updating_chart
@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