zabbix邮箱告警配置
zabbix邮箱告警配置
文章目录
- zabbix邮箱告警配置
- 环境准备
- 一、第三方邮箱
- 测试效果一
- 测试效果二
- 二、第三方邮箱+脚本
- 测试
环境准备
服务 | ip | 主机名 |
---|---|---|
服务端 | 192.168.87.129 | server |
客户端 | 192.168.87.133 | agent |
1.关闭防火墙和selinux |
服务端
[root@server ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)Active: inactive (dead)Docs: man:firewalld(1)
[root@server ~]# cat /etc/selinux/config # This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted客户端
[root@agent ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)Active: inactive (dead)Docs: man:firewalld(1)
[root@agent ~]# cat /etc/selinux/config # This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
2.设置主机名
[root@server ~]# hostnamectl set-hostname server.example.com
[root@server ~]# bash
[root@server ~]# hostname
server.example.com[root@agent ~]# hostnamectl set-hostname agent.example.com
[root@agent ~]# bash
[root@agent ~]# hostname
agent.example.com
3.修改配置文件/etc/hosts
[root@server ~]# vim /etc/hosts
[root@server ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.87.129 server.example.com server
192.168.87.133 agent.example.com agent[root@agent yum.repos.d]# vim /etc/hosts
[root@agent yum.repos.d]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.87.129 server.example.com server
192.168.87.133 agent.example.com agent
3、安装postfix软件
[root@server ~]# yum install -y postfix
4、修改postfix的主配置文件,并重启服务和设置下次启动生效
[root@server ~]# vim /etc/postfix/main.cfmydestination = $myhostname, localhost.$mydomain, localhost,$mydomain
(找到配置信息在后添加$mydomain)[root@server ~]# systemctl restart postfix.service
[root@server ~]# systemctl enable postfix.service
Created symlink /etc/systemd/system/multi-user.target.wants/postfix.service → /usr/lib/systemd/system/postfix.service.
5.创建用户生成邮箱安装
[root@server ~]# useradd zhengbichao
[root@server ~]# ls /home/
zhengbichao
[root@server ~]# cd /var/spool/mail/
[root@server mail]# ll
total 0
-rw-rw---- 1 zhengbichao mail 0 Sep 5 11:18 zhengbichao
[root@server ~]# yum install -y mailx
一、第三方邮箱
1.注册163邮箱
2.开启SMTP服务和POP3服务,会生成一个授权码,需要记住这个授权码
3、修改报警媒介类型–email
4.配置动作
测试效果一
去到163邮箱查看
测试效果二
如图测试agent连接超过七个时是否还会发送邮箱
[root@agent ~]# who | wc -l
8
去到163邮箱查看
当连接数恢复到小于七个时
[root@agent ~]# who | wc -l
2
查看163邮箱
二、第三方邮箱+脚本
1.改mailx配置文件
[root@server ~]# vim /etc/mail.rc
在文件末尾添加
set from=zbc2992554169@163.com
set smtp=smtp.163.com
set smtp-auth-user=zbc2992554169@163.com
set smtp-auth-password=IZJKSIFSYZUCHZHR
set smtp-auth=login
set ssl-verify=ignore[root@server ~]# id zabbix
uid=993(zabbix) gid=990(zabbix) groups=990(zabbix)
[root@server ~]# chown -R zabbix.zabbix /etc/mail.rc
2.在zabbix服务端写邮件发送脚本
[root@server alertscripts]# vim mail-send.sh
[root@server alertscripts]# cat mail-send.sh
#!/bin/bash
messages=`echo $3 | tr '\r\n' '\n'`
subject=`echo $2 | tr '\r\n' '\n'`
echo "${messages}" | mailx -s "${subject}" $1 [root@server alertscripts]# chmod +x mail-send.sh
[root@server alertscripts]# chown -R zabbix.zabbix mail-send.sh
[root@server alertscripts]# ll
total 4
-rwxr-xr-x 1 zabbix zabbix 130 Sep 5 12:40 mail-send.sh
3.测试邮箱能否接收邮件
[root@server alertscripts]# ./mail-send.sh zbc2992554169@163.com "zabbix" "hello "
查看163邮箱
4.创建报警媒介类型
测试
[root@agent ~]# who | wc -l
8
查看163邮箱
当用户连接少于七个时检验
[root@agent ~]# who | wc -l
2
zabbix邮箱告警配置相关推荐
- Zabbix创建用户及告警媒介配置,配置qq邮箱告警配置/163(下)
Zabbix创建用户及告警媒介配置,配置qq邮箱告警配置/163(下) 上篇文章我们在虚拟机里安装了mailx服务, 修改了mail.rc的配置文件 在zabbix-server的邮件配置路径下创建了 ...
- Linux服务管理-zabbix监控邮箱告警配置
zabbix监控邮箱告警配置及自定义监控 1.在web界面配置 详情请看https://blog.csdn.net/Mzh_CSDN/article/details/107433532 2.通过脚本用 ...
- zabbix邮箱告警的三种方式
zabbix邮箱告警的三种方式 1.在web界面配置邮箱告警 2.在本地邮箱配置邮箱告警+脚本 3.在第三方邮箱配置邮箱告警+脚本 1.在web界面配置邮箱告警 添加媒介 我们以126邮箱为示例 先打 ...
- Zabbix邮件告警配置
管理-报警媒介类型- Email 直接克隆一个出来 名称不能重复 右侧可以点击测试,我自己发给自己测一下 邮箱发送端测试好了,来到配置-动作-勾选动作-启用 来到user settings-报警媒介- ...
- zabbix邮箱告警
1.1.邮件通知: 通过企业邮箱.第三方服务商邮箱发送报警邮件通知运维工程师. 1.2.邮箱开启SMTP: 如果是QQ邮箱需要单独开启SMTP,其他邮箱具体联系服务商. 确认是已经打开状态,如果是未开 ...
- 【Zabbix】Zabbix微信告警配置演示
文章目录 参考连接 1.注册企业微信 2.配置企业微信 3.配置Zabbix服务器 1.确认记录相关信息 2.修改zabbix.conf 3.下载并设置脚本 4.执行脚本进行测试 4.在zabbix ...
- zabbix监控配置及邮箱告警
zabbix监控配置及邮箱告警 zabbix监控指标 zabbix监控配置流程 zabbix监控配置流程详解 客户端配置 服务端配置 1.添加主机 2.添加监控项 使用模板添加 自定义模板 添加监控项 ...
- @Zabbix配置邮箱告警及钉钉告警
文章目录 1.邮件告警配置 1)本地mail搭建 2)zabbix server配置 3)zabbix web配置 4)查看告警动作 2.钉钉告警配置 1)创建接收告警群 2)创建群聊机器人 3)告警 ...
- Zabbix 系统监控(三)VMware 虚拟平台监控、邮件告警、企业微信告警配置
Vmware 虚拟平台监控.邮件告警.企业微信告警配置 8 Vmware 虚拟平台监控 阅读 zabbix 官方文档,官方提供了 Vmware 虚拟机监控模板,并对模板进行了解释说明,但未对相应名词做 ...
- zabbix告警配置
更多文章请移步:www.yanjun.pro 1.告警工作流程 告警概述 告警是监控的重要职能,是指将达到某一阈值事件的消息发送给用户,让用户在事件发生后即可知道监控指标是否超过规定阈值,从而决定是否 ...
最新文章
- 自动驾驶行业内时间表和技术解析
- 微信8年,你从中学到了什么?
- html登录界面_php实现登录功能
- Codeforces Round #413 C-Fountains 树状数组
- php psot传值_三种方法教你如何用PHP模拟post提交数据
- dpkg: 处理归档 /var/cache/apt/archives/libpng12-0_1.2.54-1ubuntu1.1_amd64.deb (--unpack)时出错: 无法安装 /lib/
- 三点滑动平均法怎么计算的_孔径千分尺怎么用,能看懂吗?
- [Unity2018.3新功能]Prefab嵌套和变体
- python知识点查阅
- memcached全面剖析–2. 理解memcached的内存存储
- 关于微软企业库中依赖注入容器Unity两种生成对象的实现
- python如何画出多个独立的图片_python使用matplotlib:subplot绘制多个子图的示例
- python前端用什么写_Python 竟然也可以写网页前端了
- android 比较全的android 源码合集 + 企业级应用分享,从业的积累(加强版)
- android 换肤 字体颜色,Android换肤
- 欢迎关注异贝!今天异贝与您一起分享:美容行业异贝引客方案设计!
- 微信公众号开发之(21)视频
- 实例演绎Unix/Linux的一切皆文件思想
- uniapp连接低功耗打印机实例,
- discuz 配置 上传远程附件
热门文章
- python爬取文件内容_python爬取各类文档方法归类汇总
- Principle for Mac(交互式UI原型设计神器)
- ppt太大了怎么压缩?
- 【MindSpore易点通机器人-01】你也许见过很多知识问答机器人,但这个有点不一样
- 创业怎么赚信息差的钱?信息差的项目有哪些?
- spyder的变量窗口显示不全
- macos复制粘贴快捷键 快速_mac os系统复制粘贴ctrl+c ctrl+v快捷键实现方式
- tomcat启动过程报the JDBC Driver has been forcibly unregistered问题的修复的一种方法
- 各类木材强度_常用木材分类
- python实现素数判断