1. 程式人生 > >Zabbix3.4安裝部署 操作過程手冊

Zabbix3.4安裝部署 操作過程手冊

zabbix linux

1 系統環境
cat /etc/redhat-release
更新centos yum -y update
技術分享圖片
2 關閉防火墻
systemctl stop firewalld.service
systemctl disable firewalld.service
sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/‘ /etc/selinux/config
grep SELINUX=disabled /etc/selinux/config
setenforce 0
reboot重啟服務器
技術分享圖片
3 安裝MariaDB
yum install mariadb-server mariadb -y
systemctl start mariadb #啟動MariaDB
systemctl enable mariadb #設置開機啟動

4 Zabbix3.4安裝
rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
yum install zabbix-server-mysql zabbix-web-mysql -y

5 創建數據庫
登錄數據庫:mysql -uzabbix -pzabbix
創建數據庫:create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by ‘zabbix‘;

查看數據庫:show databases;
退出:quit
6 導入數據
查看目錄下zabbix版本:Cd /usr/share/doc ls
技術分享圖片
zcat /usr/share/doc/zabbix-server-mysql-3.4.5/create.sql.gz | mysql -uzabbix -pzabbix zabbix
7 配置數據庫用戶及密碼
grep -n ‘^‘[a-Z] /etc/zabbix/zabbix_server.conf
38:LogFile=/var/log/zabbix/zabbix_server.log
49:LogFileSize=0
72:PidFile=/var/run/zabbix/zabbix_server.pid
82:SocketDir=/var/run/zabbix
101:DBName=zabbix
117:DBUser=root
330:SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
448:Timeout=4
490:AlertScriptsPath=/usr/lib/zabbix/alertscripts
500:ExternalScripts=/usr/lib/zabbix/externalscripts
536:LogSlowQueries=3000
技術分享圖片
8 啟動zabbix server並設置開機啟動
systemctl enable zabbix-server
systemctl start zabbix-server
9 編輯Zabbix前端PHP配置,更改時區
vi /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai

10 SELinux配置
setsebool -P httpd_can_connect_zabbix on
setsebool -P httpd_can_network_connect_db on
11 啟動httpd並設置開機啟動
systemctl start httpd
systemctl enable httpd

12 安裝Zabbix Web
瀏覽器訪問,並進行安裝 http://172.19.34.144/zabbix/
技術分享圖片

12.1 檢查狀態
技術分享圖片

12.2 連接到數據庫
技術分享圖片
12.3 選擇默認直到完成
技術分享圖片
12.4 完成安裝:
登錄最新版Zabbix3.4 默認用戶Admin 默認密碼zabbix

技術分享圖片
技術分享圖片
技術分享圖片
13 Zabbxi-agent安裝及配置
13.1 Zabbix服務器安裝agent
yum install zabbix-agent -y
13.2 配置zabbxi-agent
grep -n ‘^‘[a-Z] /etc/zabbix/zabbix_agentd.conf

技術分享圖片
13.3 啟動zabbxi-agent並設置開機啟動 systemctl enable zabbix-agent.service systemctl restart zabbix-agent.service
13.4 Windows安裝zabbix客戶端
官方下載地址: http://www.zabbix.com/download
解壓以下文件到服務器磁盤目錄:
技術分享圖片
13.5 修改.conf文件
EnableRemoteCommands=1 #允許在本地執行遠程命令
LogRemoteCommands=1 #執行遠程命令是否保存操作日誌
Server = 172.19.34.144 #填寫zabbix服務器IP地址
Hostname=mail01 #zabbix_agent客戶端計算機名 (被監控主機)
UnsafeUserParameters=1 #監控腳本輸出

UserParameter=tcpportlisten,c:\zabbix\discovertcpport.bat #腳本文件

13.6 執行CMD命令安裝
zabbix_agent.exe -c zabbix_agent.conf -i
zabbix_agent.exe -c zabbix_agent.conf -s
-i 安裝 -s 啟動 -x 停止 -d 卸載

13.7 監控windows主機
選擇配置 ---- 主機 ---- 創建主機
技術分享圖片

填寫主機名稱及群組 可以創建不同的群組區分服務器
技術分享圖片
添加模板
技術分享圖片
查看主機監控
技術分享圖片
技術分享圖片

14 問題
14.1 啟動以後無法監控zabbix主機解決辦法

vi /etc/zabbix/zabbix_server.conf //這是我的安裝目錄

DBUser=root修改為root用戶即可搞定問題
# service zabbix_server  restart       //重啟服務
# netstat -untlap | grep zabbix    //在查看端口就有了

14.2 zabbix中文亂碼解決方法
上傳自定義字體到:/usr/share/Zabbix/fonts/ 目錄下
修改:/usr/share/Zabbix/include/defines.inc.php 將默認字體替換
15 Zabbix插件Graphtree安裝
cd /usr/share/zabbix
wget https://raw.githubusercontent.com/OneOaaS/graphtrees/master/graphtree3.2.x.patch
yum install -y patch
patch -Np0 < graphtree3.2.x.patch
vi /etc/httpd/conf.d/zabbix.conf Alias /oneoaas /usr/share/zabbix/oneoaas
chown -R apache.apache oneoaas

Zabbix3.4安裝部署 操作過程手冊