zabbix安装使用

1,cent7安装zabbix

# 1,准备lamp环境
yum -y install httpd mariadb-server php php-mysql php-gd php-ldap php-mbstring 
# 2,按照指南,安装zabbix
rpm -Uvh https://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent

# 3,配置mysql数据库: root用户连接maraidb默认没有密码
systemctl start httpd mariadb
mysql -e "create database zabbix character set utf8"
mysql -e "grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'"
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pzabbix zabbix 
# 4,修改配置文件: 
#/etc/zabbix/zabbix_server.conf  = => DBPassword=zabbix
#/etc/httpd/conf.d/zabbix.conf   = => php_value date.timezone=Asia/Shanghai

# 5,启动服务
systemctl restart httpd zabbix-server zabbix-agent 
systemctl enable  httpd zabbix-server zabbix-agent mariadb

# 6,访问zabbix web页面: http://server_ip_or_name/zabbix , 用户名密码:admin/zabbix

2,zabbix配置主机监控

a, 添加cent6主机

Configuration --> Hosts --> 右上角:Create Host–> 填写参数,点击最后的Add按钮
在这里插入图片描述

b, 添加该主机的监控项:application, item, trigger

回到Configuration --> Hosts 页面,在该主机展示栏目中添加application, item
在这里插入图片描述

回到Configuration --> Hosts 页面,在该主机展示栏目中添加trigger
在这里插入图片描述

c, 添加该主机的action:发送邮件

I, 邮箱设置: 生成授权码,开启smtp服务

设置–> 客户端授权密码: (手机发送短信),设置第三方客户端的用户密码(如: 123123)
在这里插入图片描述

II, 添加action, 发送邮件

回到Administration --> Media types 页面–> 右上角:Create media type
(注:此处输入的邮箱密码是 --刚才邮箱设置的 ‘客户端授权密码’ )
在这里插入图片描述
回到Configuration --> Actions 页面— > 右上角:New Action
(设置action名称: 比如packets to much >5)
(Conditions 项:关联到哪个 item)
(Operations项: 关联发送邮箱)
在这里插入图片描述
在这里插入图片描述

3,测试

说明:在zabbix-server端(192.168.56.77) 发送ping 报文给被监控主机192.168.56.66

[root@c7 ~]# ping -c 10000 -i 0.01 192.168.56.66
64 bytes from 192.168.56.66: icmp_seq=6199 ttl=64 time=0.350 ms
.....

a, 观察zabbix事件

在这里插入图片描述
在这里插入图片描述

b, 查看邮件内容

在这里插入图片描述

发布了276 篇原创文章 · 获赞 37 · 访问量 11万+

猜你喜欢

转载自blog.csdn.net/eyeofeagle/article/details/104295051
今日推荐