Files
telegraf-bcachefs-input/kent_report.sh
T

127 lines
3.1 KiB
Bash
Executable File

#!/bin/bash
#set -euo pipefail
# Resolve the checkout even when invoked through a symlink.
REPORT_DIR=$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")")
source "$REPORT_DIR/paste_log.sh" || exit 1
(
echo bcachefs support reporter for py1hon 1.0
echo Date: $(date)
echo Kernel: $(uname -a)
ver="$(pacman -Q bcachefs-dkms)"
echo "$ver"
if [[ "$ver" =~ ^([^[:space:]]+)[[:space:]]+(.+)$ ]] ; then
ver="${BASH_REMATCH[2]}"
ver="${ver%-*}"
# Convert Arch git-style version to git describe format
if [[ "$ver" =~ ^(.+)\.r([0-9]+)\.g([0-9a-fA-F]+)$ ]]; then
tag="${BASH_REMATCH[1]}"
rev="${BASH_REMATCH[2]}"
hash="${BASH_REMATCH[3]}"
ver="v${tag}-${rev}-g${hash}"
else
# Plain tag (no commits on top)
ver="v${ver}"
fi
COMMIT_MESSAGE="$(git -C ~/bcachefs-tools-git/src/bcachefs-tools/ log --pretty=format:"%h %ad %s [%cn]" -n1 "$ver")"
if [[ $? -eq 0 ]]
then
echo Installed commit: "$COMMIT_MESSAGE"
echo
echo "Commits in master that are not installed on this system (yet? is this worth a reboot?):"
git -C ~/bcachefs-tools-git/src/bcachefs-tools log --pretty=format:"%h %ad %s [%cn]" "${ver}..master" -- ./libbcachefs/
fi
else
echo "parsing arch package version failed: $ver"
exit 1
fi
echo
echo
pacman -Q bcachefs-tools
echo
echo
echo
function print_cmd()
{
if [[ -z "$INDEX_ONLY" ]]
then
echo
echo
echo
fi
echo "\$" "${@}"
}
function run_cmd()
{
print_cmd "${@}"
if [[ -z "$INDEX_ONLY" ]]
then
"${@}"
fi
}
function do_work()
{
run_cmd lsblk -e 7 -o NAME,KNAME,TYPE,SIZE,ROTA,SCHED,HCTL,TRAN,MODEL,SERIAL,WWN,FSTYPE,MOUNTPOINTS
run_cmd numactl --hardware
run_cmd lspci -nn
run_cmd iostat -xz -m -y 5 12
run_cmd mpstat -P ALL 5 12
run_cmd vmstat -w 5 12
run_cmd iotop -b -o -t -qqq -d 5 -n 12
run_cmd bcachefs reconcile status /mnt
run_cmd bcachefs fs timestats --once
run_cmd bcachefs fs timestats --once --sort mean-recent
run_cmd bcachefs fs timestats --once --sort dur-max
run_cmd bcachefs fs top --once /mnt
run_cmd bcachefs fs usage -h -a /mnt
run_cmd bcachefs fs top -h -n 60 -d 2 /mnt
run_cmd trace-cmd record -e bcachefs:copygc -e bcachefs:reconcile_phys -e bcachefs:data_update sleep 60
run_cmd trace-cmd report
for i in /sys/fs/bcachefs/*/* /sys/fs/bcachefs/*/internal/* /sys/fs/bcachefs/*/time_stats/*
do
if [[ -f "$i" ]]
then
run_cmd cat $i
fi
done
print_cmd iostat -x -m -d 2
if [[ -z "$INDEX_ONLY" ]]
then
timeout 1 sudo iostat -x -m -d 2
fi
run_cmd sudo dmesg
# super slow since a few months (>5min)
# run_cmd sudo bcachefs fs usage -f devices,rebalance_work,compression,btree /mnt
print_cmd sudo bcachefs show-super /dev/sda
if [[ -z "$INDEX_ONLY" ]]
then
cat /mnt/encryption_pw.txt | sudo bcachefs show-super /dev/sda
fi
}
echo Dump-Index: The following commands will be printed in this order:
INDEX_ONLY=1 do_work
do_work
) | tee kent_report.log
paste_log kent_report.log