diff --git a/psi-alerts.sh b/psi-alerts.sh index baaa8ea..171ea11 100755 --- a/psi-alerts.sh +++ b/psi-alerts.sh @@ -61,7 +61,7 @@ get_ssh_agent () { for dir in /tmp/ssh-*; do if [[ -O ${dir} ]]; then # only choose the last agent - export SSH_AGENT_PID=$(ps -eaf | grep ssh-agent | grep -v grep | \ + export SSH_AGENT_PID=$(ps -eaf | grep '[s]sh-agent' | \ grep ${user} | awk '{print $2}') export SSH_AUTH_SOCK=$(ls ${dir}/agent.* | tail -1) fi @@ -186,11 +186,12 @@ send () { subj="PSI on ${host} ${psi_type} triggered!" current_alarms="${psi_type}" fi - + print_psi "${psi_type}" >> ${email} + printf "\n\n" >> ${email} # is this an email or SMS? if [[ ! "${dst}" =~ "@${sms_domain}" ]]; then for p in $(tr '|' ' ' <<< "${current_alarms}"); do - printf "\nStatistics info for ${p}\n\n" >> ${email} + printf "\n\nStatistics info for ${p}\n\n" >> ${email} print_stats "${p}" >> ${email} printf "\n\n" >> ${email} done