安装zabbix-agent,添加监控主机

部署监控主机的一键部署脚本zabbix-agentd.sh:

#!/bin/bash
[ ! -e "/usr/bin/wget" ] && yum -y install wget || wget https://mirror.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-agent-4.0.11-1.el7.x86_64.rpm --no-check-certificate
rpm -ivh zabbix-agent-4.0.11-1.el7.x86_64.rpm
sed -i '/^Server=/s/127.0.0.1/192.168.8.100/' /etc/zabbix/zabbix_agentd.conf
netstat -tnulp
[ ! -e "/usr/sbin/ifconfig" ] && yum -y install net-tools
systemctl start zabbix-agent
systemctl status zabbix-agent
netstat -ntulp |grep 10050

###################################################################################

 

 

 安装agentd服务,编辑修改配置文件,启动agentd程序,是配置文件修改生效

wget https://mirror.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-agent-4.0.11-1.el7.x86_64.rpm --no-check-certificate

rpm -ivh zabbix-agent-4.0.11-1.el7.x86_64.rpm
warning: zabbix-agent-4.0.11-1.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:zabbix-agent-4.0.11-1.el7 ################################# [100%]

 

 

 

 

 

 

 

 

###########################################################################

###########################################################################

##############################################################################

#添加监控主机agent

 

 

 

 

 

 添加模版:模版里面大量的监控指标,不添加模版,zabbix不知道监控什么

 

 

 

 

 

 

 

 

 

 

 

 

 经排查:是因为agentd配置文件写错了,Server地址写成了agentd自己地址了, 应该写的是服务端地址

[root@clone1 ~]# grep -i "server=" /etc/zabbix/zabbix_agentd.conf
# Example: Server=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com
# Server=
Server=192.168.8.101

 

 

 

systemctl restart zabbix-agent

systemctl restart zabbix-server

 

 

 

 

 

posted @ 2023-03-29 19:47  往事已成昨天  阅读(62)  评论(0编辑  收藏  举报