(安西) 发表于 2018-1-1 09:57:17

糖兜guard君子不器

  转自:http://www.zabbix.org.cn/viewtopic.php?f=13&t=1096
  本人略做了写修改。
  准备工作
  apt-get update
  apt-get upgrade
  apt-get install gettext
  apt-get install unzip
  apt-get install rar
  一、安装主程序
  代码: 全选
  wget http://repo.zabbix.com/zabbix/3.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.2-1+trusty_all.deb
  dpkg -i zabbix-release_3.2-1+trusty_all.deb
  apt-get update
  apt-get install zabbix-server-mysqlzabbix-frontend-php# 装服务器端
  apt-get install zabbix-agent
  二、设置数据库表(假设你设置的mysql的root密码是123456)
  shell> mysql -uroot -p123456
  mysql> create database zabbix character setutf8 collate utf8_bin;

  mysql> grant all on zabbix.* tozabbix@localhost>  mysql> quit;
  shell> cd /usr/share/doc/zabbix-server-mysql
  shell> zcat create.sql.gz | mysql -uroot-p123456 zabbix
  三、编辑zabbix的设置文件
  # vi /etc/zabbix/zabbix_server.conf
  DBHost=localhost
  DBName=zabbix
  DBUser=zabbix
  DBPassword=zabbix
  四、编辑conf文件,准备安装
  vi /etc/apache2/conf-enabled/zabbix.conf
  编辑时区
  php_value max_execution_time 300
  php_value memory_limit 128M
  php_value post_max_size 16M
  php_value upload_max_filesize 2M
  php_value max_input_time 300
  php_value always_populate_raw_post_data -1
  # php_value date.timezone Europe/Riga
  最后一行,去掉#号,时区改成Asia/Shanghai
  开始安装
  先重启服务
  service zabbix-server start
  service apache2 restart
  然后浏览器登录:
  http://yourhost/zabbix
  数据库帐号是zabbix,密码是你设置的密码:zabbix
  一路安装。。。web登录帐号是Admin/zabbix,基本ok!
  五、优化设置
  1、启用中文
  vi /usr/share/zabbix/include/locales.inc.php
  把zh_CN后面参数写true
  然后去选择语言吧。
  如果,去选择语言的时候,你发现还是不能选择。。。。
  提示:
  You are not able to choose some of the languages,because locales for them are not installed on the web server.
  是因为你系统里没中文环境
  那么:设置中文环境
  第一步,安装中文包:
  apt-get install language-pack-zh-hantlanguage-pack-zh-hans
  第二步,配置相关环境变量:
  vi /etc/environment
  在文件中增加语言和编码的设置:
  LANG="zh_CN.UTF-8"
  LANGUAGE="zh_CN:zh:en_US:en"
  第三步,重新设置本地配置:
  dpkg-reconfigure locales
  现在重启apache&zabbix_server两个服务一下,应该可以选了。。
  2、但是我发现翻译的不好,有大神做了更好的翻译
  参见:https://github.com/echohn/zabbix-zh_CN
  先进入
  cd /usr/share/zabbix/locale/zh_CN/LC_MESSAGES目录
  代码: 全选
  wget https://github.com/echohn/zabbix-zh_CN/ ... master.zip
  unzip master.zip
  rm frontend.mo
  cp zabbix-zh_CN-master/frontend.mo frontend.mo
  现在重启apache&zabbix_server两个服务
  service zabbix-server restart
  service apache2 restart
  3、看图时候,如果有中文,会乱码
  调整图像里的中文乱码
  下载雅黑
  代码: 全选
  wget http://dx.sc.chinaz.com/Files/DownLoad/font2/dd.rar
  解压缩文件
  rar x dd.rar
  cp dd/msyh.ttf msyh.ttf
  然后修改 vi /usr/share/zabbix/include/defines.inc.php
  找到
  define('ZBX_GRAPH_FONT_NAME', 'graphfont'); //font file name
  修改成:
  define('ZBX_GRAPH_FONT_NAME', 'msyh'); // fontfile name
  重启apache服务即可
  4、重要的mibs库,必须更新,否则snmp监控交换机时,mib会报错。
  apt-get install snmp-mibs-downloader
  六、一些提示 tips
  重新启动zabbix-server服务进程
  # service zabbix-server restart
  重新启动zabbix-agent进程
  # service zabbix-server restart
  重启apache进程
  #serviceapache2 restart
  重要目录:
  log: /var/log/zabbix/zabbix_server/log和agent.log 排查错误必须
  conf:/etc/zabbix/*.conf
  安装目录:/usr/share/zabbix重要的include,font .etc
  根web目录在var/www/html

遇见的问题:
  1、Ubuntu 环境,当apache2重启提示:
  * Starting web server apache2

  apache2: Could not>
  ... waiting apache2: Could not>  解决的问题是:
  sudo vim /etc/apache2/sites-available/default
  打开default文件后,在default文件顶端加入:
  ServerName 127.0.0.1
  重启apache2就不会提示上述错误了。
vim /etc/hosts
  添加 127.0.0.1 hostname

/etc/apache2/apache2.conf
在文件后面加上:
  #Server Name
  ServerName 127.0.0.1

补充:
  Zabbix客户端的安装及配置
  apt-get update
  apt-get upgrade
  apt-get install gettext
  apt-get install unzip
  apt-get install rar
  一、安装主程序
  代码: 全选
  wget http://repo.zabbix.com/zabbix/3.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.2-1+trusty_all.deb
  dpkg -i zabbix-release_3.2-1+trusty_all.deb

  apt-get update
  apt-get install zabbix-agent
配置:
1、vim /etc/zabbix/zabbix_agentd.conf
Server=192.168.0.251
ServerActive=192.168.0.251
#ListenPort=10050
StartAgents=0
Hostname=node-31
修改后保存即可。
Server:被动模式server的ip地址
ServerActive:主动模式
页: [1]
查看完整版本: 糖兜guard君子不器