https://github.com/DisorganizedWizardry/TrueNAS-smartctl
Send drive stats from TrueNAS to logstash
https://github.com/DisorganizedWizardry/TrueNAS-smartctl
smartctl truenas
Last synced: about 1 year ago
JSON representation
Send drive stats from TrueNAS to logstash
- Host: GitHub
- URL: https://github.com/DisorganizedWizardry/TrueNAS-smartctl
- Owner: DisorganizedWizardry
- License: gpl-3.0
- Created: 2022-04-03T17:45:04.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-04-03T18:37:55.000Z (about 4 years ago)
- Last Synced: 2024-08-02T16:00:08.592Z (almost 2 years ago)
- Topics: smartctl, truenas
- Language: Python
- Homepage:
- Size: 109 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TrueNAS-smartctl
## Install the script on TrueNAS
Copy `smart-truenas.py` to your TrueNAS server
## Logstash config
Here is the config for logstash.
```
input {
tcp {
port => 4000
codec => "json"
ecs_compatibility => "disabled"
}
}
```
## Run the script
Once you have logstash setup, run the script
```
Usage: python3 smart-truenas.py [ip_address] [port]
```
## Setup the crontab on TrueNAS
Create a cron job to export drive stats.

## Troubleshooting
The script relies on smartctl to output json, make sure the below commands work.
The command to scan for drives.
```
smartctl -j --scan
```
The command that is run for each drive.
```
smartctl -j -a [drive]
```
If you get the `Failed to send` errors, check the logstash config.
```
Failed to send : /dev/da0
Failed to send : /dev/da1
Failed to send : /dev/da2
Failed to send : /dev/da3
```