Added more statistics, renamed print_pidstat to print_stats

This commit is contained in:
Trey Blancher 2023-08-26 09:03:15 -04:00
parent 7c6742a1b2
commit 030f4f34f1

View File

@ -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