Browse Source

Change zfs status to a simple output

Maybe i start working on a new detailed view in the feature.
tags/1.0.0^2
Tenyun 4 months ago
parent
commit
da6fa2c2b7
1 changed files with 1 additions and 3 deletions
  1. +1
    -3
      status.sh

+ 1
- 3
status.sh View File

@@ -24,7 +24,6 @@ ZPOOL_BIN=$(whereis -b zpool | awk '{print $2}')

get_zfs_data() {
var_zfs_last_snapshot_all=$($ZFS_BIN list -H -t snapshot -o name -S creation)
var_zfs_pool_status=$($ZPOOL_BIN status | grep -E "(pool:|state:|scan:|errors:)" )
var_zfs_last_snapshot_hourly=$(awk -F_ '/hourly/{print $(NF-1);exit;}' <<< "$var_zfs_last_snapshot_all")
var_zfs_last_snapshot_daily=$(awk -F_ '/daily/{print $(NF-1);exit;}' <<< "$var_zfs_last_snapshot_all")
var_zfs_last_snapshot_monthly=$(awk -F_ '/monthly/{print $(NF-2)"_"$(NF-1);exit;}' <<< "$var_zfs_last_snapshot_all")
@@ -78,8 +77,7 @@ printf "\n"
printHeadLine "ZFS STATUS"
get_zfs_data
printf "## Pool status ##\n\n"
awk 'BEGIN{OFS = "-"; print "Pool-Name""\t""Status""\t""Last-Scrub""\t""\t""Repaired-Errors""\t""Scrub-Errors""\t""Time""\t""Data-Errors"};
/pool/{ POOL=$2; next} /state/{STATE=$2; next} /scan/{SCAN1=$12"-"$13"-"$14"-"$15; SCAN2=$4; SCAN3=$8; SCAN4=$6; next} /error/{$1=""; print POOL"\t"STATE"\t"SCAN1"\t"SCAN2"\t"SCAN3"\t"SCAN4"\t"$0}' <<< "$var_zfs_pool_status" | column -t
$ZPOOL_BIN status -x

printf "\n## Snapshots ##\n\n"
printf "Last zfs snapshots\n"


Loading…
Cancel
Save