Alternatively you can use sendEmail.
1) apt-get install sendEmail
2) Create a script “zabbix_sendemail” (chmod 755) in the AlertScriptsPath folder specified by /etc/zabbix/zabbix_server.conf
> #!/bin/sh > > export smtpemailfrom=zabbix@yourdomain.com export zabbixemailto=$1 > export zabbixsubject=$2 export zabbixbody=$3 export > smtpserver=yoursmtpserver.com export smtplogin=smtpuser export > smtppass=smtppassword > > /usr/bin/sendEmail -f $smtpemailfrom -t $zabbixemailto -u > $zabbixsubject -m $zabbixbody -s $smtpserver:25 -xu $smtplogin -xp > $smtppass
3) Set the Action (Configurations / Actions in the PHP frontend)
4) Set the Media Type (Administration / Media types in the PHP
frontend) script to zabbix_sendemail5) Add the Media to the user (Administration / Users / user in PHP
frontend) Reply With Quote
看起来你可以用这个替换脚本:
#!/bin/sh echo "$3" | /bin/mailx \ -r zabbix@yourdomain.example \ -s "$2" \ -S smtp="yoursmtpserver.example:25" \ -S smtp-auth=login \ -S smtp-auth-user="your-user" \ -S smtp-auth-password="your-password" \ "$1"
如果这些消息总是直接发送到传送MTA(即最后一个),请考虑使用端口587(提交).否则,请查看联机帮助页以了解使用STARTTLS保护密码的方法.
示例作者应该因为没有引用它们的shell变量而感到羞耻……
我认为centos将mailx放在/ bin / mailx,但也可能在/usr/bin/mailx中.
原文地址:https://www.jb51.cc/centos/373309.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。