Files
KNELPerf/monitoring/collectors/knelperf-iotop-snap.sh
T
ic-builder 3680f1dba1
ci / audit (push) Successful in 26s
Fleet monitoring: sysstat 28d + perfsnap/PSI/iotop timers + on-demand toolbox container (#826)
- monitoring/node-install.sh: idempotent per-node installer (sar HISTORY=28,
  three oneshot timers, per-node conf with qemu.slice/lxc cgroup globs)
- monitoring/collectors + systemd units: iotop-snap 15min, perfsnap 60s,
  psi-textfile 15s (now sources /etc/knelperf/perfsnap.conf; multi-glob)
- monitoring/toolbox: pct LXC (vmid 950, privileged, apparmor unconfined,
  stopped at rest) + knelperf-toolbox wrapper + Dockerfile variant
- monitoring/deploy-fleet.sh: workstation-side rollout driver
- piloted on pfv-tsys1: per-VM PSI gauges verified live

Redmine: https://projects.knownelement.com/issues/826
2026-09-06 18:50:07 -05:00

23 lines
928 B
Bash

#!/usr/bin/env bash
# KNELPerf iotop snapshot — periodic batch samples of active per-process I/O.
# Complements sar (system-wide device stats) with the WHO behind the I/O.
# Env (or /etc/knelperf/perfsnap.conf):
# KNELPERF_IOTOP_LOGDIR default /var/log/knelperf-iotop
# Output: daily file iotop-YYYYMMDD.log; per tick one header line then
# 3 batch iterations x 2s of processes with outstanding I/O (-botqq -k).
# Docs: https://community.turnsys.com/t/328
set -u
CONF=/etc/knelperf/perfsnap.conf
[ -r "$CONF" ] && . "$CONF"
LOGDIR=${KNELPERF_IOTOP_LOGDIR:-/var/log/knelperf-iotop}
mkdir -p "$LOGDIR"
F="$LOGDIR/iotop-$(date +%Y%m%d).log"
{
echo "### $(date -Iseconds)"
iotop -botqq -k -n 3 -d 2 2>/dev/null
} >> "$F"
# retention: 14 days; rotate the live file at 25MB
find "$LOGDIR" -name 'iotop-*.log*' -mtime +14 -delete 2>/dev/null
[ "$(wc -c <"$F" 2>/dev/null || echo 0)" -gt 26214400 ] && mv "$F" "$F.1"
exit 0