zabbix官网下载zabbix-3.2.1.tar.gz
wget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.2.1/zabbix-3.2.1.tar.gz
tar –xzf zabbix-3.2.1.tar.gz
#官方手册https://www.zabbix.com/documentation/3.2/manual/installation/install
groupadd zabbix
useradd –g zabbix zabbix
useradd –g zabbix zabbix_agent
[root@a src]# cd zabbix-3.2.1/database/mysql/
[root@a mysql]# mysql -uroot -p zabbix<schema.sql
[root@a mysql]# mysql -uroot -p zabbix<images.sql
[root@a mysql]# mysql -uroot -p zabbix<data.sql
[root@a zabbix-3.2.1]# ./configure --prefix=/usr/local/zabbix-server --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
configure: error: Invalid Net-SNMP directory - unable to find net-snmp-config
yum install -y net-snmp*
#重新编译通过
make && make install
#创建日志文件
mkdir -p /var/log/zabbix/
chown –R zabbix:zabbix /var/log/zabbix
#修改配置文件
vim /usr/local/zabbix-server/etc/zabbix_server.conf
LogFile=/var/log/zabbix/zabbix_server.log
DBHost=localhost
DBUser=zabbix DBPassword=zabbix ListenIP= zabbix-server ip
[root@a sbin]# ./zabbix_server start
./zabbix_server: error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory
[root@a lib64]# ln -s /usr/local/mysql/lib/libmysqlclient.so.20.3.3 ./libmysqlclient.so.20
[root@a sbin]# ./zabbix_server
[root@a frontends]# cp -R ./php /usr/local/apache2/htdocs/zabbix
[root@a etc]# vim php.ini 逐项修改
date.timezone =Asia/Shanghai
#PHP安装 --enable-bcmath
[root@a php-5.6.28]# cd ext
[root@a mysqli]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
[root@a mysqli]# ./configure --prefix=/usr/local/php --with-php-config=/usr/local/php/bin/php-config --with-mysqli=/usr/local/mysql/bin/mysql_config
/usr/local/src/php-5.6.28/ext/mysqli/mysqli_api.c:36:47: error: ext/mysqlnd/mysql_float_to_double.h: No such file or directory
make: *** [mysqli_api.lo] Error 1
vim mysqli_api.c 修改为绝对路径
安装成功
在php.ini下添加
extension=mysqli.so
[root@a gettext]# /usr/local/php/bin/phpize
[root@a gettext]# ./configure --prefix=/usr/local/php --with-php-config=/usr/local/php/bin/php-config
[root@a gettext]# make && make install
vim php.ini
extension = gettext.so
重启服务
被监控端安装zabbix客户端
./configure --prefix=/usr/local/zabbix-agent --enable-agent
make && make install
#日志文件
chmod –R 775 /var/log/zabbix
#修改agent配置文件
Logfile
Server= ServerActive=监控机ip Hostname=zabbix.agent User=zabbix # 监听ip,server,serveractive与上面创建的用户保持一致