zabbix客户端一键安装脚本

zabbix客户端一键安装脚本

  本环境:centos7.9

  简易安装脚本,Server=192.168.2.111​此处需要修改为server的ip地址

#!/bin/bash
# 关闭SELinux、暂停防火墙
setenforce 0
systemctl stop firewalld

# 安装Zabbix仓库和zabbix-agent zabbix-get
rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
sed -i 's#repo.zabbix.com#mirrors.tuna.tsinghua.edu.cn/zabbix#g' /etc/yum.repos.d/zabbix.repo
yum install -y zabbix-agent zabbix-get.x86_64 net-tools

# 配置zabbix-agent,Server和ServerActive保持一致,Hostname根据情况修改
cat << 'EOF' > /etc/zabbix/zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=192.168.2.111
ServerActive=192.168.2.111
Hostname=Zabbix agent
Include=/etc/zabbix/zabbix_agentd.d/*.conf
EOF

# 启动zabbix-agent并检查
systemctl start zabbix-agent.service 
systemctl enable zabbix-agent.service
netstat -lntup | grep 10050

posted @ 2024-02-20 01:56  index鹦鹉鹉鹦  阅读(99)  评论(0)    收藏  举报