标签:hid div 系统 外网 vim 邮件发送 dos osi -o
[root@rexen etc]# vim /usr/local/zabbix/etc/zabbix_server.conf
474 ### Option: AlertScriptsPath
475 # Full path to location of custom alert scripts.
476 # Default depends on compilation options.
477 #
478 # Mandatory: no
479 # Default:
480 AlertScriptsPath=/usr/local/zabbix/share/zabbix/alertscripts #放开这里的注释,我们把告警脚本写在这里.
[root@rexen etc]# vim /usr/local/zabbix/etc/zabbix_server.conf
474 ### Option: AlertScriptsPath
475 # Full path to location of custom alert scripts.
476 # Default depends on compilation options.
477 #
478 # Mandatory: no
479 # Default:
480 AlertScriptsPath=/usr/local/zabbix/share/zabbix/alertscripts #放开这里的注释,我们把告警脚本写在这里.
[root@rexen etc]# cd /usr/local/zabbix/share/zabbix/alertscripts
[root@rexen alertscripts]# vim sendmail.sh
#!/bin/bash
export LANG=zh_CN.UTF-8
FILE=/tmp/mailtmp.txt
echo "$3" > $FILE
#echo "$3" | mail -s "$2" "$1"
dos2unix -k $FILE
/bin/mail -s "$2" $1 < $FILE
# 注意dos2unix需要独立安装,解决邮件没有正文(正文变成附件AT0000001.bin)的问题.
[root@rexen etc]# cd /usr/local/zabbix/share/zabbix/alertscripts
[root@rexen alertscripts]# vim sendmail.sh
export LANG=zh_CN.UTF-8
FILE=/tmp/mailtmp.txt
echo "$3" > $FILE
#echo "$3" | mail -s "$2" "$1"
dos2unix -k $FILE
/bin/mail -s "$2" $1 < $FILE
# 注意dos2unix需要独立安装,解决邮件没有正文(正文变成附件AT0000001.bin)的问题.
标签:hid div 系统 外网 vim 邮件发送 dos osi -o
原文地址:https://www.cnblogs.com/duchaoqun/p/97e1332703576a753802e29196ef20f8.html