zabbix 2.2.2 安装部署

Posted jks巴顿

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了zabbix 2.2.2 安装部署相关的知识,希望对你有一定的参考价值。

zabbix 2.2.2版本与1.8.3版本安装过程略有不同,下面为实施步骤:

服务端:172.16.1.61

客户端:172.16.1.8

搭建zbbix软件

安装LAMP环境及依赖包

  1. [root@localhost ~]# yum install mysql-server mysql-devel libcurl-devel net-snmp-devel php php-gd php-xml php-mysql php-mbstring php-bcmath httpd

添加用户

  1. [root@localhost ~]# groupadd zabbix
  2. [root@localhost ~]# useradd zabbix -g zabbix

   

创建数据库,添加用户授权

  1. [root@localhost ~]# /etc/init.d/mysqld start
  2. [root@localhost ~]# mysql -e "create database zabbix character set utf8;"
  3. [root@localhost ~]# mysql -e "grant all privileges on zabbix.* to zabbix@localhost identified by \'111111\';"

   

编译安装zabbix

  • 安装下载
yum install gcc gcc-c++
wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.2.2/zabbix-2.2.2.tar.gz/download

 

  • 编译
  1. [root@localhost ~]# cd /usr/local/src/
  2. [root@localhost src]# tar zxf zabbix-2.0.2.tar.gz
  3. [root@localhost src]# cd zabbix-2.0.2
  4. [root@localhost zabbix-2.0.2]# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl
  5. [root@localhost zabbix-2.0.2]# make install

   

导入数据库

  1. [root@localhost zabbix-2.0.2]# mysql -uzabbix -p\'111111\' zabbix < database/mysql/schema.sql
  2. [root@localhost zabbix-2.0.2]# mysql -uzabbix -p\'111111\' zabbix < database/mysql/images.sql
  3. [root@localhost zabbix-2.0.2]# mysql -uzabbix -p\'111111\' zabbix < database/mysql/data.sql

 

拷贝、修改配置文件

  1. [root@localhost zabbix-2.0.2]# sed -i \'s/^DBUser=.*$/DBUser=zabbix/g\' /usr/local/zabbix/etc/zabbix_server.conf
  2. [root@localhost zabbix-2.0.2]# sed -i \'s/^.*DBPassword=.*$/DBPassword=111111/g\' /usr/local/zabbix/etc/zabbix_server.conf
  3. [root@localhost zabbix-2.0.2]# cp -r frontends/php /var/www/html/zabbix
  4. [root@localhost zabbix-2.0.2]# cp misc/init.d/fedora/core/zabbix_server /etc/init.d/
  5. [root@localhost zabbix-2.0.2]# cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
  6. [root@localhost zabbix-2.0.2]#sed -i \'s/BASEDIR=\\/usr\\/local/BASEDIR=\\/usr\\/local\\/zabbix/g\' /etc/init.d/zabbix_server
  7. [root@localhost zabbix-2.0.2]#sed -i \'s/BASEDIR=\\/usr\\/local/BASEDIR=\\/usr\\/local\\/zabbix/g\' /etc/init.d/zabbix_agentd

   

添加服务端口

  1. [root@localhost ~]# cat >>/etc/services <<EOF
  2. zabbix-agent 10050/tcp Zabbix Agent
  3. zabbix-agent 10050/udp Zabbix Agent
  4. zabbix-trapper 10051/tcp Zabbix Trapper
  5. abbix-trapper 10051/udp Zabbix Trapper
  6. EOF

   

修改php.ini

  1. [root@localhost ~]#sed -i \'s/^\\(.*\\)date.timezone =.*$/date.timezone = Asia\\/Shanghai/g\' /etc/php.ini
  2. [root@localhost ~]#sed -i \'s/^\\(.*\\)post_max_size =.*$/post_max_size = 16M/g\' /etc/php.ini
  3. [root@localhost ~]#sed -i \'s/^\\(.*\\)max_execution_time =.*$/max_execution_time = 300/g\' /etc/php.ini
  4. [root@localhost ~]#sed -i \'s/^\\(.*\\)max_input_time =.*$/max_input_time = 300/g\' /etc/php.ini

 编写配置文件

  1. [root@localhost zabbix-2.0.2]# vi /usr/local/zabbix/etc/zabbix_agentd.conf
  2. Server=172.16.1.61
  3. ServerActive = 172.16.1.61
  4. Hostname=172.16.1.61
  5. [root@localhost zabbix-2.0.2]# /etc/init.d/zabbix_agentd start
  6. [root@localhost zabbix-2.0.2]# tail -f /tmp/zabbix_agentd.log

 

启动服务

  1. [root@localhost ~]# /etc/init.d/zabbix_server start
  2. [root@localhost ~]# /etc/init.d/zabbix_agentd start
  3. [root@localhost ~]# /etc/init.d/httpd start

   

WEB配置服务

http://172.16.1.61/zabbix

以下截图是在安装2.0.1版本的截图,2.0.2版本完全一致。

检查php环境

数据库配置

   

主机IP,端口

预览配置

配置Fail,点击Save configuration file将zabbix.conf.php保存到本地,再上传至服务器/var/www/html/zabbix/conf目录,然后Retry

刷新后配置正确,点击Finsh完成

登陆页面,默认用户名:admin  密码:zabbix

登陆首页

更换语言



 

更换中文后图像出现乱码解决方法:上传windows中文字体到服务器替换原字体。

  1. [root@localhost ~]#cd /var/www/html/zabbix/fonts
  2. [root@localhost ~]#mv DejaVuSans.ttf DejaVuSans.ttf_bak #备份原字体
  3. [root@localhost ~]#mv msyh.ttf DejaVuSans.ttf #雅黑字体

客户端安装,这次新版本采用源码安装

添加用户

  1. [root@localhost ~]# groupadd zabbix
  2. [root@localhost ~]# useradd zabbix -g zabbix

解压文件

  1. [root@localhost ~]# cd /usr/local/src/
  2. [root@localhost src]# tar zxf zabbix-2.0.2.tar.gz

编译安装

  1. [root@localhost src]# cd zabbix-2.0.2
  2. [root@localhost zabbix-2.0.2]# ./configure --prefix=/usr/local/zabbix --enable-agent
  3. [root@localhost zabbix-2.0.2]#?make install
  4. [root@localhost zabbix-2.0.2]# cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
  5. ?[root@localhost zabbix-2.0.2]#sed -i \'s/BASEDIR=\\/usr\\/local/BASEDIR=\\/usr\\/local\\/zabbix/g\' /etc/init.d/zabbix_agentd

编写配置文件

  1. [root@localhost zabbix-2.0.2]# vi /usr/local/zabbix/etc/zabbix_agentd.conf
  2. Server=172.16.1.61
  3. ServerActive = 172.16.1.61
  4. Hostname=Zabbix-client
  5. [root@localhost zabbix-2.0.2]# /etc/init.d/zabbix_agentd start
  6. [root@localhost zabbix-2.0.2]# tail -f /tmp/zabbix_agentd.log

以上是关于zabbix 2.2.2 安装部署的主要内容,如果未能解决你的问题,请参考以下文章

Zabbix实战之部署篇Zabbix客户端的安装部署方法

zabbix agent源码安装

zabbix安装完成后启动提示错误

最全的zabbix部署(Serveragentproxy)

NH.A.0002__zabbix_lamp+zabbix_server源码编译安装_V2020.10.22

Zabbix监控平台安装部署