groupadd zabbix
useradd -g zabbix zabbix -s /sbin/nologin
groupadd mysql
useradd -g mysql mysql -s /sbin/nologin
安装mysql
yum -y install net-snmp net-snmp-devel cmake libxml2 libxml2-devel ncurses ncurses-devel curl curl-devel
cd mysql-5.5.40
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql5.5.49 -DDEFAULT_CHARSET=utf8 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/usr/local/mysql/data3306 -DWITH_EXTRA_CHARSETS=all -DWITH_READLINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_TCP_PORT=3306 -DDEFAULT_COLLATION=utf8_general_ci
make
make install
mkdir -p /var/run/mysqld/
mkdir -p /usr/local/mysql5.5.49/multi_log/
chown mysql.mysql /var/run/mysqld/
vim .bashrc
PATH=/usr/local/mysql/bin:"$PATH"
export PATH
source .bashrc
/usr/local/mysql5.5.49/scripts/mysql_install_db --basedir=/usr/local/mysql5.5.49 --datadir=/usr/local/mysql5.5.49/data3306 --user=mysql
/usr/local/mysql5.5.49/bin/mysqld_multi --defaults-extra-file=/usr/local/mysql5.5.49/my.cnf start 6
/usr/local/mysql5.5.49/bin/mysql --socket=/usr/local/mysql5.5.49/data3306/mysql.sock
>create database zabbix default charset utf8;
> grant all on zabbix.* to zabbix@localhost identified by 'zabbix123456';
>flush privileges;
>exit
导入数据库中的表
cd /root/zabbix-2.2.0/database/mysql
mysql -uzabbix -p --socket=/usr/local/mysql/data3306/mysql.sock zabbix < /data/zabbix-3.0.3/database/mysql/schema.sql (proxy端只需要这一步,不需要数据)
编译安装(proxy)
cd /root/zabbix-2.2.0
./configure --enable-agent --enable-proxy --with-mysql=/usr/local/mysql5.5.49/bin/mysql_config --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --prefix=/usr/local/zabbix
make && make install
ln -s /usr/local/mysql5.5.49/lib/libmysqlclient.so.18 /usr/lib64/
配置proxy
ProxyMode=0 #proxy主动模式 Server= 10.163.114.39 #zabbix_server的地址 Hostname=qd-aliyun-proxy LogFile=/usr/local/data/zabbix/log/zabbix_proxy.log DBHost=rm-m5e227k91vyas7ig6.mysql.rds.aliyuncs.com DBName=zabbix_proxy_qd DBUser=zabbix DBPassword=ZabBix2017 ConfigFrequency=60 DataSenderFrequency=5 CacheSize=16M Timeout=10 LogSlowQueries=3000
配置监控主机
[root@Zabbix_proxy ~]# egrep -v "^#|^$" /etc/zabbix/zabbix_agentd.conf LogFile=/usr/local/data/zabbix/log/zabbix_agentd.log Server=121.42.174.249 #proxy的地址 ServerActive=121.42.174.249 Hostname=qd-aliyun-proxy UnsafeUserParameters=1
创建代理
创建监控主机。启用代理