NAGIOS uses SendMail to send messages about the title garbled solution

Source: Internet
Author: User

The company's Nagios alarm sent Mail, the title garbled, I solve the problem, found that only to the company's Sina Enterprise mailbox sent mail will produce garbled problems (garbled title), and to my own mailbox (163,QQ) sent will not have garbled problems, consider sending mail and receiving mail, Only send e-mail can be considered, receive mail is not considered (the mailbox is not encoded .....) ), so can only change the configuration or change the mailbox (must use the Enterprise mailbox), so there is only one way to modify the configuration; Search the internet for a long time to see many solutions, which draw on (Http://blog.sina.com.cn/s/blog_ 485acedb0100z51f.html) This blog, but this method simply does not work, after the change, Nagios alarm will not send mail, and then I changed the code on this basis, and then I can, change the code as follows:

# ' notify-host-by-email ' command definition (old)
#define command{
# command_name Notify-host-by-email
# command_line/usr/bin/printf "%b" "* * * Nagios *****\n\n Status: $HOSTSTATE $\n host IP: $HOSTADDRESS $\ninfo: $HOSTOUTPUT $\n\ N Time: $LONGDATETIME $\n "| /usr/bin/mail-s "$HOSTSTATE $: $HOSTNAME $" $CONTACTEMAIL $
#}
# (NEW)-wangli
Define command{
Command_name Notify-host-by-email
command_line/usr/bin/printf "%b" * * * * Nagios *****\n\n Status: $HOSTSTATE $\n host IP: $HOSTADDRESS $ \ninfo: $HOSTOUTPUT $\n\n time: $LONGDATETIME $\n "| /usr/bin/mail -a "Content-type:utf-8"-S "=?utf-8? B? ' Echo ' $HOSTSTATE $: $HOSTNAME $ "|base64 '? =" $CONTACTEMAIL $
}

# ' notify-service-by-email ' command definition (old)
#define command{
# command_name Notify-service-by-email
# command_line/usr/bin/printf "%b" "* * * * Nagios *****\n\n service: $SERVICEDESC $\n host IP: $HOSTADDRESS $\n Status: $ servicestate$\n\n Time: $SHORTDATETIME $\n\n additional information: \n\n$serviceoutput$\n "| /usr/bin/mail-s "* * $SERVICESTATE $: $HOSTADDRESS $ $SERVICEDESC $ * *" $CONTACTEMAIL $
#}
# (NEW)-wangli
Define command{
Command_name notify-service-by-email
command_line/usr/bin/printf "%b" "* * * Nagios *****\n\n Service: $ servicedesc$\n Host IP: $HOSTADDRESS $\n Status: $SERVICESTATE $\n\n time: $SHORTDATETIME $\n\n additional information: \n\n$serviceoutput$\n "| /usr/bin/mail -a "Content-type:utf-8"-S "=?utf-8? B? ' Echo ' * * $SERVICESTATE $: $HOSTADDRESS $ $SERVICEDESC $ * * "|base64 '? =" $CONTACTEMAIL $
}

Simple summary of said: is to put the e-mail address outside the base, put on the inside do not know what reason the mail sent not to go out, I guess is the e-mail address does not recognize the problem; studied the issue of Nagios alarm email for several days, Guess: If send mail with SendEmail do not know will not produce this problem, no root user password, can't install SendEmail, idea can not realize ...

The instructions summarized on the command line are:
mail -a "Content-Type:utf-8" -s "=?utf-8?B?`echo <主题> | base64`?=" [email protected] < emailtextfile

Reprint please specify the source! Http://www.cnblogs.com/milude0161/p/4205414.html

NAGIOS uses SendMail to send messages about the title garbled solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.