Skip to content

Redcat468/DiskIAnalyser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DiskIAnalyser

This is a work-in-progress

It's a simple python script to run on TrueNAS server to analyze the SMART disk reports using ChatGPT. The goal is to leverage the GPT 3.5 Turbo and GPT4 API to read your disk's SMART reports and generate a simplified report with a health score for each disk. Once the report is generated, it is formatted in html and sent via email. Another function of this script allow the user to select a specific disk and run an analysis against the result of smartctl -a /dev/daxx

Installation

This script requires the installation of the openai module. If you don't want to use pip, you can follow these steps:

Download the package: Visit the PyPI page for the module. For openai, the URL is typically: https://pypi.org/project/openai/

Here you will find tar.gz files for various versions of the module. Download the .tar.gz file that corresponds to the version you want. Once downloaded, transfer the .tar.gz file to your TrueNAS server (you can use scp or any method of your choice). Once the file is on the server, extract its contents:

tar -xzf openai-x.x.x.tar.gz

After extracting the package, navigate to the package directory and use the setup.py command to install the module:

cd openai-x.x.x
python3 setup.py install

You will need an openai API key. And to access GPT4 API you can follow this guide https://help.openai.com/en/articles/7102672-how-can-i-access-gpt-4

You need to edit the config.ini to set the variables before starting the script.

Using

Configure the config.ini file with your mail and openai api key then do :

python ./DiskIAnalyser.py

And here you go.

  __________________
 |  :           :  |
 |  :           :  |
 |  DiskIAnalyser  |
 |  :   v0.2    :  |
 |  :___________:  |
 |     _________   |
 |    | __      |  |
 |    ||  |     |  |
 \____||__|_____|__|

Options:
1. Analyze SMART data for all disks and receive a report by email
2. Analyze SMART data for a specific disk (GPT4)
3. Quit
Please choose an option: 1
SMART report extraction completed, 27 reports created.
analysing : smart_logs__dev_da0.txt
analysing : smart_logs__dev_da1.txt
analysing : smart_logs__dev_da10.txt
analysing : smart_logs__dev_da11.txt
analysing : smart_logs__dev_da12.txt
analysing : smart_logs__dev_da13.txt
analysing : smart_logs__dev_da14.txt

All disk report

here is a capture of the html report received via email https://ibb.co/KKW24JD

Specific disk analysis results

Voici le rapport GPT4 de da16

Looking at the SMART data for your disk, a few parameters stand out:

1. Raw_Read_Error_Rate: Has a raw_value of 27659040. This is a record of the number of hardware errors that occurred when reading data from the disk. While the normalized value is within comfortable bounds, you should keep an eye on this to ensure it doesn't increase rapidly, which might signify an escalating issue.

2. Seek_Error_Rate: The raw_value is 152299691. This refers to a count of seek errors. Similarly, the normalized value is well within bounds (indicating the performance is still normal), but it could be a concern if this number starts rising quickly in the future.

3. Power_On_Hours: With a value of 9792, this disk has been powered on for approximately 408 days. Although this isn't directly a cause for concern, it's worth knowing that HDDs have a limited lifespan and longer usage means a potentially closer end of life.

4. Load_Cycle_Count: With a raw_value of 3644, this indicates the count of load/unload cycles into head landing zone position. The raw value is already quite high. A high load Cycle Count can lead to wear and tear.

As it stands, there appear to be no immediate concerns with your disk based on these SMART diagnostics - there are no reported uncorrectable sectors, no reallocated sectors, and no pending sectors. The general health self-assessment test also passed, which is a good sign.

To ensure longevity and to prevent data loss:
- Make sure to always have an up-to-date backup of all important files.
- Running regular SMART tests (both short/extended) can help to early identify problems.
- Be prepared to replace the disk if parameters start to rapidly deteriorate or if any bad sectors appear.

Considering the data, there is no urgent issue requiring immediate expenditure, but monitoring the disk health over time is advisable.

Do you want to receive the report by email? (y/n

About

A simple python script to run on TrueNAS that analyses the SMART disks reports via ChatGPT, and generates per-disk health scores.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages