Zabbix安装实验报告(Centos7 Windows10 zabbix-4.0 )

Zabbix安装实验报告(Centos7 Windows10 zabbix-4.0 )

一、Zabbix 主机的初始配置

配置IP地址、主机名,关闭 kdump 与 SELinux

配置IP地址
TYPE="Ethernet"
BOOTPROTO="static"
DEFROUTE="yes"
PEERDNS="yes"
PEERROUTES="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens33"
UUID="c6ccf3d4-1631-4ad8-b106-767335dfd119"
DEVICE="ens33"
ONBOOT="yes"
IPADDR="192.168.22.39"
GATEWAY="192.168.22.254"
NETMASK="255.255.255.0"
DNS1="114.114.114.114"
DNS2="8.8.8.8"

设置主机名
[root@localhost ~]# vim /etc/sysconfig/network
# Created by anaconda
HOSTNAME=gzt.linux.org
[root@localhost ~]#  vim /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6 
192.168.22.39  gzt gzt.linux.org 

关闭 kdump 与 SELinux
[root@localhost ~]# vim /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

[root@localhost ~]# systemctl disable kdump
[root@localhost ~]# systemctl stop kdump
[root@localhost ~]# reboot


二、部署 LAMP

安装Apache 和 Mariadb
[root@localhost ~]# yum -y install httpd
[root@localhost ~]#  yum install mariadb-server -y
[root@gzt ~]# systemctl start httpd.service 
[root@gzt ~]# systemctl enable  httpd.service 
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@gzt ~]# systemctl start mariadb.service
[root@gzt ~]#  systemctl enable mariadb.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

安装php包
[root@localhost ~]# yum -y install php
安装PHP组件,使PHP支持 MariaDB
[root@localhost ~]# yum -y install php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash

重启MariaDB、 Apache
[root@gzt ~]# systemctl restart mariadb.service
[root@gzt ~]# systemctl restart httpd.service

三、部署Zabbix

1、安装“Zabbix安装包”资源存储库

[root@gzt ~]# rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
Retrieving https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
warning: /var/tmp/rpm-tmp.ox4o84: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:zabbix-release-4.0-2.el7         ################################# [100%]
[root@gzt ~]# yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: yum zabbix zabbix-non-supported
Cleaning up everything
Cleaning up list of fastest mirrors

2、安装Zabbix server,Web前端,agent

[root@gzt ~]# yum -y install  zabbix-server-mysql zabbix-web-mysql zabbix-agent
 [root@gzt ~]#yum -y install centos-release-scl 

3、对数据库进行初始化并创建Zabbix数据库

[root@gzt ~]# mysqladmin -u root password 123456789
[root@gzt ~]# mysql -uroot -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 7
Server version: 5.5.52-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by'Z123456789';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> quit
Bye

[root@gzt ~]# zcat /usr/share/doc/zabbix-server-mysql-4.0.27/create.sql.gz |mysql -uroot zabbix -p  (123456789)

3、编辑Zabbix数据库配置文件并启动Zabbix服务

[root@gzt ~]# vim /etc/zabbix/zabbix_server.conf
DBHost=localhost //第91行
DBName=zabbix //第101行
DBUser=zabbix //第117行
DBPassword=Z123456789 //第125行
[root@gzt ~]# systemctl start zabbix-server
[root@gzt ~]# systemctl enable zabbix-server
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.

4、修改 /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf

[root@gzt ~]# vim /etc/httpd/conf.d/zabbix.conf
。。。。。。
php_value date.timezone Asia/Chongqing
。。。。。。

5、配置防火墙

[root@gzt ~]# firewall-cmd --permanent --zone=public --add-port=10051/tcp
success
[root@gzt ~]# firewall-cmd --zone=public --add-port=10051/tcp
success
[root@gzt ~]# firewall-cmd --permanent --zone=public --add-port=80/tcp
success
[root@gzt ~]# firewall-cmd --zone=public --add-port=80/tcp
success

6、启动 Zabbix server and agent

[root@gzt ~]# systemctl restart zabbix-server zabbix-agent httpd
[root@gzt ~]# systemctl enable zabbix-server zabbix-agent httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.

7、在WebUI中继续安装

[root@gzt ~]# firefox http://127.0.0.1/zabbix

8、在WebUI中继续安装

8.1欢迎使用Zabbix

Zabbix安装实验报告(Centos7 Windows10 zabbix-4.0 )_第1张图片

8.2检查先决条件

Zabbix安装实验报告(Centos7 Windows10 zabbix-4.0 )_第2张图片

8.3配置数据库连接(密码:Z123456789)

Zabbix安装实验报告(Centos7 Windows10 zabbix-4.0 )_第3张图片

8.4配置服务器详细信息

Zabbix安装实验报告(Centos7 Windows10 zabbix-4.0 )_第4张图片

8.5 预安装总结

Zabbix安装实验报告(Centos7 Windows10 zabbix-4.0 )_第5张图片

8.6安装完成

Zabbix安装实验报告(Centos7 Windows10 zabbix-4.0 )_第6张图片

9、在WebUI中登录

第一次登录,用户名:Admin,密码:zabbix
Zabbix安装实验报告(Centos7 Windows10 zabbix-4.0 )_第7张图片

WebUI主界面

Zabbix安装实验报告(Centos7 Windows10 zabbix-4.0 )_第8张图片

10、修改WebUI界面语言为中文

10.1点击右上角“个人配置”

Zabbix安装实验报告(Centos7 Windows10 zabbix-4.0 )_第9张图片

10.2选择Language为Chinese(zh_CN),再点击“Update”

Zabbix安装实验报告(Centos7 Windows10 zabbix-4.0 )_第10张图片

11、被监测端(Agent)配置

11.1 Linux Agent的安装与配置
关闭 kdump 与 SELinux
[root@localhost ~]# vim /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

[root@localhost ~]# systemctl disable kdump
[root@localhost ~]# systemctl stop kdump
[root@localhost ~]# reboot

Linux Agent的安装与配置
[root@localhost ~]# rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
Retrieving https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
warning: /var/tmp/rpm-tmp.6AMf64: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:zabbix-release-4.0-2.el7         ################################# [100%]
[root@localhost ~]# yum -y install zabbix-agent
[root@localhost ~]# vim /etc/zabbix/zabbix_agentd.conf
Server=192.168.22.222 //第98行
ServerActive=192.168.22.222 //第139行
[root@localhost ~]# systemctl  start zabbix-agent.service 
[root@localhost ~]# systemctl  enable  zabbix-agent.service 
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# netstat -anpt |grep zabbix
tcp        0      0 0.0.0.0:10050           0.0.0.0:*               LISTEN      1097/zabbix_agentd  
tcp6       0      0 :::10050                :::*                    LISTEN      1097/zabbix_agentd 

11.2、在zabbix中添加客户机信息

右上角“创建主机”——> 主机:添加主机名,群组,客户机IP——>模板:选择模板类型;添加;添加。
Zabbix安装实验报告(Centos7 Windows10 zabbix-4.0 )_第11张图片

Zabbix安装实验报告(Centos7 Windows10 zabbix-4.0 )_第12张图片

Zabbix安装实验报告(Centos7 Windows10 zabbix-4.0 )_第13张图片

12在win10中部署zabbix

12.1被监测端(Agent)配置

12.1.1 Windows Agent的安装与配置

1、下载地址https://cdn.zabbix.com/zabbix/binaries/stable/4.0/4.0.27/zabbix_agent-4.0.27-windows-amd64.zip

2、将下载好的安装包解压到C盘根目录下,并将zabbix_agent-4.0.27-windows-amd64\conf\zabbix_agentd.conf 复制到C盘根目录下,如图
Zabbix安装实验报告(Centos7 Windows10 zabbix-4.0 )_第14张图片
3、使用电脑自带写字板工具编辑zabbix_agentd.conf,添加监控服务器IP地址,修改主机名为本机主机名
Zabbix安装实验报告(Centos7 Windows10 zabbix-4.0 )_第15张图片
Zabbix安装实验报告(Centos7 Windows10 zabbix-4.0 )_第16张图片
Zabbix安装实验报告(Centos7 Windows10 zabbix-4.0 )_第17张图片
4、以管理员权在这里插入代码片限运行CMD
Zabbix安装实验报告(Centos7 Windows10 zabbix-4.0 )_第18张图片
5、安装并启动

C:\>cd zabbix_agent-5.0.2-windows-amd64\bin
C:\zabbix_agent-5.0.2-windows-amd64\bin>zabbix_agentd.exe -c c:\zabbix_agentd.conf -i 
C:\zabbix_agent-5.0.2-windows-amd64\bin>zabbix_agentd.exe -c c:\zabbix_agentd.conf -s

Zabbix安装实验报告(Centos7 Windows10 zabbix-4.0 )_第19张图片
6、防火墙设置:控制面板——系统和安全——防火墙——高级设置——入站规则——新建规则——端口——TCP;特定本地端口10050——允许连接——下一步——名称自拟——完成

12.1.2 回到服务器端添加主机 (主机名要和Windows端主机名一致)
Zabbix安装实验报告(Centos7 Windows10 zabbix-4.0 )_第20张图片

Zabbix安装实验报告(Centos7 Windows10 zabbix-4.0 )_第21张图片
Zabbix安装实验报告(Centos7 Windows10 zabbix-4.0 )_第22张图片

你可能感兴趣的:(Zabbix安装实验报告(Centos7 Windows10 zabbix-4.0 ))