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