判官007 发表于 2019-1-25 06:28:46

zabbix3.0.1安装过程的小坑

  1.安装
  首先lamp环境安装完毕,开始安装zabbix;
  下载完毕zabbix-3.0.1.tar.gz,解压
  cdzabbix-3.0.1
  ./configure --prefix=/usr/local/zabbix--enable-server \
  --enable-proxy --enable-agent --enable-ipv6--with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp \
  --with-libcurl --with-openipmi--with-unixodbc --with-ldap --with-ssh2 --enable-java --enable-ipv6--enable-proxy
  自行编译但是会报错:
  Unixodbc没找到
  mysql_config
  configure: error: SSH2 library not found
  yum install php-pecl-ssh2.x86_64 libssh2-devel.x86_64
  yum install net-snmp-devel
  yum -y install unixODBC*
  yum install openldap openldap-devel
  yumlist openldap
  yumlist openldap-devel
  checking for SSH2 support... yes
  checking for OPENIPMI support... no
  configure: error: Invalid OPENIPMIdirectory - unable to find ipmiif.h
  https://centos.pkgs.org/6/centos-x86_64/OpenIPMI-2.0.16-14.el6.x86_64.rpm.html
  rpm -ivh OpenIPMI-2.0.16-14.el6.x86_64.rpm
  yum install OpenIPMI-devel
  报错checking for OPENIPMI support... no
  configure: error: Invalid OPENIPMIdirectory - unable to find ipmiif.h
  需要安装OpenIPMI和OpenIPMI-devel
  Yum安装OpenIPMI并下载OpenIPMI-devel-2.0.16-14.el6.x86_64.rpm
  # yum install OpenIPMI
  # rpm -ivhOpenIPMI-devel-2.0.16-14.el6.x86_64.rpm
  报错 error: Failed dependencies:
  pkgconfig(ncurses) is needed byOpenIPMI-devel-2.0.16-14.el6.x86_64
  # yum install ncurses-devel
  # rpm -ivhOpenIPMI-devel-2.0.16-14.el6.x86_64.rpm
  onfigure: error: Invalid OPENIPMI directory- unable to find ipmiif.h
  需要安装libssh2-devel
  configure: error: Invalid OPENIPMIdirectory - unable to find ipmiif.h
  需要安装OpenIPMI-devel
  hecking for SSH2 support... yes
  checking for OPENIPMI support... yes
  checking for javac... no
  configure: error: Unable to find"javac" executable in path
  configure: error: Jabber library notfound#yum install iksemel-devel即可,
  configure: error: LIBXML2 library not found
  #yum install libxml2-devel
  configure: error: unixODBC library notfound
  #yum install unixODBC-devel
  configure: error: Invalid OPENIPMIdirectory - unable to find ipmiif.h
  #yum install OpenIPMI-devel
  configure: error: Unable to find"javac" executable in path
  #yum install java*    具体什么包没找,直接通配算逑,生产环境可去掉--enable-java选项
  configure: error: Curl library not found
  #yum install curl-devel
  make && make install
  2. 导数据库顺序schema-image-data,
  添加系统软连接:
  # ln -s /usr/local/zabbix/sbin/* /usr/local/sbin/
  # ln -s /usr/local/zabbix/bin/* /usr/local/bin/
  添加zabbix服务对应的端口:
  # vim /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配置文件:
  # vim /usr/local/zabbix/etc/zabbix_server.conf
  修改以下几处:
  DBName=zabbix
  DBUser=zabbix
  DBPassword=zabbix
  AlertScriptsPath==/usr/local/zabbix/share/zabbix/alertscripts#zabbix运行脚本存放目录
  DBPort=3306
  vim /usr/local/zabbix/etc/zabbix_agentd.conf
  Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/
  UnsafeUserParameters=1#启用自定义key
  添加开机启动脚本:
  # cp /usr/local/src/zabbix-3.0.3/misc/init.d/fedora/core/zabbix_server /etc/rc.d/init.d/zabbix_server
  客户端:
  # cp /usr/local/src/zabbix-3.0.3/misc/init.d/fedora/core/zabbix_agentd /etc/rc.d/init.d/zabbix_agentd
  # chmod a+x /etc/rc.d/init.d/zabbix_*
  # chkconfig zabbix_server on
  # chkconfig zabbix_agentd on
  修改zabbix开机启动脚本中的zabbix安装目录:
  # vim /etc/rc.d/init.d/zabbix_server
  修改以下内容:
  BASEDIR=/usr/local/zabbix/
  # vim /etc/rc.d/init.d/zabbix_agentd
  修改以下内容:
  BASEDIR=/usr/local/zabbix/
  复制zabbix的web站点文件到nginx:
  # cp -r /usr/local/src/zabbix-3.0.3/frontends/php/* /usr/local/nginx/html/zabbix/
  启动:
  # systemctl daemon-reload
  # service zabbix_server start
  # service zabbix_agentd start
  查看进程:ps -eaf|grep zabbix_server
  zabbix_server : cannot run as root!
  添加zabbix用户;
  在zabbix/setup/php 页面会检测信息可能会报错要都ok才能下一步哦,
  按照报错信息调试vim /etc/php.ini
  查找如下参数并修改为:
  ----------------
  post_max_size = 16M
  max_execution_time = 300
  max_input_time = 300
https://s3.运维网.com/wyfs02/M01/8F/99/wKiom1jmB2ey6X9vAABSvQBG_-U773.png-wh_500x0-wm_3-wmp_4-s_586148444.png
  /etc/php.ini修改以后还是这样,可能php.ini路径修改了,
  本例中就是到
  -rw-r--r-- 1 root root 73930 Mar 27 18:19php.ini
  -rw-r--r-- 1 root root 73928 Mar 27 18:18php.ini_0327
  # pwd
  /usr/local/php/etc
  vim /usr/local/nginx/html/zabbix/include/locales.inc.php
  修改中文字符;chinese--true
  邮件报警:在zabbix mkdir alertscripts vim send_email.sh
  #!/bin/sh
  #export.UTF-8
  FILE=/var/log/zabbix/mailtmp.txt
  echo "$3" >$FILE
  dos2unix -k $FILE
  /bin/mail -s "$2" $1 < $FILE
  zabbix-管理--示警媒介类型--定制脚本-sendmail脚本,--添加联系人邮件。。

页: [1]
查看完整版本: zabbix3.0.1安装过程的小坑