zabbix 2


服务器 IP:192.168.91.128
客户端 IP:192.168.91.131

1. 将 zabbix server 添加到 zabbix web 监控平台

在这里插入图片描述

[root@localhost ~]# hostnamectl set-hostname server
[root@localhost ~]# bash
[root@server ~]# cd /etc/zabbix/
[root@server zabbix]# ls
web  zabbix_agentd.conf  zabbix_agentd.d  zabbix_server.conf

[root@server zabbix]# vim zabbix_agentd.conf
Server=127.0.0.1
ServerActive=127.0.0.1
Hostname=server		//改为本机的hostname

[root@server zabbix]# vim /etc/hosts
192.168.91.128  server		//添加此行
192.168.91.131  agnet		//添加此行

[root@server zabbix]# systemctl restart zabbix-agent
[root@server zabbix]# systemctl enable zabbix-agent

在这里插入图片描述

2. 将 zabbix agent 添加到 zabbix web 监控平台

[root@localhost ~]# hostnamectl set-hostname agent
[root@localhost ~]# bash

[root@agent ~]# scp root@192.168.91.128:/etc/hosts /etc/hosts
The authenticity of host '192.168.91.128 (192.168.91.128)' can't be established.
ECDSA key fingerprint is SHA256:HzP5/q4QBCkMtXqvHhPqy72ytttOZ6AX9vvL7hzidU8.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.91.128' (ECDSA) to the list of known hosts.
root@192.168.91.128's password: 
hosts                                                   100%  201   114.7KB/s   00:00    

[root@agent ~]# scp root@192.168.91.128:/etc/yum.repos.d/zabbix.repo /etc/yum.repos.d/zabbix.repo
root@192.168.91.128's password: 
zabbix.repo                                             100%  386    31.3KB/s   00:00    

[root@agent ~]# systemctl stop firewalld
[root@agent ~]# systemctl disable firewalld

[root@agent ~]# vim /etc/selinux/config
SELINUX=disabled		//disabled模式

[root@agent ~]# dnf -y install zabbix-agent

[root@agent ~]# vim /etc/zabbix/zabbix_agentd.conf
Server=192.168.91.128
ServerActive=192.168.91.128
Hostname=agent

[root@agent ~]# systemctl restart zabbix-agent
[root@agent ~]# systemctl enable zabbix-agent

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

3. 为 zabbix agent 创建自定义模板 Template

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

4. 基于 Template 模板创建自定义监控项

监控 cpu 1 分钟平均负载,应用集为 cpu

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

要求监控 cpu 5 分钟平均负载,应用集为 cpu

在这里插入图片描述

要求监控 cpu 15 分钟平均负载,应用集为 cpu

在这里插入图片描述

要求监控 agent 的 ssh 服务的 22 端口,应用集为 ssh

在这里插入图片描述

5. 自定义键值 logusers(该键值要求:监控有多少个用户连接 agent 端),应用集为 ssh

[root@agent ~]# vim /etc/zabbix/zabbix_agentd.conf
UserParameter=logusers,who | wc -l	//取消注释,并填入内容

[root@agent ~]# systemctl restart zabbix-agent

[root@server ~]# yum -y install zabbix-get
[root@server ~]# zabbix_get -s 192.168.91.131 -k logusers		//服务器端,测试键值

在这里插入图片描述

6. 创建 Template 模板的图形,将以上 5 个监控项制作成图形

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

7. 创建聚合图形,将监控项 cpu 1 分钟平均负载和有多少个用户连接 agent 端图形制作成聚合图形

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

8. 收藏该聚合图形,让其在仪表板中显示

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

9. 创建触发器,设置超过 7 个用户连接 agent 端,发出告警信息

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值