设为首页 收藏本站
查看: 1622|回复: 0

[经验分享] ZABBIX4.0安装笔记

[复制链接]

尚未签到

发表于 2019-1-18 13:57:42 | 显示全部楼层 |阅读模式
  zabbix(音同 zæbix)是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。zabbix能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题。#### zabbix(音同 zæbix)是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。zabbix能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题。

  1、zabbix安装的相关版本信息。
  linux:centos 6.9 x64
zabbix:4.0
php:5.6
httpd:1.12.2
Mysql:5.7.21
2、安装zabbix官方yum源;repo.zabbix.yum

  (1)下载zabbix yum源安装包

[root@test opt]# ll /etc/yum.repos.d/
total 24
-rw-r--r--. 1 root root 1991 Mar 28  2017 CentOS-Base.repo
-rw-r--r--. 1 root root  647 Mar 28  2017 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  289 Mar 28  2017 CentOS-fasttrack.repo
-rw-r--r--. 1 root root  630 Mar 28  2017 CentOS-Media.repo
-rw-r--r--. 1 root root 7989 Mar 28  2017 CentOS-Vault.repo
[root@test opt]# rpm -ivh  https://repo.zabbix.com/zabbix/4.0/rhel/6/x86_64/zabbix-release-4.0-1.el6.noarch.rpm
Retrieving https://repo.zabbix.com/zabbix/4.0/rhel/6/x86_64/zabbix-release-4.0-1.el6.noarch.rpm
warning: /var/tmp/rpm-tmp.lvjyfT: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Preparing...                ########################################### [100%]
1:zabbix-release         ########################################### [100%]
[root@test opt]# ll /etc/yum.repos.d/
total 28
-rw-r--r--. 1 root root 1991 Mar 28  2017 CentOS-Base.repo
-rw-r--r--. 1 root root  647 Mar 28  2017 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  289 Mar 28  2017 CentOS-fasttrack.repo
-rw-r--r--. 1 root root  630 Mar 28  2017 CentOS-Media.repo
-rw-r--r--. 1 root root 7989 Mar 28  2017 CentOS-Vault.repo
-rw-r--r--. 1 root root  636 Oct  2 15:34 zabbix.repo
(2)查看yum源是否安装完成。
[root@test yum.repos.d]# cat zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=http://repo.zabbix.com/zabbix/4.0/rhel/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-deprecated]
name=Zabbix Official Repository deprecated - $basearch
baseurl=http://repo.zabbix.com/zabbix/4.0/rhel/6/$basearch/deprecated
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=http://repo.zabbix.com/non-supported/rhel/6/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1
  3、Zabbix数据库配置。

(1)安装mysql 5.7;默认情况下centos6数据库版本5.1。因此这里先更新下yum源,安装mysql-commiunt-server 5.7版本。
a、下载mysql-commnity yum源
[root@test yum.repos.d]# wget -P /opt/ https://dev.mysql.com/get/mysql80-community-release-el6-1.noarch.rpm
--2018-10-26 10:32:59--  https://dev.mysql.com/get/mysql80-community-release-el6-1.noarch.rpm
Resolving dev.mysql.com... 137.254.60.11
Connecting to dev.mysql.com|137.254.60.11|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://repo.mysql.com//mysql80-community-release-el6-1.noarch.rpm [following]
--2018-10-26 10:33:00--  https://repo.mysql.com//mysql80-community-release-el6-1.noarch.rpm
Resolving repo.mysql.com... 23.220.145.218
Connecting to repo.mysql.com|23.220.145.218|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 25800 (25K) [application/x-redhat-package-manager]
Saving to: “/opt/mysql80-community-release-el6-1.noarch.rpm”
100%[===========================================================>] 25,800      --.-K/s   in 0.05s   
2018-10-26 10:33:01 (524 KB/s) - “/opt/mysql80-community-release-el6-1.noarch.rpm” saved [25800/25800]
  b、安装mysql源

[root@test yum.repos.d]# rpm -ivh /opt/mysql80-community-release-el6-1.noarch.rpm
warning: /opt/mysql80-community-release-el6-1.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
1:mysql80-community-relea########################################### [100%]
  C、配置数据库

修改mysql-community.repo源中mysql5.7的配置enbale=1后安装mysql-community-server (5.7版本)yum --y install mysql-community-server后配置数据库,设置密码(此处省略)
mysql5.7重置密码链接:https://www.iyunv.net/article/100211.htm
  (2)root用户登录数据库。mysql -uroot -predhat
(3)创建zabbix数据库

mysql> CREATE DATABASE zabbix CHARACTER SET utf8;
Query OK, 1 row affected (0.00 sec)
  (4)创建zabbix用户并授权:

mysql> GRANT ALL PRIVILEGES ON zabbix.* TO 'zbxuser'@'%' IDENTIFIED BY 'wl874133407@WL';
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
  (5)测试数据库连接是否正常

  4、安装配置zabbix_server段启动

(1)安装zabbix server端的数据库连接:yum install zabbix-server-mysql
(2)配置zabbix的server端数据连接:
[root@localhost ~]# vim /etc/zabbix/zabbix_server.conf
ListenPort=10051
DBHost=127.0.0.1
DBName=zabbix
DBUser=zbxuser
DBPassword=wl874133407@WL
DBSocket=/tmp/mysql.sock
DBPort=3306
(3)导入zabbix自带数据库
[root@test ~]# zcat  /usr/share/doc/zabbix-server-mysql-4.0.0/create.sql.gz  | mysql -uzbxuser -pwl874133407@WL zabbix
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@test ~]# mysql -uzbxuser -pwl874133407@WL
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.7.24 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| zabbix             |
+--------------------+
2 rows in set (0.00 sec)
mysql> use zabbix
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+----------------------------+
| Tables_in_zabbix           |
+----------------------------+
| acknowledges               |
| actions                    |
| alerts                     |
| application_discovery      |
| application_prototype      
............
  (4)启动zabbix server端:
[root@test ~]#  service zabbix-server start
5、安装zabbix的agent端
(1)安装zabbix agent端以及相关组件的安装
[root@test ~]# yum install zabbix-agent zabbix-sender zabbix-get
(2)修改zabbix的配置文件:/etc/zabbix/zabbix_agentd.conf

Server=172.20.2.245  #填写zabbix server的地址,本机可以为127.0.0.1
ListenPort=10050
ListenIP=0.0.0.0
ServerActive=172.20.2.245
  (3)启动zabbix agent端

[root@localhost ~]# service zabbix-agent start
Starting Zabbix agent:                                     [  OK  ]
  6.安装Web环境与zabbix的web端:
(1)安装php YUM源

rpm -ivh  http://mirror.webtatic.com/yum/el6/latest.rpm
  (2)安装zabbix需要的web环境

yum install httpd php56w php56w-bcmath php56w-cli php56w-common php56w-gd php56w-mbstring php56w-mysql php56w-pdo php56w-xml php56w-ldap
  (3)安装zabbix的web端

yum install zabbix-web zabbix-web-mysql
  (4)修改PHP的配置文件

[root@localhost ~]# vim /etc/php.ini
date.timezone = Asia/Shanghai
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
always_populate_raw_post_data = -1
  (5)配置zabbix的web访问并启动:

[root@localhost ~]# cp -R /usr/share/zabbix /var/www/html/
[root@localhost ~]# chown apache:apache -R /var/www/html/zabbix
[root@localhost ~]# service httpd restart
  (6)访问zabbix页面
http://172.20.2.245/zabbix  

至此zabbix 4.0安装完成。后续跟进界面提示,进行配置后尽可以进去zabbix管理界面。
默认用户名密码:admin/zabbix




运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-664884-1-1.html 上篇帖子: zabbix企业应用之监控动作是否有被关闭 下篇帖子: centos7手把手教你搭建zabbix监控
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表