PyUdisk is a python module to generate S.M.A.R.T metrics for all drives/partitions on a host machine.
Recommendations
- Install
python[3.10] or [3.11] - Use a dedicated [virtual environment]
For monitoring and reporting, use
pip install PyUdisk[standard]For basic functionality, use
pip install PyUdiskIDE
import pyudisk
if __name__ == '__main__':
for metric in pyudisk.smart_metrics():
print(metric)CLI
pyudisk startUse
pyudisk --helpfor usage instructions.
Sourcing environment variables from an env file
By default,
PyUdiskwill look for a.envfile in the current working directory.
- SMART_LIB: Path to the S.M.A.R.T CLI library. Uses
udisksctlfor Linux andsmartctlfor macOS/Windows. - DISK_LIB: Path to disk util library. Uses
lsblkfor Linux,diskutilfor macOS, andpwshfor Windows. - METRICS: List of metrics to monitor. Default:
[] - GMAIL_USER: Gmail username to authenticate SMTP library.
- GMAIL_PASS: Gmail password to authenticate SMTP library.
- RECIPIENT: Email recipient for email notifications.
- PHONE: Phone number for SMS notifications.
- NTFY_URL: URL for Ntfy notifications.
- NTFY_TOPIC: Topic for Ntfy notifications.
- NTFY_USERNAME: Username for Ntfy notifications.
- NTFY_PASSWORD: Password for Ntfy notifications.
- TELEGRAM_BOT_TOKEN: Telegram bot token for Telegram notifications.
- TELEGRAM_CHAT_ID: Telegram chat ID for Telegram notifications.
- TELEGRAM_THREAD_ID: Telegram thread ID for Telegram notifications.
- DISK_REPORT: Boolean flag to send disk report via email.
- REPORT_DIR: Directory to save disk reports. Default:
report - REPORT_FILE: Filename for disk reports. Default format:
disk_report_%m-%d-%Y_%I:%M_%p.html
Requirement
python -m pip install gitverseUsage
gitverse-release reverse -f release_notes.rst -t 'Release Notes'pre-commit will ensure linting
Requirement
python -m pip install pre-commitUsage
pre-commit run --all-fileshttps://pypi.org/project/PyUdisk/
© Vignesh Rao
Licensed under the MIT License