Skip to content

Instantly share code, notes, and snippets.

@rishabhsahilll
Last active February 14, 2025 17:04
Show Gist options
  • Save rishabhsahilll/6912cb5b4cef41c70ff8478f2b8a747a to your computer and use it in GitHub Desktop.
Save rishabhsahilll/6912cb5b4cef41c70ff8478f2b8a747a to your computer and use it in GitHub Desktop.
SystemInfo.py is a Python script that monitors CPU usage, RAM usage, and battery level using the psutil library, providing real-time system performance insights.
import psutil
system_info = f'''
Initializing system check...
Checking CPU Usage...
Checking RAM Usage...
Checking Battery Level...
CPU Usage: {psutil.cpu_percent(interval=1)}%
RAM Usage: {psutil.virtual_memory().percent}%
Battery Level: {psutil.sensors_battery().percent if psutil.sensors_battery() else "Not Available"}%
All systems are running normally!
'''
print(system_info)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment