博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
安装zabbix
阅读量:6530 次
发布时间:2019-06-24

本文共 14102 字,大约阅读时间需要 47 分钟。

服务器

下载zabbix yum源wget repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm

root@lynn-04 ~]# wget repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm--2018-04-11 13:46:14--  http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm正在解析主机 repo.zabbix.com (repo.zabbix.com)... 162.243.159.138正在连接 repo.zabbix.com (repo.zabbix.com)|162.243.159.138|:80... 已连接。已发出 HTTP 请求,正在等待回应... 200 OK长度:13392 (13K) [application/x-redhat-package-manager]正在保存至: “zabbix-release-3.2-1.el7.noarch.rpm”100%[===================================================================================>] 13,392      --.-K/s 用时 0s      2018-04-11 13:46:19 (34.9 MB/s) - 已保存 “zabbix-release-3.2-1.el7.noarch.rpm” [13392/13392])

安装zabbix yum源

rpm -ivh zabbix-release-3.2-1.el7.noarch.rpm

[root@lynn-04 ~]# rpm -ivh zabbix-release-3.2-1.el7.noarch.rpm警告:zabbix-release-3.2-1.el7.noarch.rpm: 头V4 RSA/SHA512 Signature, 密钥 ID a14fe591: NOKEY准备中...                          ################################# [100%]正在升级/安装...   1:zabbix-release-3.2-1.el7         ################################# [100%]

安装zabbix 和相关服务

yum install -y zabbix-agent zabbix-get zabbix-server-mysql zabbix-web zabbix-web-mysql

已安装:  zabbix-agent.x86_64 0:3.2.11-1.el7   zabbix-get.x86_64 0:3.2.11-1.el7         zabbix-server-mysql.x86_64 0:3.2.11-1.el7    zabbix-web.noarch 0:3.2.11-1.el7     zabbix-web-mysql.noarch 0:3.2.11-1.el7  作为依赖被安装:  OpenIPMI-libs.x86_64 0:2.0.19-15.el7        OpenIPMI-modalias.x86_64 0:2.0.19-15.el7 apr.x86_64 0:1.4.8-3.el7_4.1           apr-util.x86_64 0:1.5.2-6.el7               dejavu-fonts-common.noarch 0:2.33-6.el7  dejavu-sans-fonts.noarch 0:2.33-6.el7  fontpackages-filesystem.noarch 0:1.44-8.el7 fping.x86_64 0:3.10-4.el7                httpd.x86_64 0:2.4.6-67.el7.centos.6   httpd-tools.x86_64 0:2.4.6-67.el7.centos.6  iksemel.x86_64 0:1.4-6.el7               libX11.x86_64 0:1.6.5-1.el7            libX11-common.noarch 0:1.6.5-1.el7          libXau.x86_64 0:1.0.8-2.1.el7            libXpm.x86_64 0:3.5.12-1.el7           libxcb.x86_64 0:1.12-1.el7                  libzip.x86_64 0:0.10.1-8.el7             mailcap.noarch 0:2.1.41-2.el7          php.x86_64 0:5.4.16-43.el7_4.1              php-bcmath.x86_64 0:5.4.16-43.el7_4.1    php-cli.x86_64 0:5.4.16-43.el7_4.1     php-common.x86_64 0:5.4.16-43.el7_4.1       php-gd.x86_64 0:5.4.16-43.el7_4.1        php-ldap.x86_64 0:5.4.16-43.el7_4.1    php-mbstring.x86_64 0:5.4.16-43.el7_4.1     php-mysql.x86_64 0:5.4.16-43.el7_4.1     php-pdo.x86_64 0:5.4.16-43.el7_4.1     php-xml.x86_64 0:5.4.16-43.el7_4.1          t1lib.x86_64 0:5.1.2-14.el7              unixODBC.x86_64 0:2.3.1-11.el7       完毕!

安装MySQL

[root@lynn-04 ~]# yum install -y mysql

启动MySQL

[root@lynn-04 ~]# systemctl start mysql[root@lynn-04 ~]# ps aux |grep mysqlroot        939  0.0  0.1 115388  1636 ?        S    13:43   0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/lynn-04.pidmysql      1187  0.3 45.1 1038656 451720 ?      Sl   13:43   0:02 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/lynn-04.err --pid-file=/datamysql/lynn-04.pid --socket=/tmp/mysql.sockroot       1515  0.0  0.0 112680   984 pts/0    S+   13:57   0:00 grep --color=auto mysql

编辑/etc/my.cnf 加上character_set_server = utf8

[root@lynn-04 ~]# vim /etc/my.cnf[mysqld]#skip-grantcharacter_set_server = utf8datadir=/data/mysqlsocket=/tmp/mysql.sockserver-id=116log_bin=aminglinux1# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0# Settings user and group are ignored when systemd is used.# If you need to run mysqld under a different user or group,# customize your systemd unit file for mariadb according to the# instructions in http://fedoraproject.org/wiki/Systemd[mysqld_safe]#log-error=/var/log/mariadb/mariadb.log#pid-file=/var/run/mariadb/mariadb.pid## include all files from the config directory##!includedir /etc/my.cnf.d

重启MySQL

[root@lynn-04 ~]# systemctl restart mysql[root@lynn-04 ~]# ps aux |grep mysqlroot       1912  0.0  0.1 115388  1672 ?        S    14:06   0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/lynn-04.pidmysql      2084  3.5 45.5 1038656 455220 ?      Sl   14:06   0:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/lynn-04.err --pid-file=/datamysql/lynn-04.pid --socket=/tmp/mysql.sockroot       2108  0.0  0.0 112676   980 pts/0    S+   14:06   0:00 grep --color=auto mysql

在MySQL里面创建zabbix库

[root@lynn-04 ~]# mysql -uroot -p'aminglinux'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 1Server version: 5.6.35-log MySQL Community Server (GPL)Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> create database zabbix character set utf8;Query OK, 1 row affected (0.00 sec)mysql> grant all on zabbix.* to 'zabbix'@'127.0.0.1' identified by 'aming-zabbix';Query OK, 0 rows affected (0.00 sec)mysql> quitBye

导入数据

[root@lynn-04 ~]# cd /usr/share/doc/zabbix-server-mysql-3.2.11/[root@lynn-04 zabbix-server-mysql-3.2.11]# lsAUTHORS  ChangeLog  COPYING  create.sql.gz  NEWS  README[root@lynn-04 zabbix-server-mysql-3.2.11]# gzip -d create.sql.gz[root@lynn-04 zabbix-server-mysql-3.2.11]# lsAUTHORS  ChangeLog  COPYING  create.sql  NEWS  README[root@lynn-04 zabbix-server-mysql-3.2.11]# mysql -uroot -p'aminglinux' zabbix < create.sqlWarning: Using a password on the command line interface can be insecure.

查看nginx有没有启动 有则关闭 nginx占用80端口

[root@lynn-04 ~]# ps aux |grep nginxroot        915  0.0  0.1  45988  1124 ?        Ss   13:43   0:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.confnobody      919  0.0  0.3  48476  3748 ?        S    13:43   0:00 nginx: worker processnobody      920  0.0  0.3  48476  3760 ?        S    13:43   0:00 nginx: worker processroot       2119  0.0  0.0 112680   984 pts/0    S+   14:16   0:00 grep --color=auto nginx[root@lynn-04 ~]# /etc/init.d/nginx stopStopping nginx (via systemctl):                            [  确定  ][root@lynn-04 ~]# ps aux |grep nginxroot       2142  0.0  0.0 112676   984 pts/0    S+   14:17   0:00 grep --color=auto nginx

编辑/etc/zabbix/zabbix_server.conf

增加或修改
DBHost=127.0.0.1 //在DBName=zabbix上面增加
DBPassword=aming-zabbix //在DBuser下面增加

[root@lynn-04 ~]# vim /etc/zabbix/zabbix_server.conf

启动zabbix和httpd

[root@lynn-04 ~]# systemctl start zabbix-server[root@lynn-04 ~]# systemctl start httpd[root@lynn-04 ~]# ps aux |grep zabbixzabbix     2183  0.7  0.4 254760  4172 ?        S    14:28   0:00 /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.confzabbix     2186  0.0  0.2 254760  2524 ?        S    14:28   0:00 /usr/sbin/zabbix_server: configuration syncer [waiting 60 sec for processes]zabbix     2187  0.0  0.2 254760  2736 ?        S    14:28   0:00 /usr/sbin/zabbix_server: db watchdog [synced alerts config in 0.004413 sec, idle 60 sec]zabbix     2188  0.5  0.5 361700  5072 ?        S    14:28   0:00 /usr/sbin/zabbix_server: poller #1 [got 0 values in 0.000030 sec, idle 5 sec]zabbix     2189  0.2  0.5 361700  5072 ?        S    14:28   0:00 /usr/sbin/zabbix_server: poller #2 [got 0 values in 0.000058 sec, idle 5 sec]zabbix     2190  0.5  0.5 361700  5072 ?        S    14:28   0:00 /usr/sbin/zabbix_server: poller #3 [got 0 values in 0.000047 sec, idle 5 sec]zabbix     2191  0.5  0.5 361700  5072 ?        S    14:28   0:00 /usr/sbin/zabbix_server: poller #4 [got 0 values in 0.000026 sec, idle 5 sec]zabbix     2192  0.5  0.5 361700  5072 ?        S    14:28   0:00 /usr/sbin/zabbix_server: poller #5 [got 0 values in 0.000022 sec, idle 5 sec]zabbix     2193  0.5  0.5 361700  5072 ?        S    14:28   0:00 /usr/sbin/zabbix_server: unreachable poller #1 [got 0 values in 0.000062 sec, idle 5 sec]zabbix     2194  0.0  0.3 254760  3628 ?        S    14:28   0:00 /usr/sbin/zabbix_server: trapper #1 [processed data in 0.000000 sec, waiting for connection]zabbix     2195  0.0  0.3 254760  3628 ?        S    14:28   0:00 /usr/sbin/zabbix_server: trapper #2 [processed data in 0.000000 sec, waiting for connection]zabbix     2196  0.0  0.3 254760  3628 ?        S    14:28   0:00 /usr/sbin/zabbix_server: trapper #3 [processed data in 0.000000 sec, waiting for connection]zabbix     2197  0.0  0.3 254760  3628 ?        S    14:28   0:00 /usr/sbin/zabbix_server: trapper #4 [processed data in 0.000000 sec, waiting for connection]zabbix     2198  0.0  0.3 254760  3628 ?        S    14:28   0:00 /usr/sbin/zabbix_server: trapper #5 [processed data in 0.000000 sec, waiting for connection]zabbix     2199  0.0  0.2 257336  2520 ?        S    14:28   0:00 /usr/sbin/zabbix_server: icmp pinger #1 [got 0 values in 0.000066 sec, idle 5 sec]zabbix     2200  0.0  0.2 254760  2740 ?        S    14:28   0:00 /usr/sbin/zabbix_server: alerter [sent alerts: 0 success, 0 fail in 0.003299 sec, idle 30 sec]zabbix     2201  0.0  0.2 254760  2520 ?        S    14:28   0:00 /usr/sbin/zabbix_server: housekeeper [startup idle for 30 minutes]zabbix     2202  0.0  0.2 254760  2740 ?        S    14:28   0:00 /usr/sbin/zabbix_server: timer #1 [processed 0 triggers, 0 events in 0.000000 sec, 0 maintenances in 0.000000 sec, idle 30 sec]zabbix     2203  0.0  0.2 254760  2744 ?        S    14:28   0:00 /usr/sbin/zabbix_server: http poller #1 [got 0 values in 0.001774 sec, idle 5 sec]zabbix     2204  0.5  0.5 359228  5180 ?        S    14:28   0:00 /usr/sbin/zabbix_server: discoverer #1 [processed 0 rules in 0.000682 sec, idle 60 sec]zabbix     2205  0.0  0.2 254760  2868 ?        S    14:28   0:00 /usr/sbin/zabbix_server: history syncer #1 [synced 0 items in 0.000002 sec, idle 1 sec]zabbix     2206  0.0  0.2 254760  2868 ?        S    14:28   0:00 /usr/sbin/zabbix_server: history syncer #2 [synced 0 items in 0.000001 sec, idle 1 sec]zabbix     2208  0.0  0.2 254760  2868 ?        S    14:28   0:00 /usr/sbin/zabbix_server: history syncer #3 [synced 0 items in 0.000001 sec, idle 1 sec]zabbix     2215  0.0  0.2 254760  2868 ?        S    14:28   0:00 /usr/sbin/zabbix_server: history syncer #4 [synced 0 items in 0.000001 sec, idle 1 sec]zabbix     2216  0.0  0.3 254760  3804 ?        S    14:28   0:00 /usr/sbin/zabbix_server: escalator #1 [processed 0 escalations in 0.002666 sec, idle 3 sec]zabbix     2217  0.0  0.3 254760  3624 ?        S    14:28   0:00 /usr/sbin/zabbix_server: proxy poller #1 [exchanged data with 0 proxies in 0.000019 sec, idle 5 sec]zabbix     2218  0.0  0.2 254760  2632 ?        S    14:28   0:00 /usr/sbin/zabbix_server: self-monitoring [processed data in 0.000004 sec, idle 1 sec]zabbix     2220  0.0  0.2 254760  2740 ?        S    14:28   0:00 /usr/sbin/zabbix_server: task manager [started, idle 5 sec]root       2234  0.0  0.0 112680   980 pts/0    S+   14:28   0:00 grep --color=auto zabbix

浏览器访问http://ip/zabbix/ web界面下面配置zabbix

安装zabbix
所有OK的项都不用管 这里fail是提示没有设置时区
安装zabbix
在服务器上设置时区
编辑/etc/php.ini
加入date.timezone = Asia/Shanghai

[root@lynn-04 ~]# vim /etc/php.ini

重启httpd

[root@lynn-04 ~]# systemctl restart httpd

刷新网页 继续下一步

安装zabbix
填写自己在MySQL里创建zabbix时的信息
安装zabbix
自定义名字
安装zabbix
填写过的信息预览
安装zabbix
完成
安装zabbix
这里用户是Admin默认密码是zabbix
安装zabbix
登陆完成的界面
安装zabbix
选择Administration的Users里面的Admin
安装zabbix
Password 修改密码 Language 修改语言
安装zabbix
填入自己想要的密码和语言 点击Update
安装zabbix
完成刷新网页 就会显示你设置的语言
安装zabbix

客户端

下载zabbix yum源

wget repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm

[root@lynn-06 ~]# wget repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm--2018-04-11 13:48:39--  http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm正在解析主机 repo.zabbix.com (repo.zabbix.com)... 162.243.159.138正在连接 repo.zabbix.com (repo.zabbix.com)|162.243.159.138|:80... 已连接。已发出 HTTP 请求,正在等待回应... 200 OK长度:13392 (13K) [application/x-redhat-package-manager]正在保存至: “zabbix-release-3.2-1.el7.noarch.rpm”100%[===================================================================================>] 13,392      --.-K/s 用时 0.003s  2018-04-11 13:48:45 (4.68 MB/s) - 已保存 “zabbix-release-3.2-1.el7.noarch.rpm” [13392/13392])

安装zabbix yum源

rpm -ivh zabbix-release-3.2-1.el7.noarch.rpm

[root@lynn-06 ~]# rpm -ivh zabbix-release-3.2-1.el7.noarch.rpm警告:zabbix-release-3.2-1.el7.noarch.rpm: 头V4 RSA/SHA512 Signature, 密钥 ID a14fe591: NOKEY准备中...                          ################################# [100%]正在升级/安装...   1:zabbix-release-3.2-1.el7         ################################# [100%]

安装zabbix-agent

[root@lynn-06 ~]# yum install -y zabbix-agent

编辑/etc/zabbix/zabbix_agentd.conf

做出如下修改:
Server=127.0.0.1修改为Server=192.168.130.116 //定义服务端的ip(被动模式)
ServerActive=127.0.0.1修改为ServerActive=192.168.130.116 //定义服务端的ip(主动模式)
Hostname=Zabbix server修改为Hostname=aming-02//这是自定义的主机名,一会还需要在web界面下设置同样的主机名
启动zabbix-agent

[root@lynn-06 ~]# systemctl start zabbix-agent[root@lynn-06 ~]# ps aux |grep zabbixzabbix     1268  0.0  0.1  80880  1260 ?        S    15:09   0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.confzabbix     1269  0.0  0.1  80880  1420 ?        S    15:09   0:00 /usr/sbin/zabbix_agentd: collector [idle 1 sec]zabbix     1270  0.0  0.1  80880  1844 ?        S    15:09   0:00 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection]zabbix     1271  0.0  0.1  80880  1844 ?        S    15:09   0:00 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection]zabbix     1272  0.0  0.1  80880  1844 ?        S    15:09   0:00 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection]zabbix     1273  0.0  0.2  81012  2200 ?        S    15:09   0:00 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]root       1275  0.0  0.0 112676   984 pts/0    S+   15:09   0:00 grep --color=auto zabbix

转载于:https://blog.51cto.com/10963213/2096954

你可能感兴趣的文章
我的友情链接
查看>>
在广州的犄角旮旯里,寻找老字号的独特味道
查看>>
Linux权限管理(基本权限、默认权限)
查看>>
corosync+pacemaker实现高可用集群
查看>>
我的友情链接
查看>>
LVM管理 - PV,VG以及LV
查看>>
Java集合的知识点
查看>>
Unity资源管理原理知识
查看>>
Maven生命周期详解
查看>>
【Android】Uri、UriMatcher、ContentUris详解
查看>>
xargs用法
查看>>
Composer 安装
查看>>
cacti插件的下载链接
查看>>
SpringMVC 搭建
查看>>
CentOS中查看物理CPU信息的方法
查看>>
Spring如何为bean注入null值
查看>>
300+零售CIO大咖齐聚杭州 他们聊了什么?
查看>>
【游戏开发备注之二】配置Xcode版本控制SVN详细步骤内含部分问题解决方案
查看>>
学习编程,如果当初有人给我这些忠告就该有多好!
查看>>
书生教你cocos2d-x-保卫萝卜(四)
查看>>