56 lines
1.8 KiB
Markdown
56 lines
1.8 KiB
Markdown
# 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)
|
|
```bash
|
|
sudo apt install smartmontools
|
|
```
|
|
- **requests** Python library (for sending notifications)
|
|
```bash
|
|
pip install requests
|
|
```
|
|
|
|
## Usage
|
|
|
|
1. Clone or download the script to your machine.
|
|
2. Ensure you have proper permissions to run `smartctl` with `sudo`.
|
|
3. Edit the script to replace the ntfy URL (`https://ntfy.hrasci.eu/rpi5`) with your desired ntfy topic.
|
|
4. Run the script:
|
|
```bash
|
|
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`.
|
|
|
|
- **Unhealthy drives**:
|
|
- Notification with a title indicating the specific drive, an urgent priority, and warning tags `warning`, `skull`.
|
|
|
|
|
|
# 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/sdX` where `X` stands for their respective labeling for the system
|
|
|
|
**Usage**:
|
|
```bash
|
|
$ ./HDD.sh (1/2)
|
|
- option 1) tell drives to spindown
|
|
- option 2) check if drives are spinning or not |