From 030f4f34f19294c4a2ed8331a9c6278b8e0171a9 Mon Sep 17 00:00:00 2001 From: Trey Blancher Date: Sat, 26 Aug 2023 09:03:15 -0400 Subject: [PATCH] Added more statistics, renamed print_pidstat to print_stats --- psi-alerts.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/psi-alerts.sh b/psi-alerts.sh index 4259e47..4362dfe 100755 --- a/psi-alerts.sh +++ b/psi-alerts.sh @@ -76,17 +76,23 @@ print_psi () { cat "${(P)$(tr '[[:upper:]]' '[[:lower:]]' <<< "${psi_file}")}" } -print_pidstat () { +print_stats () { local psi_type="${1}" case "${psi_type}" in CPU) + top -bcn1 -o %CPU -w 512 | head -n 30 + printf "\n\n" pidstat -ul --human ;; IO) + sudo iotop --batch --only --iter=1 + printf "\n\n" pidstat -dl --human ;; MEM) + top -bcn1 -o %MEM -w 512 | head -n 30 + printf "\n\n" pidstat -rl --human ;; *) @@ -181,8 +187,8 @@ send () { # is this an email or SMS? if [[ ! "${dst}" =~ "@${sms_domain}" ]]; then for p in $(tr '|' ' ' <<< "${current_alarms}"); do - printf "\npidstat info for ${p}\n\n" >> ${email} - print_pidstat "${p}" >> ${email} + printf "\nStatistics info for ${p}\n\n" >> ${email} + print_stats "${p}" >> ${email} printf "\n\n" >> ${email} done fi