CentOS 6.5下快速部署Zabbix 2.4
1. 環境準備
CentOS6.4
關閉selinux和iptables
兩臺虛擬機器:一臺Server,一臺Agent
2. 安裝官方yum源
所有伺服器都要安裝此yum源
rpm -ivh http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm (32位為i386)
3. 部署Zabbix Server
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent mysql-server mysql -y
/etc/init.d/mysqld start
mysql -e "create database zabbix character set utf8 collate utf8_bin;"
cd /usr/share/doc/zabbix-server-mysql-2.4.*/create/
mysql -uroot zabbix < schema.sql
mysql -uroot zabbix < p_w_picpaths.sql
mysql -uroot zabbix < data.sql
sed -i 's/^.*DBPassword=.*$/DBPassword=zabbix/' /etc/zabbix/zabbix_server.conf
service zabbix-agent start
sed -i 's/^.*date.timezone =.*$/date.timezone = Asia\/Shanghai/g' /etc/php.ini
sed -i 's/^.*post_max_size =.*$/post_max_size = 16M/g' /etc/php.ini
sed -i 's/^.*max_execution_time =.*$/max_execution_time = 300/g' /etc/php.ini
sed -i 's/^.*max_input_time =.*$/max_input_time = 300/g' /etc/php.ini
chkconfig mysqld on
chkconfig zabbix-server on
chkconfig zabbix-agent on
chkconfig httpd on
開啟瀏覽器訪問http://server_ip/zabbix/
直接點選Next...
繼續點選Next...
點選'Test connection' 後,繼續Next
繼續Next...
繼續Next...
點選'Finish' 完成頁面的配置.
通過預設的賬號和密碼進行登入
Admin/zabbix 注意Admin第一個字母大寫
將頁面改為中文的方法:
sed -i '/zh_CN/ s/false/true/' /usr/share/zabbix/include/locales.inc.php
/etc/init.d/httpd restart
現在可以看到已經可以選擇中文了,上圖是已經生效之後的。
啟用Zabbix Server自身監控:
按照上圖的繼續點選,將預設的Zabbix Server自身的監控啟用.
圖片不能顯示中文:
語言切換到中文後,選擇任意的圖形,不能顯示中文..
cd /usr/share/zabbix/fonts
mv graphfont.ttf graphfont.ttf.bak
wget http://down1.chinaunix.net/distfiles/ttf-arphic-uming_0.0.20050501-1.tar.gz
tar xf /root/ttf-arphic-uming_0.0.20050501-1.tar.gz
cp /root/ttf-arphic-uming_0.0.20050501/uming.ttf graphfont.ttf
#不替換 graphfont.ttf的方法
#下載會字型檔案 .ttf
#vi /usr/share/zabbix/include/defines.inc.php
#('ZBX_GRAPH_FONT_NAME', 'graphfont'); #將graphfont替換為下載的檔名即可
#('ZBX_FONT_NAME', 'graphfont'); #將graphfont替換為下載的檔名即可
關注日誌
tail -f /var/log/zabbix/zabbix_server.log
1943:20141126:142146.893 server #23 started [history syncer #4]
1942:20141126:142146.893 server #22 started [history syncer #3]
1947:20141126:142146.900 server #25 started [proxy poller #1]
1946:20141126:142146.900 server #24 started [escalator #1]
1950:20141126:142146.906 server #26 started [self-monitoring #1]
1935:20141126:142147.096 server #19 started [discoverer #1]
1922:20141126:144903.783 cannot send list of active checks to [127.0.0.1]: host [Zabbix server] not monitored
其中有一個'cannot send list of active checks to ' 這種型別不算錯誤,後續更新Zabbix Agent(active)會描述這個情況.
4. 部署Zabbix Agent
yum install zabbix-agent zabbix-sender zabbix-get -y
[[email protected] ~]# grep -vE '(^$|^\#)' /etc/zabbix/zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=172.16.43.40 #修改為Server的IP,支援多個IP,逗號分隔,使用域名的話,需要支援反向解析
ServerActive=172.16.43.40 #修改為Server的IP,不支援寫多個IP
HostnameItem=system.hostname #預設是用Hostname需要手動指定主機名,改為HostnameItem 使用內部key的自動獲取方式
Include=/etc/zabbix/zabbix_agentd.d/
/etc/init.d/zabbix-agent start
chkconfig zabbix-agent on
關注日誌
tail -n50 -f /var/log/zabbix/zabbix_agentd.log
1526:20141126:150356.024 Starting Zabbix Agent [localhost.localdomain]. Zabbix 2.4.2 (revision 50419).
1526:20141126:150356.024 using configuration file: /etc/zabbix/zabbix_agentd.conf
1526:20141126:150356.025 agent #0 started [main process]
1530:20141126:150356.026 agent #4 started [listener #3]
1529:20141126:150356.026 agent #3 started [listener #2]
1531:20141126:150356.026 agent #5 started [active checks #1]
1528:20141126:150356.027 agent #2 started [listener #1]
1527:20141126:150356.027 agent #1 started [collector]
1531:20141126:150356.062 no active checks on server [172.16.43.40:10051]: host [localhost.localdomain] not found
同樣,'no active checks on server' 也不是一個錯誤,後續更新的blog會進行描述.
5. 在Server新增一個主機使用Agent方式進行監控
原文地址:http://www.linuxidc.com/Linux/2014-11/109909p5.htm
轉載於:https://blog.51cto.com/linux1990/1706010