Compare commits

...
2 Commits
Author SHA1 Message Date
Sean 49dba6f48a tweaks 2019-07-24 20:05:51 -07:00
Sean 129f6b2970 tweaks 2019-07-24 19:31:39 -07:00
+4 -4
View File
@@ -647,7 +647,7 @@ echo "Done."
echo "#! /bin/bash" > /mnt/zfshealth.sh
echo "problems=0; emailSubject=\"\`hostname\` - ZFS pool - HEALTH check\"; emailMessage=\"\"" >> /mnt/zfshealth.sh
echo "condition=\$(/sbin/zpool status | egrep -i '(DEGRADED|FAULTED|OFFLINE|UNAVAIL|REMOVED|FAIL|DESTROYED|corrupt|cannot|unrecover)')" >> /mnt/zfshealth.sh
echo "condition=\$(/sbin/zpool status | grep -e \"^ *state:\" | egrep -i '(DEGRADED|FAULTED|OFFLINE|UNAVAIL|REMOVED|FAIL|DESTROYED|corrupt|cannot|unrecover)')" >> /mnt/zfshealth.sh
echo "if [ \"\${condition}\" ]; then emailSubject=\"\$emailSubject - fault\"; problems=1; fi" >> /mnt/zfshealth.sh
echo "maxCapacity=80" >> /mnt/zfshealth.sh
echo "if [ \${problems} -eq 0 ]; then" >> /mnt/zfshealth.sh
@@ -658,7 +658,7 @@ echo " if [ \$line -ge \$maxCapacity ]; then emailSubject=\"\$emailSubject -
echo " done" >> /mnt/zfshealth.sh
echo "fi" >> /mnt/zfshealth.sh
echo "if [ \${problems} -eq 0 ]; then" >> /mnt/zfshealth.sh
echo " errors=\$(/sbin/zpool status | grep ONLINE | grep -v state | awk '{print $3 $4 $5}' | grep -v 000)" >> /mnt/zfshealth.sh
echo " errors=\$(/sbin/zpool status | grep ONLINE | grep -v state | awk '{print \$3 \$4 \$5}' | grep -v 000)" >> /mnt/zfshealth.sh
echo " if [ \"\${errors}\" ]; then emailSubject=\"\$emailSubject - Drive Errors\"; problems=1; fi" >> /mnt/zfshealth.sh
echo "fi" >> /mnt/zfshealth.sh
echo "scrubExpire=691200" >> /mnt/zfshealth.sh
@@ -669,8 +669,8 @@ echo " for volume in \${zfsVolumes}" >> /mnt/zfshealth.sh
echo " do" >> /mnt/zfshealth.sh
echo " if [ \$(/sbin/zpool status \$volume | egrep -c \"none requested\") -ge 1 ]; then echo \"ERROR: You need to run \\\"zpool scrub \$volume\\\" before this script can monitor the scrub expiration time.\"; break; fi" >> /mnt/zfshealth.sh
echo " if [ \$(/sbin/zpool status \$volume | egrep -c \"scrub in progress|resilver\") -ge 1 ]; then break; fi" >> /mnt/zfshealth.sh
echo " scrubRawDate=\$(/sbin/zpool status \$volume | grep scrub | awk '{print \$15 \$12 \$13}')" >> /mnt/zfshealth.sh
echo " scrubDate=\$(date -j -f '%Y%b%e-%H%M%S' \$scrubRawDate'-000000' +%s)" >> /mnt/zfshealth.sh
echo " scrubRawDate=\$(/sbin/zpool status \$volume | grep scrub | awk '{print \$15 \$12 \$13}' | sed 's/\([0-9]\+\)\([A-Za-z]*\)\([0-9]\+\)/\\2 \\3, \\1/g')" >> /mnt/zfshealth.sh
echo " scrubDate=\$(date -d \"\$scrubRawDate\" +%s)" >> /mnt/zfshealth.sh
echo " if [ \$((\$currentDate - \$scrubDate)) -ge \$scrubExpire ]; then" >> /mnt/zfshealth.sh
echo " if [ \${problems} -eq 0 ]; then emailSubject=\"\$emailSubject - Scrub Time Expired. Scrub Needed on Volume(s)\"; fi" >> /mnt/zfshealth.sh
echo " problems=1" >> /mnt/zfshealth.sh