zabbix通过mailx报警配置
cat <<EOF>> ~/163_alert_conf.sh
#!/bin/bash
CERT_DIR=/home/zabbix/.certs
mkdir -p /home/zabbix/.certs
chown -R zabbix.zabbix /home/zabbix/
echo -n | openssl s_client -connect smtp.163.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > $CERT_DIR/163.crt
certutil -A -n "GeoTrust SSL CA" -t "C,," -d $CERT_DIR -i $CERT_DIR/163.crt
certutil -A -n "GeoTrust Global CA" -t "C,," -d $CERT_DIR -i $CERT_DIR/163.crt
certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d $CERT_DIR -i $CERT_DIR/163.crt
EOF
cat <<EOF>> /etc/mail.rc
set from=xxx@163.com
set smtp="smtps://smtp.163.com:465"
set smtp-auth-user=xxx@163.com
set smtp-auth-password=xxxx
set smtp-auth=login
set ssl-verify=ignore
set nss-config-dir=/home/zabbix/.certs
EOF
cat <<EOF>> /usr/lib/zabbix/alertscripts/mail.sh
#!/bin/bash
SENT_TO=$1
SENT_SUBJECT=$2
SENT_CONTENT="/tmp/alert_$$.tmp"
echo "$3" > $SENT_CONTENT
dos2unix $SENT_CONTENT
mailx -s $SENT_SUBJECT $SENT_TO < $SENT_CONTENT
标签:set,zabbix,CERT,邮件,DIR,Zabbix04,SENT,163
From: https://www.cnblogs.com/lixunblogs/p/18167446