diff options
| author | Lukasz Kasprzak <lukasz.kasprzak@pm.me> | 2026-04-14 22:32:43 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukasz.kasprzak@pm.me> | 2026-04-14 22:32:43 +0200 |
| commit | 83f7fe4b8402bab171d110703a1b1115efbc9b28 (patch) | |
| tree | 19110702c7d740f6bd8ee4f5d2ebcb97442be237 /straper/db/public/zfs/etc-zfs/zpool.d/iostat | |
| parent | 51d43498b07dc97d795947964534f0903cd05db5 (diff) | |
| download | bin-83f7fe4b8402bab171d110703a1b1115efbc9b28.tar.gz bin-83f7fe4b8402bab171d110703a1b1115efbc9b28.zip | |
cleaned up many scrits and deleted some that were of no use; renamed a lot
Diffstat (limited to 'straper/db/public/zfs/etc-zfs/zpool.d/iostat')
| -rwxr-xr-x | straper/db/public/zfs/etc-zfs/zpool.d/iostat | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/straper/db/public/zfs/etc-zfs/zpool.d/iostat b/straper/db/public/zfs/etc-zfs/zpool.d/iostat deleted file mode 100755 index 2f8d79a..0000000 --- a/straper/db/public/zfs/etc-zfs/zpool.d/iostat +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/sh -# -# Display most relevant iostat bandwidth/latency numbers. The output is -# dependent on the name of the script/symlink used to call it. -# - -helpstr=" -iostat: Show iostat values since boot (summary page). -iostat-1s: Do a single 1-second iostat sample and show values. -iostat-10s: Do a single 10-second iostat sample and show values." - -script="${0##*/}" -if [ "$1" = "-h" ] ; then - echo "$helpstr" | grep "$script:" | tr -s '\t' | cut -f 2- - exit -fi - -# Sometimes, UPATH ends up /dev/(null). -# That should be corrected, but for now... -# shellcheck disable=SC2154 -if [ ! -b "$VDEV_UPATH" ]; then - somepath="${VDEV_PATH}" -else - somepath="${VDEV_UPATH}" -fi - -if [ "$script" = "iostat-1s" ] ; then - # Do a single one-second sample - interval=1 - # Don't show summary stats - brief="yes" -elif [ "$script" = "iostat-10s" ] ; then - # Do a single ten-second sample - interval=10 - # Don't show summary stats - brief="yes" -fi - -if [ -f "$somepath" ] ; then - # We're a file-based vdev, iostat doesn't work on us. Do nothing. - exit -fi - -if [ "$(uname)" = "FreeBSD" ]; then - out=$(iostat -dKx \ - ${interval:+"-w $interval"} \ - ${interval:+"-c 1"} \ - "$somepath" | tail -n 2) -else - out=$(iostat -kx \ - ${brief:+"-y"} \ - ${interval:+"$interval"} \ - ${interval:+"1"} \ - "$somepath" | grep -v '^$' | tail -n 2) -fi - - -# Sample output (we want the last two lines): -# -# Linux 2.6.32-642.13.1.el6.x86_64 (centos68) 03/09/2017 _x86_64_ (6 CPU) -# -# avg-cpu: %user %nice %system %iowait %steal %idle -# 0.00 0.00 0.00 0.00 0.00 100.00 -# -# Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util -# sdb 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 -# - -# Get the column names -cols=$(echo "$out" | head -n 1) - -# Get the values and tab separate them to make them cut-able. -vals=$(echo "$out" | tail -n 1 | tr -s '[:space:]' '\t') - -i=0 -for col in $cols ; do - i=$((i+1)) - # Skip the first column since it's just the device name - if [ "$i" -eq 1 ]; then - continue - fi - - # Get i'th value - val=$(echo "$vals" | cut -f "$i") - echo "$col=$val" -done |
