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

8.2檢查先決條件

8.3配置資料庫連接(密碼:Z123456789)

8.4配置服務器詳細資訊

8.5 預安裝總結

8.6安裝完成

9、在WebUI中登錄
第一次登錄,用戶名:Admin,密碼:zabbix

WebUI主界面

10、修改WebUI界面語言為中文
10.1點擊右上角“個人配置”

10.2選擇Language為Chinese(zh_CN),再點擊“Update”

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——>模板:選擇模板型別;添加;添加,



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盤根目錄下,如圖

3、使用電腦自帶寫字板工具編輯zabbix_agentd.conf,添加監控服務器IP地址,修改主機名為本機主機名



4、以管理員權在這里插入代碼片限運行CMD

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

6、防火墻設定:控制面板——系統和安全——防火墻——高級設定——入站規則——新建規則——埠——TCP;特定本地埠10050——允許連接——下一步——名稱自擬——完成
12.1.2 回到服務器端添加主機 (主機名要和Windows端主機名一致)



轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/239606.html
標籤:其他
上一篇:華為ensp常用簡單命令(一)
下一篇:Shell函式知識點大全
