美文网首页ZabbixzabbixSecurity
Zabbix-3·被监控端配置流程及使用

Zabbix-3·被监控端配置流程及使用

作者: 技术老男孩 | 来源:发表于2022-12-01 09:28 被阅读0次

一、环境准备:

准备二台主机:

主机名 地址
zabbixserver 192.168.88.5/24
web1 192.168.88.100/24

PS:

  1. 关闭SELINUX和防火墙
  2. 配置yum源(系统yum)

二、部署流程思路:

  1. 安装Zabbix软件
  2. 修改配置文件zabbix_agentd.conf
  3. 启动服务
  4. 登录Zabbix网站添加主机

第一步:安装Zabbix软件

  • 监控端(zabbix server)和被控端使用的软件是同一个,只是启用不同的功能
# 从88.5的主机拷贝过来资源
[root@zabbixserver ~]# scp lnmp_soft/zabbix-3.4.4.tar.gz 192.168.88.100:/root
# 安装编译agent需要的依赖环境
[root@web1 ~]# yum install -y gcc pcre-devel autoconf
  • 编译安装agent
# 解压zabbix压缩包
[root@web1 ~]# tar xf zabbix-3.4.4.tar.gz 
[root@web1 ~]# cd zabbix-3.4.4/
# 编译
[root@web1 zabbix-3.4.4]# ./configure --enable-agent
# 安装
[root@web1 zabbix-3.4.4]# make && make install

第二步:修改配置文件zabbix_agentd.conf

# 修改配置文件
[root@web1 ~]# vim /usr/local/etc/zabbix_agentd.conf
30 LogFile=/tmp/zabbix_agentd.log   # 日志位置,不用改
69 EnableRemoteCommands=1    # 允许监控端远程执行命令
93 Server=127.0.0.1,192.168.88.5   # 允许自己和监控端进行数据采集
134 ServerActive=127.0.0.1,192.168.88.5  # 允许自己和监控端主动监控
145 Hostname=web1             # 自己的主机名
280 UnsafeUserParameters=1    # 允许用户自定义监控项

第三步:启动服务

  • 创建用于管理zabbix_agent的service文件
# 配置agent服务的service文件
[root@web1 ~]# vim /usr/lib/systemd/system/zabbix_agentd.service
[Unit]
Description=zabbix agent
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/tmp/zabbix_agentd.pid
ExecStart=/usr/local/sbin/zabbix_agentd
ExecStop=/bin/kill $MAINPID

[Install]
WantedBy=multi-user.target
  • 创建服务zabbix用户
[root@web1 ~]# useradd -s /sbin/nologin zabbix
  • 启动zabbix_agent服务
# 新建service文件,一般需要执行systemctl daemon-reload,否则有可能识别不到
[root@web1 ~]# systemctl daemon-reload
# 启动服务
[root@web1 ~]# systemctl start zabbix_agentd.service 
[root@web1 ~]# systemctl enable zabbix_agentd.service 
  • 检查端口10050
# 查看端口(10050)
[root@web1 ~]# ss -tlnp | grep :10050
LISTEN     0      128          *:10050

第四步:登录Zabbix网站添加主机

创建主机.png
配置主机信息.png
配置agent代理.png
添加监控模板1.png
添加监控模板2.png
查看配置结果.png

相关文章

网友评论

    本文标题:Zabbix-3·被监控端配置流程及使用

    本文链接:https://www.haomeiwen.com/subject/cakdfdtx.html