An open API service indexing awesome lists of open source software.

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

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.

![Cron job](cron_job.png)

## 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
```