zabbix4.4安裝 centos7+mysql+Nginx


1、安裝數據源

# rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm
# yum clean all

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

# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-agent

如果有報錯,直接進行多次重試即可。

nginx包在官方存儲庫中不可用。可以在epel存儲庫中找到它

# yum install epel-release

3、創建初始數據庫

yum -y install mariadb-server 

 # mysql -uroot -p
password
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'password';
mysql> quit;

導入初始架構和數據,系統將提示您輸入新創建的密碼。

# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

 4、為Zabbix server配置數據庫

 編輯配置文件 /etc/zabbix/zabbix_server.conf

DBPassword=password

 5、為Zabbix前端配置PHP

編輯配置文件 /etc/nginx/conf.d/zabbix.conf, 去掉#號,server_name 一定要正確,否則可能打不開網站

 # listen 80;
# server_name example.com;

編輯配置文件 /etc/php-fpm.d/zabbix.conf, 改成Asia/Shanghai,去掉前面的分號,

; php_value[date.timezone] = Europe/Riga

6、啟動Zabbix server和agent進程

啟動Zabbix server和agent進程,並為它們設置開機自啟:

# systemctl restart zabbix-server zabbix-agent nginx php-fpm
# systemctl enable zabbix-server zabbix-agent nginx php-fpm

打開 http://server_ip_or_name就可以訪問安裝了,

 

測試客戶端是否連接成功

yum -y install zabbix-get.x86_64

zabbix_get -s 127.0.0.1 -p 10050 -k system.hostname

 

導入模板報錯413 Request Entity Too Large

修改nginx.conf

可以選擇在http{ }中設置:client_max_body_size 20m;
也可以選擇在server{ }中設置:client_max_body_size 20m;
還可以選擇在location{ }中設置:client_max_body_size 20m;
三者有區別
設置到http{}內,控制全局nginx所有請求報文大小
設置到server{}內,控制該server的所有請求報文大小
設置到location{}內,控制滿足該路由規則的請求報文大小

同時記得修改php.ini內的上傳限制
upload_max_filesize = 20M




 

如果提示

Zabbix discoverer processes more than 75% busy

修改zabbix_server.conf的配置CacheSize=2G

StartDiscoverers=30

 

 

創建發送告警的腳本要加上權限

chown zabbix.zabbix /usr/lib/zabbix/alertscripts/mailxsentmail.sh
chmod 700  /usr/lib/zabbix/alertscripts/mailxsentmail.sh
短信發送如果使用的是平台需要
yum -y install wget
 
 
報錯: [Z3001] connection to database 'zabbix' failed: [1040] Too many connections
因為數據庫鏈接數目導致無法開啟zabbix-server需要修改以下內容

修改/etc/my.cnf配置文件
在[mysqld]新添加一行:

[root@localhost zabbix]# vi /etc/my.cnf
max_connections=1000

 

配置/usr/lib/systemd/system/mariadb.service來調大打開文件數目。

[root@localhost zabbix]# vi /usr/lib/systemd/system/mariadb.service
在[Service]新加這兩行:
LimitNOFILE=10000
LimitNPROC=10000

重新加載系統服務,並重啟mariadb服務

[root@localhost zabbix]# systemctl --system daemon-reload
[root@localhost zabbix]# systemctl restart mariadb.service

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM