zabbix 3.0.3 (nginx)安装过程中的问题排错记录
特殊注明:安装zabbix 2.4.8和2.4.6遇到2个问题,如下:找了很多解决办法,实在无解,只能换版本,尝试换(2.2.2正常 | 3.0.3正常)都正常,最后决定换3.0.31、Error connecting to database: No such file or directory2、如图=========================================================正文开始 1、安装mysql(略过,参考mysql5.1安装) 2、安装php-pfm (略过,参考php-5-5-36安装) 3、准备zabbix环境yum -y install gcc net-snmp-devel curl-devel perl-DBI php-gd php-mysql php-bcmath php-mbstring php-xm 4、安装zabbixgroupadd zabbixuseradd zabbix -g zabbix -s /bin/false下载最新安装包zabbix-3.0.3.tar.gz,解压cd /home/work/software/zabbix-3.0.3/database/mysql创建和导入初始化数据库create database zabbix character set utf8;grant all privileges on zabbix.* to 'zabbix'@'localhost'>mysql -uroot -p zabbix < schema.sqlmysql -uroot -p zabbix < images.sqlmysql -uroot -p zabbix < data.sql导入sql必须按照以上顺序 编译zabbix./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-net-snmp --with-libcurl --with-libxml2-enable-proxy --with-mysql=/usr/local/mysql/bin/mysql_configmake ** make installln -s /usr/local/zabbix/sbin/* /usr/local/sbin/添加系统启动方式cd /home/work/software/zabbix-3.0.3/misc/init.d/fedora/core5/cp zabbix_* /etc/rc.d/init.d//etc/init.d/zabbix_server start/etc/init.d/zabbix_agentd start 查看系统是否开放对应端口,没有则添加zabbix服务对应的端口vi /etc/services #编辑,在最后添加以下代码# Zabbixzabbix-agent 10050/tcp # Zabbix Agentzabbix-agent 10050/udp # Zabbix Agentzabbix-trapper 10051/tcp # Zabbix Trapperzabbix-trapper 10051/udp # Zabbix Trapper 配置zabbix server配置文件vim /usr/localo/zabbix/etc/zabbix_server.confListenPort=10051SourceIP=serveripaddr### Option: MysqlDBHost=localhostDBName=zabbixDBUser=zabbixDBPassword=zabbixDBSocket=/var/run/mysqld/mysql.socketDBPort=3306AlertScriptsPath=${datadir}/zabbix/alertscripts #脚本存放路径修改php配置文件参数vim /etc/php.ini #编辑修改post_max_size =16Mmax_execution_time =300max_input_time =300date.timezone = "Asia/Shanghai" 准备web站点cp -r /usr/local/src/zabbix-3.0.3/frontends/php /data/web/zabbix.gvppp.com/zabbixchown nginx.nginx -R /data/web/zabbix.gvppp.com/zabbix 5、nginx安装下载pcrewget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.34/pcre-8.34.zip安装./configure --prefix=/usr/local/pcremake && make installtar xf nginx-1.6.2.tar.gz./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-http_ssl_module --with-pcre=../pcre-8.34 --user=nginx --group=nginxmake && make install nginx设置vim nginx.confusernginx;worker_processes4; #error_loglogs/error.log warning;#error_loglogs/error.lognotice;error_loglogs/error.loginfo; pid logs/nginx.pid; events { use epoll; worker_connections65535;} http { include mime.types; default_typeapplication/octet-stream; log_formatmain'$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; #access_loglogs/access.logmain; sendfile on; tcp_nopush on; #keepalive_timeout0; keepalive_timeout60; gzipon; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version1.0; gzip_comp_level 2; gzip_types text/plain application/x-javascript text/css application/xml; gzip_vary on; include /usr/local/nginx/vhosts/*.conf;} 虚拟主机配置文件记得修改linux系统打开文件数ulimt -n #临时修改 6、zabbxi客户端安装下载zabbix-3.0.3.tar.gz./configure --divfix=/usr/local/zabbix --sysconfdir=/usr/local/zabbix/etc --enable-agent --with-net-snmpmake && make installcp misc/init.d/fedora/core5/zabbix_agentd /etc/rc.d/init.d/zabbix_agentdln -s /usr/local/zabbix/sbin/* /usr/local/sbin 7、zabbix代理安装./configure --prefix=/usr/local/zabbix --enable-agent -enable-proxy --with-mysql --with-net-snmp --with-libcurl --sysconfdir=/usr/local/zabbix/etc make && make installvim zabbix_proxy.confProxyMode=0 #0代理使用主动模式Server=ipaddrserveripaddr #zabbix server ipaddrServerPort=10051 #zabbix server portListenPort=10051 #监控portDBHost=DBName=DBUser=DBPassword=DBSocket=DBPort=proxy连接的mysql的配置信息ConfigFrequency=300 #proxy从server获取配置数据的频率,秒DataSenderFrequency=60 #proxy将监控到的数据发送给server的频率,秒AllowRoot=1 #允许root执行=======================================================zabbix部署过程中遇到的问题以及排错:1、遇到打开setup.php安装页面 next step 操作无法调整到下一个页面时网络解决办法:修改/var/lib/php/session/ 属组和添加777权限修改php.ini 更改 session.save_path = "/var/lib/php/session"然后再刷新页面即可 2、Error connecting to database: No such file or directory将 Database host 的localhost改为127.0.0.1 3、Unable to create the configuration file.点击 Download the configuration file 进行下载配置文件在上传到web站点下/opt/www/zabbix/conf 4、date.timezone 找不到vim php.inidate.timezone = "Asia/Shanghai" 5、web里面显示“zabbix server is not running”1). selinux是否关闭执行命令setenforce 0 2). zabbix web目录下面$ZBX_SERVER 是否为ip,如果是localhost,ping下localhost是否能解析。如果不能,需要在/etc/hosts文件里增加相应的项目 3). 查看php的fsockopen模块是否启用php.ini文件中查找allow_url_fopen = On使其值为On让你的php支持 opensll扩展。 默认,是没有openssl扩展的,只能重新编译安装。 yum install openssl openssl-devel cd /usr/local/src/php-5.2.14/ext/openssl /usr/local/php/bin/phpize------------/usr/local/php/bin/phpize 执行报错Cannot find config.m4.Make sure that you run '/usr/local/php/bin/phpize' in the top level source directory of the module解决办法cp config0.m4 config.m4 即可------------ ./configure –with-openssl –with-php-config=/usr/local/bin/php-config make && make install 看提示,把编译成的openssl.so 拷贝到你在php.ini 中指定的 extension_dir 下php.ini加入 extension=openssl.so 重启web server 6、 connection to database 'zabbix' failed: Access denied for use插件zabbix_server.conf mysql配置项是否正确 7、Received empty response from Zabbix Agent at . Assuming that agent dropped connection because of access permissions如果服务端是多个IP,需要修改zabbix_agentd.confserver为多个IP,用逗号隔开 8、zabbix_agentd : cannot run as root!修改zabbix_agentd.conf中的AllowRoot=11表示允许root 0表示不允许root 9、Zabbix discoverer processes more than 75% busy修改zabbix_server.conf里面的,根据系统性能修改,这里我改为10StartDiscoverers=10 10、首先检查selinux是否关闭再修改zabbix_conf.php 把localhost改成IP即可$ZBX_SERVER = 'serveripaddr'; 11、Zabbix poller processes more than 75% busyStartPollers=50 可以改大这个值 12、Lack of free swap space on hostname
修改temp模版触发器的判断参数{Base_OS Linux:system.swap.size[,pfree].last(0)}<10修改为{Base_OS Linux:system.swap.size[,pfree].last(0)}<10 and {Base_OS Linux:system.swap.size[,free].last(0)}<>0 13、agent安装编译错误 configure: error: cannot run C compiled programs.GCC编译环境有问题 14、failed: first network error, wait for 15 seconds服务器性能处理不过来,修改zabbix_server.confTimeout=30或者小于30 15、zabbix graph 中文显示乱码先从window系统拷贝ttf字体到zabbix web/www/zabbix/fonts/再修改web代码 vim /www/zabbix/include/defines.inc.php
找到DejaVuSans,并改成上传的字体文件名,不加ttf 即可//define('ZBX_GRAPH_FONT_NAME', 'DejaVuSans'); // font file name//define('ZBX_FONT_NAME', 'DejaVuSans'); 16、zabbix 自动发现遇到模版不自动连接,最后发现是因为有一个item监控项在两个模版里面冲突了,删掉一个即可另:客户端设置主动模式,不用在configuration 配置discovery 17、报警邮件无法发送,日志报错:Support for SMTP authentication was not compiled in网上查找原因:libcurl版本过低,需要7.20.0或者更高版本的curlrpm -Uvh http://www.city-fan.org/ftp/contrib/yum-repo/rhel6/x86_64/city-fan.org-release-1-13.rhel6.noarch.rpmyum install libcurl 安装完以后需要重新编译zabbix server带上--with-libcurl参数然后重启服务器恢复正常 18、More than 100 items having missing data for more than 10 minutes可以查看Queue是不是厉害很大,彻底解决还需要优化zabbix 希望能对遇到同样问题的童鞋有所帮助,也是自己对zabbix研究的一个总结,后续持续更新......如果有什么错误的地方还请大家指出!!!共同学习...
页:
[1]