配置数据库连接,输入数据库名、用户、密码,单击Test connection,显示OK,单击下一步即可。
填写Zabbix Title显示,可以为空,可以输入自定义的名称:
单击下一步,出现需修创建zabbix.conf.php文件,执行如下命令,或者单击“Download the configuration file”下载zabbix.conf.php文件,将该文件上传到/usr/local/apache2/htdocs/conf,并设置可写权限,刷新WEB页面,最后单击Finish即可:
登录Zabbix WEB界面,默认用户名和密码为:admin/zabbix
zabbix安装完成后,但是显示服务没有起来一直显示 zabbix server is not running ,这时候查看端口和进程,没有任何显示。
排错首先查看日志和端口:
# ss -tnl|grep 10051
# ps -ef|grep zabbix
# tail -f /tmp/zabbix_server.log
54587:20170821:151740.795 [Z3001] connection todatabase 'zabbix' failed: [2002]
Can't connect to local MySQL server throughsocket '/var/lib/mysql/mysql.sock' (13)
54587:20170821:151740.795 database is down:reconnecting in 10 seconds
解决办法:一看就是找不到mysql.sock的路径,找到mysql.sock的路径并打开zabbix_server的配置文
件指明DBSocket的路径。重启服务即可
# find / -name mysql.sock
/tmp/mysql.sock
# vim/usr/local/zabbix/etc/zabbix_server.conf
DBSocket=/tmp/mysql.sock
3)安装zabbix_agent端:安装客户端和服务端的差不多,这里就直接给出脚本吧:
#!/bin/bash#auto install zabbix agent
#by jiajie 20170822#############
ZABBIX_SOFT="zabbix-3.2.6"
INSTALL_DIR="/usr/local/zabbix"
URL=http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.2.6/zabbix-3.2.6.tar.gz/download
IP=`ifconfig ens33|sed -n '2p'|awk '{print $2}'`
read -p "Please input zabbix_server IP:" SERVER_IP
###jump IP is rightful
if [[ $SERVER_IP =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]];then
continue
else
echo -e "\033[31mIP format error!\033[0m"
exit 0
fi
AGENT_INSTALL(){
if [ -d $INSTALL_DIR ];then
echo "zabbix_agent is already install..."
exit 1
else
if [ ! -d /software ];then
mkdir /software
fi
fi
cd /software
yum -y install curl curl-devel net-snmp net-snmp-devel perl-DBI
groupadd zabbix ;useradd -g zabbix zabbix
wget $URL tar -xf download
cd $ZABBIX_SOFT
./configure --prefix=/usr/local/zabbix --enable-agent
if [ $? -eq 0 ];then
make install
else
echo "./configure is error,please check..."
exit 2
fi
ln -s $INSTALL_DIR/sbin/zabbix_* /usr/local/sbin/
cp misc/init.d/tru64/zabbix_agentd /etc/init.d/zabbix_agentd &&
chmod o+x /etc/init.d/zabbix_agentd
#config zabbix agentdcat >$INSTALL_DIR/etc/zabbix_agentd.conf<<EOF
LogFile=/tmp/zabbix_agentd.log
Server=$SERVER_IP
ServerActive=$SERVER_IP
Hostname = $IP
EOF
#start zabbix agentd
iptables -F
setenforce 0
/etc/init.d/zabbix_agentd restart
}
AGENT_INSTALL
更多Zabbix相关教程集合: