Answer the question
In order to leave comments, you need to log in
Why don't Zabbix notifications work through an external script (SMTP with authorization), although it says "sent" in the audit?
It costs Zabbix 2.2 on Debian. Created a script for sending mail via SMTP with authorization in /usr/lib/zabbix/alertscripts/sendEmail.sh:
#!/bin/sh
export [email protected]
export zabbixemailto=$1
export zabbixsubject=$2
export zabbixbody=$3
export smtpserver=mail.domain.ru
export smtplogin=zbx
export smtppass=zbxPassword
/usr/bin/sendEmail -f $smtpemailfrom -t $zabbixemailto -u $zabbixsubject -m $zabbixbody -s $smtpserver:25 -xu $smtplogin -xp $smtppass
Answer the question
In order to leave comments, you need to log in
Problem solved. It is necessary to enclose the variables that we pass as parameters to sendMail in quotes, otherwise there is a mess. Updated the script, maybe it will be useful for someone:
#!/bin/sh
# получение данных
export MAILTO="$1"
export SUBJECT="$2"
export TEXT="$3"
# от кого будет приходить письмо
export FROM="Zabbix Server <[email protected]>"
# авторизация на удаленном SMTP
export SMTP_SERVER=mail.domain.ru
export SMTP_LOGIN=zbx
export SMTP_PASSWORD=zbxPassword
# отправка (для авторизации используется 25 порт)
# -o message-charset=UTF8 чтобы приходили по русски
/usr/bin/sendEmail -f "$FROM" -t "$MAILTO" -u "$SUBJECT" -m "$TEXT" -o message-charset=UTF8 -s $SMTP_SERVER:25 -xu $SMTP_LOGIN -xp $SMTP_PASSWORD
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question