1.8 KiB
1.8 KiB
check_drives_health.py
Drive Health Monitoring Script
This script checks the SMART health status of all available drives on the system and sends notifications using the ntfy service. The script will alert you if any drives are failing and provide a summary of the health status for all drives.
Prerequisites
Before running the script, ensure you have the following installed:
- smartmontools (to check drive SMART status)
sudo apt install smartmontools - requests Python library (for sending notifications)
pip install requests
Usage
- Clone or download the script to your machine.
- Ensure you have proper permissions to run
smartctlwithsudo. - Edit the script to replace the ntfy URL (
https://ntfy.hrasci.eu/rpi5) with your desired ntfy topic. - Run the script:
sudo python3 drive_health.py
The script will:
- List all available drives on the system.
- Check the SMART health status of each drive.
- Send notifications via
ntfy:- If a drive is unhealthy, it sends an urgent notification with warning tags.
- If all drives are healthy, it sends a low-priority notification.
Example Notifications
-
Healthy drives:
- Notification with the title "All Drives Healthy" and tags
ok,check.
- Notification with the title "All Drives Healthy" and tags
-
Unhealthy drives:
- Notification with a title indicating the specific drive, an urgent priority, and warning tags
warning,skull.
- Notification with a title indicating the specific drive, an urgent priority, and warning tags
HDD.sh
Bash script for either telling all HDDs in system to spindown or checking if it is spinning or not
Prerequisites:
sudo apt install hdparm- Drives are listed as
/dev/sdXwhereXstands for their respective labeling for the system
Usage:
$ ./HDD.sh (1/2)
- option 1) tell drives to spindown
- option 2) check if drives are spinning or not