1)安装
##安装zabbix ##准备环境 关闭mysql、selinux ##安装阿里epel源和zabbix源 [[email protected] ~]# rpm -ivh https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm [[email protected] ~]# rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm [[email protected] ~]# cd /etc/yum.repos.d/ [[email protected] yum.repos.d]# ls CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo epel-testing.repo CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo epel.repo zabbix.repo ##安装 服务端、zabbix-get命令、web连接mysql的库、web、zabbix-agent [[email protected] yum.repos.d]# yum install -y zabbix-server zabbix-get zabbix-web-mysql zabbix-web zabbix-agent ##开机启动 [[email protected] yum.repos.d]# systemctl enable zabbix-server zabbix-agent systemctl enable httpd ##安装mariadb,设置开机启动 [[email protected] yum.repos.d]# yum -y install mariadb* [[email protected] yum.repos.d]# systemctl status mariadb ##配置mysql #创建zabbix数据库并指定字符集 MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin; #授权 MariaDB [(none)]> grant all on zabbix.* to [email protected]‘localhost‘ identified by ‘123456‘; [[email protected] yum.repos.d]# cd /usr/share/doc/zabbix-server-mysql-3.2.7/ [[email protected] zabbix-server-mysql-3.2.7]# zcat create.sql.gz |mysql -uzabbix -p123456 zabbix ##修改php相关 [[email protected] zabbix]# grep timezone /etc/httpd/conf.d/zabbix.conf php_value date.timezone Asia/Shanghai ##配置zabbix-server [[email protected] ~]# egrep -v "^#|^$" /etc/zabbix/zabbix_server.conf LogFile=/var/log/zabbix/zabbix_server.log LogFileSize=0 PidFile=/var/run/zabbix/zabbix_server.pid DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=123456 SNMPTrapperFile=/var/log/snmptrap/snmptrap.log Timeout=4 AlertScriptsPath=/usr/lib/zabbix/alertscripts ExternalScripts=/usr/lib/zabbix/externalscripts LogSlowQueries=3000 #配置zabbix-agent [[email protected] zabbix]# grep "^[a-Z]" /etc/zabbix/zabbix_agentd.conf PidFile=/var/run/zabbix/zabbix_agentd.pid LogFile=/var/log/zabbix/zabbix_agentd.log LogFileSize=0 Server=192.168.142.180 ##被动模式 ServerActive=127.0.0.1 ##主动模式 Hostname=Zabbix server Include=/etc/zabbix/zabbix_agentd.d/*.conf ##启动 systemctl start zabbix-agent zabbix-server ##查看 [[email protected] zabbix]# netstat -tulnp | grep zabbix | grep -w "tcp" tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 29173/zabbix_agentd tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 4024/zabbix_server ##打开web界面进行最后配置 http://IP地址/zabbix ##默认账号密码是Admin/zabbix
2)术语
时间: 2024-10-12 18:54:25