cd zabbix-2.2.3/
./configure --prefix=/usr/local/zabbix/ --enable-proxy --with-net-snmp --with-mysql --with-ssh2
make install
cd database/mysql/
mysql -uroot -p
create database zabbix character set utf8 collate utf8_bin;
use zabbix;
source schema.sql;
grant all privileges on zabbix.* to [email protected]‘%‘ identified by ‘zabbix123‘;
flush privileges;
useradd zabbix -s /sbin/nologin
添加启动脚本/etc/init.d/zabbix-proxy
#!/bin/sh # # chkconfig: - 85 15 # description: Zabbix proxy daemon # ### BEGIN INIT INFO # Provides: zabbix-proxy # Required-Start: $local_fs $network # Required-Stop: $local_fs $network # Default-Start: # Default-Stop: 0 1 2 3 4 5 6 # Short-Description: Start and stop Zabbix proxy # Description: Zabbix proxy daemon ### END INIT INFO # Source function library. . /etc/rc.d/init.d/functions exec=/usr/local/zabbix/sbin/zabbix_proxy prog=${exec##*/} syscf=${0##*/} lockfile=/var/lock/subsys/$syscf [ -f /etc/sysconfig/$syscf ] && . /etc/sysconfig/$syscf config=${CFG_FILE:-/usr/local/zabbix/etc/zabbix_proxy.conf} if [ ! -f $config ]; then echo "Not starting Zabbix proxy: Config file $config not found!" echo "Check /etc/sysconfig/$syscf" exit 3 fi pidfile=$(grep -e "^PidFile=.*$" $config | cut -d= -f2) param="-c $config" start() { echo -n $"Starting Zabbix proxy: " daemon --user zabbix --pidfile "$pidfile" $exec $param rv=$? echo [ $rv -eq 0 ] && touch $lockfile return $rv } stop() { echo -n $"Shutting down Zabbix proxy: " killproc -p "$pidfile" $prog rv=$? echo [ $rv -eq 0 ] && rm -f $lockfile return $rv } restart() { stop start } case "$1" in start|stop|restart) $1 ;; force-reload) restart ;; status) status -p "$pidfile" -l $prog $exec ;; try-restart|condrestart) if status -p "$pidfile" -l $prog $exec >/dev/null ; then restart fi ;; reload) action $"Service ${0##*/} does not support the reload action: " /bin/false exit 3 ;; *) echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}" exit 2 ;; esac
chkconfig --level 35 zabbix-proxy on
编辑配置文件/usr/local/zabbix/etc/zabbix_proxy.conf
Server=127.0.0.1 Hostname=zabbix proxy LogFile=/tmp/zabbix_proxy.log DBHost=127.0.0.1 DBName=zabbix DBUser=zabbix DBPassword=zabbix123
如果报如下错误:
service zabbix-proxy restart Shutting down Zabbix proxy: [FAILED] Starting Zabbix proxy: /usr/local/zabbix/sbin/zabbix_proxy: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory [FAILED]
解决方法:
ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64
然后查看log
时间: 2024-10-25 08:21:26