freebsd 手工安装zabbix2.0 php,zabbix 服务端,子客户端安装配置日志
針對已經有mysql nginx php 的linux環境 ,zabbix2.4.8對不同版本的mysql會報不同的錯,php也一樣。
這只是針對本人的環境下的安裝部署,mysql是5.6.4rmp安裝,php7+。
服務端#創建數據庫
create database zabbix character set utf8;
grant all privileges on zabbix.* to zabbix_user@'127.0.0.1' identified by '123456';
grant all privileges on zabbix.* to zabbix_user@'localhost' identified by '123456';
flush privileges;
#添加用戶
useradd -s /sbin/nologin -M zabbix
#本站blog已下載一個
wget --no-check-certificate https://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.4.8/zabbix-2.4.8.tar.gz
tar -zxvf zabbix-2.4.8.tar.gz
cd zabbix-2.4.8
cd database
cd mysql
mysql -h 127.0.0.1 -uzabbix_user -p zabbix< schema.sql
mysql -h 127.0.0.1 -uzabbix_user -p zabbix < images.sql
mysql -h 127.0.0.1 -uzabbix_user -p zabbix < data.sql
cd ../../
yum -y install net-snmp
yum -y install net-snmp-devel
./configure --prefix=/usr/local/zabbix --with-mysql --with-net-snmp --with-libcurl --enable-server --enable-proxy
#報錯 僅僅以于已經重裝rpm安裝新版mysql 5.6.45的情況
#https://www.isres.com/database/274.html
[root@zabbix-2.4.8]# find / -name libmysqlclient.a
/usr/lib64/mysql/libmysqlclient.a
cp /usr/lib64/mysql/libmysqlclient.a /usr/local/lib
#再編譯后即可進行安裝
make && make install
#報錯 僅僅以于已經重裝rpm安裝新版mysql 5.6.45 mysql的情況
#undefined reference to `operator new[](unsigned long)'
rpm -ivh MySQL-shared-5.6.45-1.el6.x86_64.rpm
ln -s /usr/local/zabbix/sbin/* /usr/local/sbin/
ln -s /usr/local/zabbix/bin/* /usr/local/bin/
cp /usr/tmp/zabbix-2.4.8/misc/init.d/fedora/core/zabbix_server /etc/rc.d/init.d/zabbix_server
chmod +x /etc/rc.d/init.d/zabbix_server
chkconfig zabbix_server on
sed -i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g' /etc/rc.d/init.d/zabbix_server
echo "zabbix-trapper 10051/tcp # Zabbix Trapper" >> /etc/services
echo "zabbix-trapper 10051/udp # Zabbix Trapper" >> /etc/services
sed -i 's/DBUser=root/DBUser=zabbix_user/g' /usr/local/zabbix/etc/zabbix_server.conf
sed -i 's/DBUser=root/DBUser=zabbix_user/g' /usr/local/zabbix/etc/zabbix_server.conf
sed -i 's/# ListenPort=10051/ListenPort=10051/g' /usr/local/zabbix/etc/zabbix_server.conf
sed -i 's/# ListenIP=0.0.0.0/ListenIP=0.0.0.0/g' /usr/local/zabbix/etc/zabbix_server.conf
#修改php.ini 逐條運行
sed -i 's/post_max_size = 8M/post_max_size = 16M/g' /usr/local/php/etc/php.ini
sed -i 's/max_execution_time = 30/max_execution_time = 300/g' /usr/local/php/etc/php.ini
sed -i 's/max_input_time = 60/max_input_time = 300/g' /usr/local/php/etc/php.ini
sed -i 's/\;date.timezone =/date.timezone = "Asia\/Shanghai"/g' /usr/local/php/etc/php.ini
service php-fpm restart
#僅于對使用本站一件安裝lnp腳本的情況,web目錄在/home/public_html
mkdir -p /home/public_html/zabbix
chown www:www /home/public_html/zabbix
cp -r frontends/php/* /home/public_html/zabbix/
vim /home/public_html/zabbix/include/classes/setup/CFrontendSetup.php
添加 $current = -1;
public function checkPhpAlwaysPopulateRawPostData() {
$current = ini_get('always_populate_raw_post_data');
$current = -1;
return array(
'name' => _('PHP always_populate_raw_post_data'),
'current' => ($current != -1) ? _('on') : _('off'),
'required' => _('off'),
'result' => ($current != -1) ? self::CHECK_FATAL : self::CHECK_OK,
'error' => _('PHP always_populate_raw_post_data must be set to -1.')
);
}
service zabbix_server start
cd /usr/local/nginx/conf/vhost/
cp default.conf zabbix.conf
vim zabbix.conf
server {
listen 8384;
server_name localhost;
access_log /home/public_html/zabbix/access.log;
location / {
root /home/public_html/zabbix/;
index index.php index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/nginx/html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
root /home/public_html/zabbix/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
chown -R www:www /home/public_html/zabbix/
service nginx restart
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 8384 -j ACCEPT
/etc/rc.d/init.d/iptables save
service iptables restart
http://xxx.10.81.xxx:8384/ 訪問通過了
帳號admin 密碼zabbix
#登錄局部后報了A non well formed numeric value encountered [dashboard.php:140 → 原因php版本高對類型有要求
vim /home/public_html/zabbix/include/func.inc.php 換掉$val *= 1024;
function str2mem($val) {
$val = trim($val);
$last = strtolower(substr($val, -1));
switch ($last) {
case 'g':
#$val *= 1024;
$val = intval($val)*1024;
/* falls through */
case 'm':
#$val *= 1024;
$val = intval($val)*1024;
/* falls through */
case 'k':
#$val *= 1024;
$val = intval($val)*1024;
}
return $val;
}
替換監控圖像上系統默認的字體 #默認字體不支持中文,如果不替換,圖像上會顯示亂碼
在Windows系統中的C:WindowsFonts目錄中復制出一個中文字體文件,例如msyh.ttf
把字體文件msyh.ttf上傳到zabbix站點根目錄下fonts文件夾中
例如:/usr/local/nginx/html/zabbix/fonts
備份默認的字體文件:DejaVusSans.ttf-bak
修改msyh.ttf名稱為DejaVusSans.ttf
客戶端部署在另一臺,完成后需要做iptables對服務端的開放useradd -s /sbin/nologin -M zabbix
wget https://www.isres.com/file/zabbix-2.4.8.tar.gz
tar -zxvf zabbix-2.4.8.tar.gz
cd zabbix-2.4.8
./configure --prefix=/usr/local/zabbix --with-libcurl --enable-agent
make && make install
ln -s /usr/local/zabbix/sbin/* /usr/local/sbin/
ln -s /usr/local/zabbix/bin/* /usr/local/bin/
cp /usr/tmp/zabbix-2.4.8/misc/init.d/fedora/core/zabbix_agentd /etc/rc.d/init.d/zabbix_agentd
chmod +x /etc/rc.d/init.d/zabbix_agentd
chkconfig zabbix_agentd on
sed -i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g' /etc/rc.d/init.d/zabbix_agentd
echo "zabbix-agent 10050/tcp # Zabbix Agent" >> /etc/services
echo "zabbix-agent 10050/tcp # Zabbix Agent" >> /etc/services
sed -i 's/# PidFile=\/tmp\/zabbix_agentd.pid/PidFile=\/tmp\/zabbix_agentd.pid/g' /usr/local/zabbix/etc/zabbix_agentd.conf
sed -i 's/Server=127.0.0.1/Server=192.168.10.55/g' /usr/local/zabbix/etc/zabbix_agentd.conf
service zabbix_agentd restart
centos6
iptables -I INPUT -s 192.168.10.55 -m state --state NEW -m tcp -p tcp --dport 10050 -j ACCEPT
/etc/rc.d/init.d/iptables save
service iptables restart
centos7
firewall-cmd --permanent --add-rich-rule 'rule family=ipv4 source address=192.168.10.55/32 port port=10050 protocol=tcp accept'
systemctl restart firewalld.service
非特殊說明,本博所有文章均為博主原創。
最新文章
總結
以上是生活随笔為你收集整理的freebsd 手工安装zabbix2.0 php,zabbix 服务端,子客户端安装配置日志的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: bpsk信道编码matlab,信道编码-
- 下一篇: python 字节和字符串区别,Pyth