zhangrj / zabbix-email-with-graph

zabbix发送带有监控项图形的告警邮件
Apache License 2.0
4 stars 0 forks source link

告警邮件发送成功 #1

Open 37705109 opened 4 years ago

37705109 commented 4 years ago

告警邮件发送成功,实际收不到邮件,测试脚本发送邮件正常,zabbix版本4.4

zhangrj commented 4 years ago

使用“管理”-“报警媒介类型”-“动作”,点击“测试”,显示什么内容?

37705109 commented 4 years ago

------------------ 原始邮件 ------------------ 发件人: "张荣杰"<notifications@github.com>; 发送时间: 2020年4月27日(星期一) 下午4:37 收件人: "zhangrj/zabbix-email-with-graph"<zabbix-email-with-graph@noreply.github.com>; 抄送: "明鏡止水"<37705109@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [zhangrj/zabbix-email-with-graph] 告警邮件发送成功 (#1)

使用“管理”-“报警媒介类型”-“动作”,点击“测试”,显示什么内容?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

37705109 commented 4 years ago

对了,测试成功之后,邮箱也是收不到邮件的

------------------ 原始邮件 ------------------ 发件人: "张荣杰"<notifications@github.com>; 发送时间: 2020年4月27日(星期一) 下午4:37 收件人: "zhangrj/zabbix-email-with-graph"<zabbix-email-with-graph@noreply.github.com>; 抄送: "明鏡止水"<37705109@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [zhangrj/zabbix-email-with-graph] 告警邮件发送成功 (#1)

使用“管理”-“报警媒介类型”-“动作”,点击“测试”,显示什么内容?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

37705109 commented 4 years ago

直接脚本测试,是可以收到邮件的

------------------ 原始邮件 ------------------ 发件人: "张荣杰"<notifications@github.com>; 发送时间: 2020年4月27日(星期一) 下午4:37 收件人: "zhangrj/zabbix-email-with-graph"<zabbix-email-with-graph@noreply.github.com>; 抄送: "明鏡止水"<37705109@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [zhangrj/zabbix-email-with-graph] 告警邮件发送成功 (#1)

使用“管理”-“报警媒介类型”-“动作”,点击“测试”,显示什么内容?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

zhangrj commented 4 years ago

/usr/lib/zabbix/alertscripts/email.html,这个文件内容是否有更新?

脚本第78行改成4.4

zhangrj commented 4 years ago

点击测试按钮后,email,html内容是否更新为This is the test message from Zabbix

37705109 commented 4 years ago

email.html内容

------------------ 原始邮件 ------------------ 发件人: "张荣杰"<notifications@github.com>; 发送时间: 2020年4月27日(星期一) 下午5:01 收件人: "zhangrj/zabbix-email-with-graph"<zabbix-email-with-graph@noreply.github.com>; 抄送: "明鏡止水"<37705109@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [zhangrj/zabbix-email-with-graph] 告警邮件发送成功 (#1)

/usr/lib/zabbix/alertscripts/email.html,这个文件内容是否有更新?

脚本第78行改成4.4

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

37705109 commented 4 years ago

我测试了一下,清空email.html文件内容,点击测试 之后

------------------ 原始邮件 ------------------ 发件人: "张荣杰"<notifications@github.com>; 发送时间: 2020年4月27日(星期一) 下午5:01 收件人: "zhangrj/zabbix-email-with-graph"<zabbix-email-with-graph@noreply.github.com>; 抄送: "明鏡止水"<37705109@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [zhangrj/zabbix-email-with-graph] 告警邮件发送成功 (#1)

点击测试按钮后,email,html内容是否更新为This is the test message from Zabbix

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

37705109 commented 4 years ago

此地方参数填写错误,现已更改为正确的数值

------------------ 原始邮件 ------------------ 发件人: "张荣杰"<notifications@github.com>; 发送时间: 2020年4月27日(星期一) 下午5:01 收件人: "zhangrj/zabbix-email-with-graph"<zabbix-email-with-graph@noreply.github.com>; 抄送: "明鏡止水"<37705109@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [zhangrj/zabbix-email-with-graph] 告警邮件发送成功 (#1)

点击测试按钮后,email,html内容是否更新为This is the test message from Zabbix

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

37705109 commented 4 years ago

即使如此,zabbix出现的告警邮件还是无法收到

显示是已送达

------------------ 原始邮件 ------------------ 发件人: "张荣杰"<notifications@github.com>; 发送时间: 2020年4月27日(星期一) 下午5:01 收件人: "zhangrj/zabbix-email-with-graph"<zabbix-email-with-graph@noreply.github.com>; 抄送: "明鏡止水"<37705109@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [zhangrj/zabbix-email-with-graph] 告警邮件发送成功 (#1)

点击测试按钮后,email,html内容是否更新为This is the test message from Zabbix

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

zhangrj commented 4 years ago

请看下email.html内容是否更新?这样可以知道脚本大致是在哪一步出错

37705109 commented 4 years ago

email内容有更新 ------------------ 原始邮件 ------------------ 发件人: "张荣杰"<notifications@github.com>; 发送时间: 2020年4月27日(星期一) 下午5:11 收件人: "zhangrj/zabbix-email-with-graph"<zabbix-email-with-graph@noreply.github.com>; 抄送: "明鏡止水"<37705109@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [zhangrj/zabbix-email-with-graph] 告警邮件发送成功 (#1)

请看下email.html内容是否更新?这样可以知道脚本大致是在哪一步出错

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

37705109 commented 4 years ago

告警emial.html有更新

但是就是收不到邮件!

------------------ 原始邮件 ------------------ 发件人: "张荣杰"<notifications@github.com>; 发送时间: 2020年4月27日(星期一) 下午5:11 收件人: "zhangrj/zabbix-email-with-graph"<zabbix-email-with-graph@noreply.github.com>; 抄送: "明鏡止水"<37705109@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [zhangrj/zabbix-email-with-graph] 告警邮件发送成功 (#1)

请看下email.html内容是否更新?这样可以知道脚本大致是在哪一步出错

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

zhangrj commented 4 years ago

那说明脚本已经执行到:

content_txt.write(content) os.system("/usr/local/bin/sendEmail -f " + smtp_user + " -t " + receiver + " -s " + smtp_server + " -u \'" + subject + "\' -o message-content-type=html -o message-charset=utf-8 -xu " + smtp_user + " -xp " + s mtp_pwd + " -o message-file=/usr/lib/zabbix/alertscripts/email.html")

手动执行一下os.system里的命令,看看结果

37705109 commented 4 years ago

------------------ 原始邮件 ------------------ 发件人: "张荣杰"<notifications@github.com>; 发送时间: 2020年4月27日(星期一) 下午5:19 收件人: "zhangrj/zabbix-email-with-graph"<zabbix-email-with-graph@noreply.github.com>; 抄送: "明鏡止水"<37705109@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [zhangrj/zabbix-email-with-graph] 告警邮件发送成功 (#1)

那说明脚本已经执行到:

content_txt.write(content) os.system("/usr/local/bin/sendEmail -f " + smtp_user + " -t " + receiver + " -s " + smtp_server + " -u \'" + subject + "\' -o message-content-type=html -o message-charset=utf-8 -xu " + smtp_user + " -xp " + s mtp_pwd + " -o message-file=/usr/lib/zabbix/alertscripts/email.html")

手动执行一下os.system里的命令,看看结果

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

37705109 commented 4 years ago

请问这样如何更改语句呢?  我把两个''去掉也报错

------------------ 原始邮件 ------------------ 发件人: "张荣杰"<notifications@github.com>; 发送时间: 2020年4月27日(星期一) 下午5:19 收件人: "zhangrj/zabbix-email-with-graph"<zabbix-email-with-graph@noreply.github.com>; 抄送: "明鏡止水"<37705109@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [zhangrj/zabbix-email-with-graph] 告警邮件发送成功 (#1)

那说明脚本已经执行到:

content_txt.write(content) os.system("/usr/local/bin/sendEmail -f " + smtp_user + " -t " + receiver + " -s " + smtp_server + " -u \'" + subject + "\' -o message-content-type=html -o message-charset=utf-8 -xu " + smtp_user + " -xp " + s mtp_pwd + " -o message-file=/usr/lib/zabbix/alertscripts/email.html")

手动执行一下os.system里的命令,看看结果

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

37705109 commented 4 years ago

报错信息,我自己使用senemail发送是成功的

------------------ 原始邮件 ------------------ 发件人: "张荣杰"<notifications@github.com>; 发送时间: 2020年4月27日(星期一) 下午5:19 收件人: "zhangrj/zabbix-email-with-graph"<zabbix-email-with-graph@noreply.github.com>; 抄送: "明鏡止水"<37705109@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [zhangrj/zabbix-email-with-graph] 告警邮件发送成功 (#1)

那说明脚本已经执行到:

content_txt.write(content) os.system("/usr/local/bin/sendEmail -f " + smtp_user + " -t " + receiver + " -s " + smtp_server + " -u \'" + subject + "\' -o message-content-type=html -o message-charset=utf-8 -xu " + smtp_user + " -xp " + s mtp_pwd + " -o message-file=/usr/lib/zabbix/alertscripts/email.html")

手动执行一下os.system里的命令,看看结果

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

37705109 commented 4 years ago

您好,经过一番更改,邮件发送成功,也成功收到了邮件,是否要按照我的更改来改你的脚本命令?

------------------ 原始邮件 ------------------ 发件人: "张荣杰"<notifications@github.com>; 发送时间: 2020年4月27日(星期一) 下午5:19 收件人: "zhangrj/zabbix-email-with-graph"<zabbix-email-with-graph@noreply.github.com>; 抄送: "明鏡止水"<37705109@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [zhangrj/zabbix-email-with-graph] 告警邮件发送成功 (#1)

那说明脚本已经执行到:

content_txt.write(content) os.system("/usr/local/bin/sendEmail -f " + smtp_user + " -t " + receiver + " -s " + smtp_server + " -u \'" + subject + "\' -o message-content-type=html -o message-charset=utf-8 -xu " + smtp_user + " -xp " + s mtp_pwd + " -o message-file=/usr/lib/zabbix/alertscripts/email.html")

手动执行一下os.system里的命令,看看结果

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

zhangrj commented 4 years ago

您好,可以将修改的地方贴出来看一下嘛?我希望看一下问题出在哪里。目前脚本在多套生产性监控系统应用一年多,没有发现问题。

或者fork到本地,修改后pull。

37705109 commented 4 years ago

原因找到了,不是脚本问题,是这边的参数填写错误,因为是手动填写的,谢谢

------------------ 原始邮件 ------------------ 发件人: "张荣杰"<notifications@github.com>; 发送时间: 2020年4月28日(星期二) 上午10:27 收件人: "zhangrj/zabbix-email-with-graph"<zabbix-email-with-graph@noreply.github.com>; 抄送: "明鏡止水"<37705109@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [zhangrj/zabbix-email-with-graph] 告警邮件发送成功 (#1)

您好,可以将修改的地方贴出来看一下嘛?我希望看一下问题出在哪里。目前脚本在多套生产性监控系统应用一年多,没有发现问题。

或者fork到本地,修改后pull。

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

37705109 commented 4 years ago

收到的邮件,告警信息没有换行,这个是否后期可以更改?

------------------ 原始邮件 ------------------ 发件人: "张荣杰"<notifications@github.com>; 发送时间: 2020年4月28日(星期二) 上午10:27 收件人: "zhangrj/zabbix-email-with-graph"<zabbix-email-with-graph@noreply.github.com>; 抄送: "明鏡止水"<37705109@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [zhangrj/zabbix-email-with-graph] 告警邮件发送成功 (#1)

您好,可以将修改的地方贴出来看一下嘛?我希望看一下问题出在哪里。目前脚本在多套生产性监控系统应用一年多,没有发现问题。

或者fork到本地,修改后pull。

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

zhangrj commented 4 years ago

是否换行取决于写email.html的代码,在zabbix web端的动作中,消息内容行尾加入
,即可换行。

zhangrj commented 4 years ago

Html换行符<br/>

37705109 commented 4 years ago

好的,谢谢,已在动作加上换行符

------------------ 原始邮件 ------------------ 发件人: "张荣杰"<notifications@github.com>; 发送时间: 2020年4月28日(星期二) 上午10:36 收件人: "zhangrj/zabbix-email-with-graph"<zabbix-email-with-graph@noreply.github.com>; 抄送: "明鏡止水"<37705109@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [zhangrj/zabbix-email-with-graph] 告警邮件发送成功 (#1)

Html换行符<br/>

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.