歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux管理 >> Linux配置 >> zabbix安裝配置

zabbix安裝配置

日期:2017/2/27 14:58:02   编辑:Linux配置
1、安裝
yum install make mysql-server httpd php mysql-devel gcc net-snmp-devel curl-devel perl-DBI php-gd php-mysql php-bcmath php-mbstring php-xml -y
useradd zabbix

2、啟動mysql
service mysqld start
mysqladmin –uroot password root
mysql –uroot –proot

3、創建zabbix數據庫
Mysql> create database zabbix character set utf8;
Mysql> grant all on zabbix.* TO zabbix@'localhost' identified by 'zabbixpass';
Mysql> flush privileges;

4、導入數據庫sql
zabbix-2.0.3/database/mysql
mysql -h localhost -uroot -proot zabbix <schema.sql
mysql -h localhost -uroot -proot zabbix <images.sql
mysql -h localhost -uroot -proot zabbix <data.sql

5、調整當前時間
date -s "2012-10-25 13:48:55"

6、編譯安裝
./configure --with-mysql --with-net-snmp --with-libcurl --enable-server --enable-agent --enable-proxy --prefix=/usr/local/zabbix
make && make install

7、添加端口
vi /etc/services
zabbix-agent 10050/tcp # Zabbix Agent
zabbix-agent 10050/udp # Zabbix Agent
zabbix-trapper 10051/tcp # Zabbix Trapper
zabbix-trapper 10051/udp # Zabbix Trapper

8、修改配置文件
cp -a frontends/php/* /var/www/html/
修改/etc/httpd/conf/httpd.conf
DirectoryIndex index.html index.html.var index.php

修改/usr/local/zabbix/etc/zabbix_server.conf參數:
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix

cp misc/init.d/fedora/core5/zabbix_server /etc/init.d/
cp misc/init.d/fedora/core5/zabbix_agentd /etc/init.d/
chmod 700 /etc/init.d/zabbix_*

vim /etc/init.d/zabbix_server
修改
ZABBIX_BIN="/usr/local/sbin/zabbix_server"

ZABBIX_BIN="/usr/local/zabbix/sbin/zabbix_server"
vim /etc/init.d/zabbix_agentd
修改
ZABBIX_BIN="/usr/local/sbin/zabbix_agentd"

ZABBIX_BIN="/usr/local/zabbix/sbin/zabbix_agentd"

9、啟動服務並設置開機啟動
/etc/init.d/zabbix_server start
/etc/init.d/zabbix_agentd start

chkconfig zabbix_server on
chkconfig zabbix_agentd on

10、修改php相關參數
# vi /etc/php.ini 找到如下幾項,改成下面的值,前面有;號的要刪掉
max_execution_time = 300
max_input_time = 300
date.timezone = PRC
post_max_size = 32M

重啟httpd
/etc/init.d/httpd restart

11、圖形安裝
Configuration file
"/var/www/html/zabbix/conf/zabbix.conf.php"
created: OK

用戶名 密碼 zabbix

登陸後 點擊右上角的 profile
設置 語言為中文

常見問題
1、zabbix裡圖形中的漢字顯示亂碼
這個是裝好就一直出現的,後來直接改了字體就解決了。
方法:
# 進入zabbix的front路徑在:/var/www/html/zabbix/
# 先備份原先的字體:
cd /var/www/html/zabbix//fonts/
cp -frp DejaVuSans.ttf DejaVuSans.ttf.old

# 將新的字體復制過去,
cp /tmp/simhei.ttf DejaVuSans.ttf

zabbix代理配置
useradd zabbix -s /sbin/nologin

從官方下載相應平台的代理包

直接解壓
cd /opt
mkdir zabbixagent
mv /opt/src/zabbix_agents_2.0.3.linux2_6.amd64.tar.gz /opt/zabbixagent
cd /optzabbixagent
tar xvf zabbix_agents_2.0.3.linux2_6.amd64.tar.gz

mkdir logs
mkdir etc
chown zabbix:zabbix /opt/zabbixagent
從zabbix server端復制 zabbix_agentd.conf 到etc目錄 然後修改

LogFile=/opt/zabbixagent/logs/zabbix_agentd.log
Server=172.16.8.82
#ServerActive=172.16.8.82
Hostname=web81

需要注意的是代理端的設定參數“Hostname=192.168.0.13”要和配置時填入的主機名稱一致,不然日志中將會報“host {主機名}not found”的錯誤

修改完後運行
/opt/zabbixagent/sbin/zabbix_agentd -c /opt/zabbixagent/etc/zabbix_agentd.conf &
Copyright © Linux教程網 All Rights Reserved