Installation of zabbix-server and zabbix-agent under centOS7;
Installation of zabbix-agent under windows7;
Please download the attachment for details.
1. zabbix-server installation
#Server ip address: 192.168.37.144
1.zabbix-server installation
#Install zabbix repository
#Install zabbix server side
yum install zabbix-server-mysql zabbix-web-mysql -y
#Install the zabbix client, the purpose here is to hope that zabbix can monitor itself
yum install zabbix-agent -y
2. Database installation and configuration
#install mariadb database
yum install mariadb*
#start mariadb
systemctl start mariadb.service
#Set mariadb to start on boot
systemctl enable mariadb.service
#Set mariadb related parameters
vi /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
character-set-server=utf8 #设置字符集编码
wait_timeout=288000#链接超时
lower_case_table_names=1#不区分列名称的大小写
innodb_file_per_table=1#让innodb每个表文件单独存储
# restart mariadb
systemctl restart mariadb.service
#Login to mariadb, the default password is empty and needs to be set
mysql -uroot -p
#Set root password
mysqladmin -uroot password admin #The password is set here to admin
#Create zabbix database
MariaDB [(none)]> create database zabbix character set utf8; #注意必须设置为utf-8,否则会出现中文乱码。
#创建zabbix用户,并授予其对zabbix的管理权限
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
MariaDB [(none)]> flush privileges;
#导入zabbix初始化脚本
cd /usr/share/doc/zabbix-server-mysql-3.2.1/
gunzip create.sql.gz
mysql -uzabbix -p
MariaDB [(none)]> use zabbix;
MariaDB [zabbix]> source /usr/share/doc/zabbix-server-mysql-3.2.1/create.sql;
#配置zabbix_server.conf
vi /etc/zabbix/zabbix_server.conf
基于上面的配置,只需要修改:DBPassword=zabbix
一般情况下需要修改如下配置项:
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
3.zabbix-server服务启动与配置
#启动zabbix-server服务,并配置为开机启动
systemctl start zabbix-server
systemctl enable zabbix-server
#启动httpd服务,并设置为开机启动
systemctl start httpd
systemctl enable httpd
#修改防火墙端口
#关闭Selinux,firewalld
#开启iptablse
#服务器端开放端口
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10051 -j ACCEPT
-A OUTPUT -p tcp -m state --state NEW -m tcp --dport 10050 -j ACCEPT
#客户端开放端口
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10050 -j ACCEPT
-A OUTPUT -p tcp -m state --state NEW -m tcp --dport 10051 -j ACCEPT
#重启iptables:systemctl restart iptables.service
#apache配置:zabbix配置文件
vim /etc/httpd/conf.d/zabbix.conf
#默认情况下只需修改时区
php_value date.timezone Asia/Shanghai
#重启httpd
systemctl restart httpd
4.web管理端初始化配置
#访问页面