zabbix(回忆篇,可能有遗漏内容)

server 安装

# 安装软件 dnf install -y zabbix-web-mysql zabbix-server-mysql zabbix-web zabbix-apache-conf zabbix-agent # 安装 mariadb 数据库 dnf install -y mariadb mariadb-server # 创建用户 zabbix 和 zabbix 数据库 systemctl start mariadb systemctl enable mariadb mysqladmin -u root password 'WWW.1.com' mysql -u root -pWWW.1.com create database zabbix character set utf8 collate utf8_bin; create user zabbix@localhost identified by 'zabbix'; grant all privileges on zabbix.* to zabbix@localhost; flush privileges; exit; # 初始化数据库 zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -pzabbix zabbix # 配置 zabbix vi /etc/zabbix/zabbix_server.conf DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbix # 替换为你在步骤 1.4 中设置的 Zabbix 数据库用户密码 # 配置页面,配置时区 vi /etc/php.ini [Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone date.timezone = Asia/Shanghai # 启动 zabbix-web 服务 systemctl restart zabbix-server httpd php-fpm systemctl enable zabbix-server httpd php-fpm # 配置防火墙 firewall-cmd --add-service=http --permanent firewall-cmd --add-port=10050/tcp --permanent firewall-cmd --reload # 登录页面 http://IP/zabbix # 根据页面配置数据等内容,可能需要收到下载保存配置文件 user: Admin passwd: zabbix # 完成

页面配置自动发现并自动添加节点

汉化

notion image

配置自动发现时间

notion image

配置动作

notion image
notion image

等待上线的页面( agent 安装配置完成之后,会自动添加到主机中)

notion image

agent 安装

# 客户端,安装流程都是, # 1、装 rpm 包, # 2、关闭防火墙(或者配置防火墙) # 3、修改服务器地址和代理地址,配置Hostname # 启动服务。 # 1070e dnf install zabbix-agent -y && \ systemctl stop firewalld && systemctl disable firewalld && \ sed -i.bak \ -e 's/^Server=127.0.0.1/Server=192.168.100.66/' \ -e 's/^ServerActive=127.0.0.1/ServerActive=192.168.100.66/' \ -e "s/^Hostname=Zabbix server/Hostname=$(hostname -I | awk '{print $1}')/" \ /etc/zabbix/zabbix_agentd.conf && \ systemctl start zabbix-agent.service && systemctl enable zabbix-agent.service # 1060a dnf install zabbix-agent -y && \ sed -i.bak \ -e 's/^Server=127.0.0.1/Server=192.168.100.66/' \ -e 's/^ServerActive=127.0.0.1/ServerActive=192.168.100.66/' \ -e "s/^Hostname=Zabbix server/Hostname=$(hostname -I | awk '{print $1}')/" \ /etc/zabbix/zabbix_agentd.conf && \ systemctl start zabbix-agent.service && systemctl enable zabbix-agent.service # 麒麟 v10 scp root@192.168.100.66:zabbix-agent-5.0.0-5.uel20.x86_64.rpm ./ rpm -ivh zabbix-agent-5.0.0-5.uel20.x86_64.rpm systemctl stop firewalld && systemctl disable firewalld && \ sed -i.bak \ -e 's/^Server=127.0.0.1/Server=192.168.100.66/' \ -e 's/^ServerActive=127.0.0.1/ServerActive=192.168.100.66/' \ -e "s/^Hostname=Zabbix server/Hostname=$(hostname -I | awk '{print $1}')/" \ /etc/zabbix/zabbix_agentd.conf && \ systemctl start zabbix-agent.service && systemctl enable zabbix-agent.service # 重启 systemctl restart zabbix-agent.service