Zabbix 4.0.4 install for Centos 7
阿新 • • 發佈:2019-02-14
tps alt rhel lease 更新 trapper eee nal x server
347:SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
465:Timeout=4
507:AlertScriptsPath=/usr/lib/zabbix/alertscripts
517:ExternalScripts=/usr/lib/zabbix/externalscripts
553:LogSlowQueries=3000
警告:磁盤分區時使用 LVM卷等 不負責任何責任,本人使用的是基本磁盤卷 /+swap
1. 部署LAMP環境
a. 由於zabbix提供集中的web監控管理界面,因此服務在web界面的呈現需要LAMP架構支持。
yum install -y httpd mariadb-server mariadb php php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mhas lrzsz nano
b. 編輯配置httpd
nano /etc/httpd/conf/httpd.conf
添加:ServerName www.xxx.com ///你隨意,雖然我也不知道有啥用,看著高大上點
添加: DirectoryIndex index.html index.php ####//添加首頁支持格式,後期使用php,加上紅字部分就可以了
c. 編輯配置php,配置中國時區
nano /etc/php.ini
修改:date.timezone = PRC
d. 啟動httpd,mysql
systemctl stop firewalld.service ///關閉防火墻
setenforce 0 ///可讀寫安全設置
systemctl start httpd.service ///httpd服務啟動
systemctl start mariadb.service ///mariadb服務啟動,這玩意和mysql用起來一毛一樣
netstat -ntap | egrep ‘(80|3306)‘ ///查看服務端口
###############################################
systemctl disable firewalld
systemctl enable httpd
systemctl enable mariadb
e. 啟動mariadb後執行出事安全設置
mysql_secure_installation ///除了第一個設置root密碼,其他全點n。
mysql -u root -p ///登錄數據庫
CREATE DATABASE zabbix character set utf8 collate utf8_bin; //創建中文(utf8)數據庫zabbix
GRANT all ON zabbix.* TO ‘zabbix‘@‘%‘ IDENTIFIED BY ‘admin123‘; //在zabbix數據庫,創建用戶zabbix,密碼password,密碼字母數字就行加服務可能會報錯
flush privileges; ///刷新權限
f. 檢測php與 數據庫連通情況
nano /var/www/html/index.php
添加:
<?php
$link=mysql_connect(‘192.168.30.172‘,‘zabbix‘,‘password‘);
if($link) echo "<h1>Success!!</h1>";
else echo "Fail!!";
mysql_close();
?>
註釋:192.168.100.112=你主機的IP地址 zabbix=數據庫用戶 password=數據庫密碼
打開192.168.100.112 提示Success 正常 ,fail 配置錯誤
select user,host from mysql.user; 2. 部署zabbix server a. zabbix server環境安裝 yum install php-bcmath php-mbstring -y ///安裝php支持zabbix組件 rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm ///4.0yum源文件,采用yum安裝,編譯安裝太麻煩 yum install zabbix-server-mysql zabbix-web-mysql -y ///安裝zabbix組件,網絡環境不好的話,很容易超時 zcat /usr/share/doc/zabbix-server-mysql-4.0.4/create.sql.gz | mysql -uzabbix -p zabbix ///版本號,yum源更新版本號會邊註意更改;數據庫用戶;數據庫名;密碼後來輸入 b. 查看、修改zabbix配置文件 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=zabbix //zabbix訪問數據庫用戶
125:DBPassword=password //配置文件中只需修改本行,zabbix訪問數據庫密碼
465:Timeout=4
507:AlertScriptsPath=/usr/lib/zabbix/alertscripts
517:ExternalScripts=/usr/lib/zabbix/externalscripts
553:LogSlowQueries=3000
c. 修改zabbix在httpd中的時區
nano /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai
d. 為防止web界面中文亂碼現象,需要將相應字體文件復制,使zabbix識別(記得自己上傳字體)
cp kaiti.TTF /usr/share/zabbix/fonts/ //// kaiti.TTF 華文楷體,你喜歡別的隨你
e. 使zabbix系統識別字體
vim /usr/share/zabbix/include/defines.inc.php //vi或者vim才可以 執行下一行的命令
:%s /graphfont/kaiti/g //采用全局替換模式
f. zabbix基本配置完成,啟動服務,實現web界面安裝
systemctl enable zabbix-server ///自啟動zabbix-server
systemctl start zabbix-server ///啟動zabbix-server
netstat -anpt | grep zabbix ///監聽在10051端口上
systemctl restart httpd.service ///啟動httpd服務
3. WEB界面配置
Zabbix 4.0.4 install for Centos 7