• Zabbix-proxy搭建

  • 创建用户

chattr-i /etc/shadow /etc/passwd /etc/gshadow /etc/group /etc/shadow- /etc/passwd-/etc/gshadow- /etc/group-

useraddzabbix

usermod-G mysql zabbix

chattr +i /etc/shadow/etc/passwd /etc/gshadow /etc/group /etc/shadow- /etc/passwd- /etc/gshadow-/etc/group-

  1. 2.     fping安装

rpm -ivh  http://pkgs.repoforge.org/fping/fping-3.8-1.el6.rf.x86_64.rpm

如果找不到,可以wget 网址下载

chmod 4710  /usr/sbin/fping6 /usr/sbin/fping  /usr/local/sbin/fping

chown root:zabbix  /usr/sbin/fping6 /usr/sbin/fping  /usr/local/sbin/fping

chmod +s /usr/sbin/fping6  /usr/sbin/fping  /usr/local/sbin/fping

chmod +x /usr/sbin/fping6  /usr/sbin/fping /usr/local/sbin/fping

  1. 3.     zabbix-agentzabbix-proxymysql等安装

yum install zabbix.x86_64  zabbix-agent zabbix-proxy zabbix-proxy-mysql zabbix-sender.x86_64 mysql-server  mysql

  1. 4.     创建数据库以及授权

mysql > create database  zabbix character set utf8;

mysql > GRANT ALL ON  zabbix.* TO 'zabbix'@'localhost' IDENTIFIED BY 'zbxpassword' WITH GRANT OPTION;

flush privileges;

  1. 5.     导入表结构

mysql -uroot  zabbix</usr/share/doc/zabbix-proxy-mysql-2.2.2/create/schema.sql

  1. 6.     创建软连接

ln -s /bin/traceroute  /usr/bin/traceroute

ln -s  /usr/local/mysql/lib/libperconaserverclient.so.18.1.0  /usr/lib64/libmysqlclient.so.18

ln -s  /usr/local/mysql/lib/libperconaserverclient.so.18 /usr/lib64/libmysqlclient.so

  1. 7.     修改/etc/sudoers,增加一行,如下:

zabbix ALL=(ALL) NOPASSWD:  /usr/bin/nmap *

  1. 8.     修改zabbix-proxy配置/etc/zabbix/zabbix_proxy.conf

Server=zabbix server IP

Hostname=一定要与本机hostname一致(hostname查看)

LogFile=/tmp/zabbix_proxy.log

FpingLocation=/usr/local/sbin/fping

DBHost=localhost

DBName=zabbix

DBUser=zabbix

DBPassword=zbxpass

DBPort=3306

DBSocket=/home/mysql/mysql.sock

  1. 9.     启动zabbix-proxy

/etc/init.d/zabbix-proxy start

备注:启动proxy后,检查日志/var/log/zabbix/zabbix_proxy.log,查看启动是否成功,是否有报错。