zabbix 3.0.3 (nginx)安装过程中的问题排错记录

特殊注明:安装zabbix 2.4.8和2.4.6遇到2个问题,如下:找了很多解决办法,实在无解,只能换版本,尝试换(2.2.2正常 | 3.0.3正常)都正常,最后决定换3.0.3
1、Error connecting to database: No such file or directory
2、如图
QQ图片20160727095739
=========================================================
正文开始
 
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、安装zabbix
groupadd zabbix
useradd 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' identified by 'zabbix' with grant option;
mysql -uroot -p zabbix < schema.sql
mysql -uroot -p zabbix < images.sql
mysql -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_config
make ** make install
ln -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 #编辑,在最后添加以下代码
# Zabbix
zabbix-agent 10050/tcp # Zabbix Agent
zabbix-agent 10050/udp # Zabbix Agent
zabbix-trapper 10051/tcp # Zabbix Trapper
zabbix-trapper 10051/udp # Zabbix Trapper
 
配置zabbix server配置文件
vim /usr/localo/zabbix/etc/zabbix_server.conf
ListenPort=10051
SourceIP= serveripaddr
### Option: Mysql
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
DBSocket=/var/run/mysqld/mysql.socket
DBPort=3306
AlertScriptsPath=${datadir}/zabbix/alertscripts #脚本存放路径
 
 
修改php配置文件参数
vim /etc/php.ini #编辑修改
post_max_size =16M
max_execution_time =300
max_input_time =300
date.timezone = "Asia/Shanghai"
 
准备web站点
cp -r /usr/local/src/zabbix-3.0.3/frontends/php /data/web/zabbix.gvppp.com/zabbix
chown nginx.nginx -R /data/web/zabbix.gvppp.com/zabbix
 
5、nginx安装
下载pcre
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.34/pcre-8.34.zip
安装
./configure --prefix=/usr/local/pcre
make && make install
tar 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=nginx
make && make install
 
nginx设置
vim nginx.conf
user  nginx;
worker_processes  4;
 
#error_log  logs/error.log warning;
#error_log  logs/error.log  notice;
error_log  logs/error.log  info;
 
pid        logs/nginx.pid;
 
events {
    use epoll;
    worker_connections  65535;
}
 
http {
    include       mime.types;
    default_type  application/octet-stream;
 
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
 
    #access_log  logs/access.log  main;
 
    sendfile        on;
    tcp_nopush     on;
 
    #keepalive_timeout  0;
    keepalive_timeout  60;
 
    gzip  on;
    gzip_min_length     1k;
    gzip_buffers     4 16k;
    gzip_http_version  1.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;
}
 
虚拟主机配置文件
vim zabbix.conf
server {
listen 8001;
server_name zabbix.gvppp.com;
access_log /data/logs/zabbix/zabbix.gvppp.com.access.log main;
index index.html index.php index.html;
root /data/web/zabbix.gvppp.com;location /{
try_files $uri $uri/ /index.php?$args;
}location ~ ^(.+.php)(.*)$ {
fastcgi_split_path_info ^(.+.php)(.*)$;
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param PATH_INFO $fastcgi_path_info;
}}
记得修改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-snmp
make && make install
cp misc/init.d/fedora/core5/zabbix_agentd /etc/rc.d/init.d/zabbix_agentd
ln -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 install
vim zabbix_proxy.conf
ProxyMode=0               #0代理使用主动模式
Server=ipaddr serveripaddr               #zabbix server ipaddr
ServerPort=10051       #zabbix server port
ListenPort=10051        #监控port
DBHost=
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/ 属组[nginx]和添加777权限
修改php.ini 更改 session.save_path = "/var/lib/php/session"
然后再刷新页面即可
 
2、Error connecting to database: No such file or directory
clipboard
将 Database host 的localhost改为127.0.0.1
 
3、Unable to create the configuration file.
clipboard1
点击 Download the configuration file 进行下载配置文件
在上传到web站点下
/opt/www/zabbix/conf
 
4、date.timezone 找不到
vim php.ini
date.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、[Z3001] connection to database 'zabbix' failed: [1045] Access denied for use
插件zabbix_server.conf mysql配置项是否正确
 
7、Received empty response from Zabbix Agent at [127.0.0.1]. Assuming that agent dropped connection because of access permissions
如果服务端是多个IP,需要修改zabbix_agentd.conf
server为多个IP,用逗号隔开
 
8、zabbix_agentd [9131]: cannot run as root!
修改zabbix_agentd.conf中的
AllowRoot=1
1表示允许root 0表示不允许root
 
9、Zabbix discoverer processes more than 75% busy
修改zabbix_server.conf里面的,根据系统性能修改,这里我改为10
StartDiscoverers=10
 
10、 clipboard2
首先检查selinux是否关闭
再修改zabbix_conf.php 把localhost改成IP即可
$ZBX_SERVER      = ' serveripaddr';
 
11、Zabbix poller processes more than 75% busy
StartPollers=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.conf
Timeout=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或者更高版本的curl
 
安装完以后需要重新编译zabbix server
带上--with-libcurl参数
然后重启服务器恢复正常
 
18、More than 100 items having missing data for more than 10 minutes
可以查看Queue是不是厉害很大,彻底解决还需要优化zabbix
 

希望能对遇到同样问题的童鞋有所帮助,也是自己对zabbix研究的一个总结,后续持续更新......
如果有什么错误的地方还请大家指出!!!共同学习...

转载于:https://www.cnblogs.com/trasin/p/6221237.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值