Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/support truenas scale #37

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

###### User-definable Parameters
### Email Address
email="[email protected]"

### FreeNAS config backup settings
configBackup="true" # Change to "false" to skip config backup (which renders next two options meaningless); "true" to keep config backups enabled
saveBackup="true" # Change to "false" to delete FreeNAS config backup after mail is sent; "true" to keep it in dir below
backupLocation="/path/to/config/backup" # Directory in which to save FreeNAS config backups

### Global table colors
okColor="#c9ffcc" # Hex code for color to use in SMART Status column if drives pass (default is light green, #c9ffcc)
warnColor="#ffd6d6" # Hex code for WARN color (default is light red, #ffd6d6)
critColor="#ff0000" # Hex code for CRITICAL color (default is bright red, #ff0000)
altColor="#f4f4f4" # Table background alternates row colors between white and this color (default is light gray, #f4f4f4)

### zpool status summary table settings
usedWarn=90 # Pool used percentage for CRITICAL color to be used
scrubAgeWarn=30 # Maximum age (in days) of last pool scrub before CRITICAL color will be used

### SMART status summary table settings
includeSSD="true" # [NOTE: Currently this is pretty much useless] Change to "true" to include SSDs in SMART status summary table; "false" to disable
tempWarn=40 # Drive temp (in C) at which WARNING color will be used
tempCrit=45 # Drive temp (in C) at which CRITICAL color will be used
sectorsCrit=10 # Number of sectors per drive with errors before CRITICAL color will be used
testAgeWarn=5 # Maximum age (in days) of last SMART test before CRITICAL color will be used
powerTimeFormat="ymdh" # Format for power-on hours string, valid options are "ymdh", "ymd", "ym", or "y" (year month day hour)

17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,23 @@ Original script by joeschmuck, modified by Bidelu0hm, then by melp

Preview of the output here: http://i.imgur.com/t9Mtqyt.png

## Installation

### Requirements

Your Truenas installation needs to be able to send emails. Please check the SMTP/Email config in the Truenas General settings.

### Core

TODO - add core specific configuration

### Scale

- Clone this repo at the location of your choice on your Scale system
- Add a cron job to run report.sh, under System settings -> Advanced -> Cron Jobs
- In the command field, use bash to invoke report.sh: ```(cd your/git/rpo/location/ && bash report.sh)```
- Run as root, as of Dragonfish

**At a minimum, you will need to enter your email address in user-definable parameter section.** Feel free to edit other user parameters as needed.

**Version: v1.3**
Expand Down
18 changes: 18 additions & 0 deletions email-writing
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
#
host=$(hostname -s)
#logfile="/tmp/smart_report.tmp"
subject="Status Report and Configuration Backup for ${host}"
boundary="gc0p4Jq0M2Yt08jU534c0p"

function write_email_header () {
###### Email pre-formatting
### Set email headers
(
echo "From: ${email}"
echo "To: ${email}"
echo "Subject: ${subject}"
echo "MIME-Version: 1.0"
echo "Content-Type: multipart/mixed; boundary=${boundary}"
) > "$1"
}
Loading