Zabbix安装
Zabbix安装
添加Zabbix源
cat <<EOF > /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Zabbix Official Repository - \$basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/\$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-non-supported]
name=Zabbix Official Repository non-supported - \$basearch
baseurl=https://mirrors.aliyun.com/zabbix/non-supported/rhel/7/\$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=0
EOF
yum clean all && yum makecache -y
安装数据库
yum -y install mariadb mariadb-devel mariadb-server
systemctl enable mariadb
systemctl start mariadb
mysqladmin -u root -h localhost password 'root'
mysql -uroot -proot
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
quit
Zabbix-Server
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent
systemctl restart zabbix-server httpd
systemctl enable zabbix-server httpd
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pzabbix zabbix
vim /etc/zabbix/zabbix_server.conf
修改连接数据库的配置
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=xxxxxxxx
#修改PHP时区
vim /etc/httpd/conf.d/zabbix.conf
将下面这行修改为亚洲上海
php_value date.timezone Asia/Shanghai
Zabbix-Agent
yum install zabbix-agent
systemctl restart zabbix-agent
systemctl enable zabbix-agent
vim /etc/zabbix/zabbix_agentd.conf
* Server : 那台服务器可拉取信息
* Hostname:主机名称(服务端添加主机时该配置需要与此处一致)
* ServerActive: 主动推送时的服务器地址
* SourceIP:当系统设置有多个IP时,需要指定一个IP与二级代理或服务端通信,若系统只有一个IP,也建议指定一个IP