System Lagging Alert, Temperature Alert In Arbitrary Device
Python
System Responsiveness
Temperature Measurement
Alert Thresholds
Notifications
Monitoring Software
Daemon Installation
Learn how to measure system responsiveness and temperature using Python, set alert thresholds for notifications, and install monitoring software as a daemon on various devices.
The system sometimes feels lagging, less responsive. The only way to fix is to reboot.
Although monitor task completion time is helpful, but not general enough.
Simple hack:
import subprocess
def measure_system_responsiveness():
= time.time()
start_time
subprocess.run("echo", "hello"], capture_output=True, encoding='utf-8', check=True
[
)= time.time()
end_time = end_time - start_time
exec_time = 1 / exec_time
exec_per_second return exec_per_second
Lagging related package:
apt install nohang oomd psi-notify
Temperature monitoring packages:
pip3 install gpustat
pip3 install pyspectator
apt install lm-sensor # sensors -j
Create temperature statistics (high, low, mean) for all crucial components.
Set alert threshold, only trigger alert if temperature reoccurs for several times.
Send ntfy.sh
notification as well as making audible alerts.
Notification shall specify device name, component name, current temperature, threshold, statistics.
Every device shall be equipped with this software as daemon, be it smartphone, MacBook, Linux PC, Windows PC.