Skip to content

Instantly share code, notes, and snippets.

@jonleopard
Created July 31, 2021 09:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonleopard/44fc716a08b516527ea1d7c770cd64cc to your computer and use it in GitHub Desktop.
Save jonleopard/44fc716a08b516527ea1d7c770cd64cc to your computer and use it in GitHub Desktop.
#!/bin/sh
arcSummary="$(python /usr/local/www/freenasUI/tools/arc_summary.py)"
pools="$(zpool list -H -o name)"
echo ""
echo "[LIST]"
echo "[*]Put your data type(s) here..."
echo "[*]$(uptime)"
for pool in $pools
do
used="$(zpool list -H -o allocated ${pool})"
total="$(zpool list -H -o size ${pool})"
echo "[*]${used}iB / ${total}iB (${pool})"
done
arc="$(echo "${arcSummary}" | grep -m 1 "ARC Size:" | awk '{print $4 $5}')"
sizeMRU="$(echo "${arcSummary}" | grep "Recently Used Cache Size:" | awk '{print $6 $7}')"
sizeMFU="$(echo "${arcSummary}" | grep "Frequently Used Cache Size:" | awk '{print $6 $7}')"
ram="$(echo "${arcSummary}" | grep "Real Installed:" | awk '{print $3 $4}')"
hit="$(echo "${arcSummary}" | grep "Cache Hit Ratio:" | awk '{print $4}')"
pre="$(echo "${arcSummary}" | grep "Data Prefetch Efficiency:" | awk '{print $4}')"
hitMRU="$(echo "${arcSummary}" | grep "Most Recently Used:" | awk '{print $4}')"
hitMFU="$(echo "${arcSummary}" | grep "Most Frequently Used:" | awk '{print $4}')"
hitMRUG="$(echo "${arcSummary}" | grep "Most Recently Used Ghost:" | awk '{print $5}')"
hitMFUG="$(echo "${arcSummary}" | grep "Most Frequently Used Ghost:" | awk '{print $5}')"
echo "[*]${arc} (MRU: ${sizeMRU}, MFU: ${sizeMFU}) / ${ram}"
echo "[*]Hit ratio -> ${hit} (higher is better)"
echo "[*]Prefetch -> ${pre} (higher is better)"
echo "[*]Hit MFU:MRU -> ${hitMFU}:${hitMRU} (higher ratio is better)"
echo "[*]Hit MRU Ghost -> ${hitMRUG} (lower is better)"
echo "[*]Hit MFU Ghost -> ${hitMFUG} (lower is better)"
echo "[/LIST]"
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment