zabbix 以html格式邮件报警

样板:

#邮件报警脚本

  1. #!/bin/sh
  2. export smtpemailfrom="Zabbix_monit[email protected]"
  3. export zabbixemailto="$1"
  4. export zabbixsubject="$2"
  5. export zabbixbody="$3"
  6. export smtpserver=mail.server.host
  7. #export smtplogin=SMTP_LOGIN
  8. #export smtppass=SMTP_PASSWORD
  9. /usr/bin/sendEmail \
  10. -f $smtpemailfrom \
  11. -t $zabbixemailto \
  12. -u $zabbixsubject \
  13. -m $zabbixbody \
  14. -s $smtpserver:25 \
  15. -o tls=no \
  16. -o message-content-type=html \
  17. -o message-charset=utf8 \
  18. -o tls=auto >>/tmp/sendEmail.log

#html格式

  1. <tablealign="center"class="MsoNormalTable"border="1"cellpadding="0"style="mso-cellspacing:1.5pt; border:solid black 1.0pt; margin-top:50px;mso-yfti-tbllook:1184;mso-padding-alt:0cm0cm0cm0cm">
  2. <tbody><trstyle="mso-yfti-irow:0;mso-yfti-firstrow:yes">
  3. <tdcolspan="2"style="border:none;padding:.75pt.75pt.75pt.75pt">
  4. <pclass="MsoNormal"><spanlang="EN-US"style="font-family:&quot;Verdana&quot;,sans-serif"><ahref="http://internal.ecvision.cn/zabbix/index.php"style="color:#000000;text-decoration:none;">Zabbix
  5. Monitoring System Notification</a></span><spanlang="EN-US"style="font-size:10.0pt;
  6. font-family:&quot;Verdana&quot;,sans-serif">
  7. <o:p></o:p></span></p></td>
  8. </tr>
  9. <trstyle="mso-yfti-irow:1">
  10. <tdnowrap=""style="border:none;background:#D9D9D9;padding:.75pt.75pt.75pt.75pt">
  11. <pclass="MsoNormal"><b><spanstyle="font-size:10.0pt;font-family:
  12. &quot;Verdana&quot;,sans-serif">Trigger Status: </span></b></p></td>
  13. <tdstyle="border:none;background:#FF8080;padding:.75pt.75pt.75pt.75pt">
  14. <pclass="MsoNormal"><spanstyle="font-size:10.0pt;font-family:&quot;Verdana&quot;,sans-serif">{TRIGGER.STATUS}</span></p></td>
  15. </tr>
  16. <trstyle="mso-yfti-irow:2">
  17. <tdnowrap=""style="border:none;background:#F2F2F2;padding:.75pt.75pt.75pt.75pt">
  18. <pclass="MsoNormal"><b><spanlang="EN-US"style="font-size:10.0pt;font-family:
  19. &quot;Verdana&quot;,sans-serif">Trigger Name:
  20. </span></b></p></td>
  21. <tdstyle="border:none;padding:.75pt.75pt.75pt.75pt">
  22. <pclass="MsoNormal"><spanlang="EN-US"style="font-size:10.0pt;font-family:&quot;Verdana&quot;,sans-serif">{TRIGGER.NAME}</span></p></td>
  23. </tr>
  24. <trstyle=‘mso-yfti-irow:4‘>
  25. <tdnowrap="nowrap"style=‘border:none;background:#D9D9D9;padding:.75pt.75pt.75pt.75pt‘><pclass="MsoNormal"><b><spanstyle=‘font-size:10.0pt;font-family:
  26. &quot;Verdana&quot;,sans-serif‘lang="EN-US"xml:lang="EN-US">Trigger Severity:
  27. </span></b></p></td>
  28. <tdstyle=‘border:none;background:#FFFF80;padding:.75pt.75pt.75pt.75pt‘><pclass="MsoNormal"><spanstyle=‘font-size:10.0pt;font-family:&quot;Verdana&quot;,sans-serif‘lang="EN-US"xml:lang="EN-US">{TRIGGER.SEVERITY}
  29. </span></p></td>
  30. </tr>
  31. <trstyle="mso-yfti-irow:5">
  32. <tdnowrap=""style="border:none;background:#F2F2F2;padding:.75pt.75pt.75pt.75pt">
  33. <pclass="MsoNormal"><b><spanlang="EN-US"style="font-size:10.0pt;font-family:
  34. &quot;Verdana&quot;,sans-serif">Trigger Time:</span></b></p></td>
  35. <tdstyle="border:none;background:#F2F2F2;padding:.75pt.75pt.75pt.75pt">
  36. <pclass="MsoNormal"><spanlang="EN-US"style="font-size:10.0pt;font-family:&quot;Verdana&quot;,sans-serif">{EVENT.DATE}&nbsp;&nbsp;{EVENT.TIME}</span></p></td>
  37. </tr>
  38. <trstyle=‘mso-yfti-irow:6‘>
  39. <tdnowrap=""style="border:none;background:#D9D9D9;padding:.75pt.75pt.75pt.75pt">
  40. <pclass="MsoNormal"><b><spanlang="EN-US"style="font-size:10.0pt;font-family:
  41. &quot;Verdana&quot;,sans-serif">Trigger Severity:</span></b></p></td>
  42. <tdstyle=‘border:none;padding:.75pt.75pt.75pt.75pt‘><pclass="MsoNormal"><spanstyle="font-size:10.0pt;font-family:&quot;Verdana&quot;,sans-serif">{TRIGGER.NSEVERITY}</span></p></td>
  43. </tr>
  44. <trstyle="mso-yfti-irow:7">
  45. <tdnowrap=""style="border:none;background:#F2F2F2;padding:.75pt.75pt.75pt.75pt">
  46. <pclass="MsoNormal"><b><spanlang="EN-US"style="font-size:10.0pt;font-family:
  47. &quot;Verdana&quot;,sans-serif">Host Name:</span></b></p></td>
  48. <tdstyle="border:none;background:#F2F2F2;padding:.75pt.75pt.75pt.75pt">
  49. <pclass="MsoNormal"><spanstyle="font-size:10.0pt;font-family:&quot;Verdana&quot;,sans-serif">{HOST.NAME}</span></p></td>
  50. </tr>
  51. <trstyle="mso-yfti-irow:8">
  52. <tdnowrap=""style="border:none;background:#D9D9D9;padding:.75pt.75pt.75pt.75pt">
  53. <pclass="MsoNormal"><b><spanstyle="font-size:10.0pt;font-family:
  54. &quot;Verdana&quot;,sans-serif">IP Address:
  55. </span></b></p></td>
  56. <tdstyle="border:none;padding:.75pt.75pt.75pt.75pt">
  57. <pclass="MsoNormal"><spanstyle="font-size:10.0pt;font-family:&quot;Verdana&quot;,sans-serif">{HOST.IP}</span></p></td>
  58. </tr>
  59. <trstyle="mso-yfti-irow:9">
  60. <tdnowrap=""style="border:none;background:#F2F2F2;padding:.75pt.75pt.75pt.75pt">
  61. <pclass="MsoNormal"><b><spanlang="EN-US"style="font-size:10.0pt;font-family:
  62. &quot;Verdana&quot;,sans-serif">Item Values:</span></b></p></td>
  63. <tdstyle="border:none;background:#F2F2F2;padding:.75pt.75pt.75pt.75pt">
  64. <pclass="MsoNormal"><spanlang="EN-US"style="font-size:10.0pt;font-family:&quot;Verdana&quot;,sans-serif">{ITEM.NAME1} ({HOST.NAME1}:{ITEM.KEY1}): {ITEM.VALUE1}</span></p></td>
  65. </tr>
  66. <trstyle="mso-yfti-irow:10;mso-yfti-lastrow:yes">
  67. <tdnowrap=""style="border:none;background:#D9D9D9;padding:.75pt.75pt.75pt.75pt">
  68. <pclass="MsoNormal"><b><spanlang="EN-US"style="font-size:10.0pt;font-family:
  69. &quot;Verdana&quot;,sans-serif">Original Event ID:<o:p></o:p></span></b></p></td>
  70. <tdstyle="border:none;padding:.75pt.75pt.75pt.75pt">
  71. <pclass="MsoNormal"><spanlang="EN-US"style="font-size:10.0pt;font-family:&quot;Verdana&quot;,sans-serif">{EVENT.ID}</span></p></td>
  72. </tr>
  73. </tbody>
  74. </table>
  75. <pclass="foot"align="center"style="text-align:center"><spanlang="EN-US"style="font-size:10.0pt;font-family:&quot;Verdana&quot;,sans-serif"><ahref="http://internal.ecvision.cn/zabbix/index.php"style="color:#000000;text-decoration:none;">Generated by Zabbix,
  76. the OpenSource monitoring solution by AmberRoad.com</a>
  77. </span></p>

来自为知笔记(Wiz)

时间: 2024-08-02 02:43:40

zabbix 以html格式邮件报警的相关文章

zabbix 3.0监控邮件报警

zabbix 3.0 监控邮件报警 1.在监控服务器的/usr/local/zabbix/bin创建发送邮件脚本  vim send.py #!/usr/bin/env python  # -*- coding: utf-8 -*-  #!/usr/bmport pdb  import smtplib import string import time import sys reload(sys) sys.setdefaultencoding('utf-8') #pdb.set_trace() 

zabbix自动注册及邮件报警

自动注册 自动注册,基于注册规则,匹配主机名,必须是客户端安装好agent,如果需要添加监控,需创建Actions动作 (1)打开Zabbix服务端,选择"配置"-"动作",事件源选择"自动注册",创建新的动作 (2)在"动作"配置项,添加新的触发条件为"主机名称非似 Linux":在"操作"配置项,创建新的操作:添加主机.添加到主机群组:Linux servers.链接到模板:Temp

简单操作Zabbix安装配置与邮件报警(centos 7.4)

Zabbix官网下载地址:https://www.zabbix.com/download 实验拓扑:zabbix server端: 192.168.80.101 公网环境 centos 7.4 LAMP架构zabbix angent端: 192.168.80.102 公网环境 centos 7.4注:zabbix(音同 z?bix)是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案.zabbix由2部分构成,zabbix server与可选组件zabbix agent

在LAMP架构中部署zabbix监控系统及邮件报警机制

初步了解zabbix: Zabbix能监视各种网络参数,保证服务器系统的安全运营:并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题.是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案.被监控对象只要支持SNMP协议或者运行zabbix_agents代理程序即可.agent端:主机通过安装agent方式采集数据.server端:通过收集agent发送的数据,写入数据库(MySQL,ORACLE等),再通过php+apache在web前端展示. SNMP:

zabbix 自定义参数及邮件报警

一. 自定义参数 在zabbix-agent主机上根据命令定义参数例:查看当前系统登录用户数uptime | awk -F " " '{print $5}' //根据shell命令查找出当前登录用户数vi /etc/zabbix/zabbix_agentd.d/testparam.conf //新建参数配置文件testparam.confUserParameter=login-user,uptime | awk -F " " '{print $5}' //在配置文件

zabbix 3.0.2邮件报警

sendEmail是一个轻量级,命令行的SMTP邮件客户端.如果你需要使用命令行发送邮件,那么sendEmail是非常完美的选择:使用简单并且功能强大.这个被设计用在php.bash perl和web站点使用. 请注意,不是sendmail.我第一次看到这个名字,直接yum install -y sendmail了 然后下面就蒙圈了. 下载软件 wget http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.56.tar.

zabbix配置外网邮件报警

1. 基本条件 zabbix服务器端已经建立并且运行 zabbix客户端已经建立并且运行 2. 需要安装的软件包 编译安装msmtp包,yum安装mutt包 3. 配置过程 3.1 配置msmtp 下载并安装msmtp包 http://sourceforge.net/projects/msmtp/files/msmtp/1.6.2/ 安装msmtp tar jxvf msmtp-1.6.2.tar.bz2 cd msmtp-1.6.2 ./configure  make make install

zabbix监控之同时向多人邮件报警

zabbix做为一款监控软件,报警是必不可少的,该文章主要介绍zabbix向多人邮件报警的配置过程. zabbix邮件报警配置步骤说明: 1.  准备一个发送邮件的脚本 2.  修改zabbix配置文件中指定的脚本路径 3.关联脚本名称 4.用户设置收件邮箱与报警时间 5.配置报警触发器 6.添加多个用户,同时给多个人发邮件 7.邮件接收测试 1.准备一个发送邮件的脚本 发送邮件有很多方法,自己写脚本的话,只要遵循zabbix传参的格式即可. zabbix发送邮件传参格式:./sendmail.

05、zabbix邮件报警

Zabbix监控服务端.客户端都已经部署完成,被监控主机已经添加,Zabiix监控运行正常,通过查看Zabbix监控服务器,可以了解服务器的运行状态是否正常,运维人员不会时刻登录Zabbix监控平台刷新,查看服务器的状态. 可以在Zabbix服务端设置邮件报警,当被监控主机宕机或者达到设定的触发器预设值时,不管任何时候,会自动发送报警邮件.微信信息到指定的人员,运维人员收到信息有利于第一时间解决故障.Zabbix邮件报警设置步骤如下: 1) 设置邮件模板及邮件服务器 Administration