天天看點

zabbix監控應用(上)zabbix程式元件

zabbix程式元件

zabbix_server ,服務端守護程序

zabbix_agentd,agent守護程序

zabbix_proxy,代理伺服器

zabbix_database,儲存系統,mysql,pgsql

zabbix_web,web GUI 圖形化界面

zabbix_get,指令行工具,測試向agent發起資料采集請求

zabbix_sender,指令行工具,測試向server發送資料

zabbix_java_gateway,Java網關

安裝zabbix5.0

5.0版本對基礎環境的要求有大的變化,最大的要求就是對php版本要求,最低要7.2.0版本,對PHP拓展元件也有要求,詳見官方文檔

https://www.zabbix.com/documentation/current/manual/installati
on/requirements
           

準備工作關閉防火牆

# systemctl disable firewalld
# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
# reboot
           

安裝zabbix服務端配置

        擷取zabbix的下載下傳源

[[email protected] ~]# rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
           

更換zabbix的下載下傳源為阿裡雲

[[email protected] ~]# sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#' /etc/yum.repos.d/zabbix.repo
[[email protected] ~]# yum clean all
           

安裝zabbix server和agent

[ro[email protected] ~]# yum install zabbix-server-mysql zabbix-agent -y
           

安裝Software Collections便于後續安裝高版本php

[[email protected] ~]# yum install centos-release-scl -y
           

修改zabbix前端源

[[email protected] ~]# vim /etc/yum.repos.d/zabbix.repo

[zabbix-frontend]
name=Zabbix Official Repository frontend - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/$b
asearch/frontend
enabled=1 # 修改這裡
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
           

安裝zabbix前端環境

yum install zabbix-web-mysql-scl zabbix-apache-conf-scl -y
           

安裝zabbix所需的資料庫,直接用centos7自帶的mariadb

[[email protected] ~]# yum install mariadb-server -y

#配置開機自啟
[[email protected] ~]# systemctl enable --now mariadb
           

初始化mariadb,設定root密碼,設定密碼為123.com

mysql_secure_installation
           

添加資料庫使用者,以及zabbix所需的資料庫資訊

[[email protected] ~]# mysql -uroot -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 15
Server version: 5.5.68-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> 
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)

MariaDB [(none)]> 
#設定一個賬戶名為zabbix密碼為123.com
MariaDB [(none)]> create user [email protected] identified by '123.com';
Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]> 
MariaDB [(none)]> grant all privileges on zabbix.* to [email protected];
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> 
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> 
MariaDB [(none)]> quit;
Bye
[[email protected] ~]# 

           

使用以下指令導入zabbix資料庫,zabbix資料庫使用者在zabbix,密碼為123.com

[[email protected] ~]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
Enter password: 
           

修改zabbix server配置檔案/etc/zabbix/zabbix_server.conf裡的資料庫密碼

[[email protected] ~]# vim /etc/zabbix/zabbix_server.conf

#找到DBPassword設定密碼
DBPassword=123.com
           

修改zabbix的php配置檔案/etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf裡的時區

[[email protected] ~]# vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf

#找到php_value[date.timezone]更改時區
php_value[date.timezone] = Asia/Shanghai
           

啟動相關服務

[[email protected] ~]# systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
[[email protected] ~]# systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/rh-php72-php-fpm.service to /usr/lib/systemd/system/rh-php72-php-fpm.service.
           

通路

zabbix監控應用(上)zabbix程式元件

檢查元件是否正常

zabbix監控應用(上)zabbix程式元件

 輸入資料庫zabbix的密碼

zabbix監控應用(上)zabbix程式元件

 下一步

zabbix監控應用(上)zabbix程式元件

 安裝成功

zabbix監控應用(上)zabbix程式元件
zabbix監控應用(上)zabbix程式元件

 登入賬戶Admin ,密碼zabbix,注意大小寫。

zabbix監控應用(上)zabbix程式元件

繼續閱讀