Ubuntu下Zabbix安裝及使用問題,ubuntuzabbix
1.configure: error: MySQL library not found MySQL library not found
root@kallen:~# apt-get install libmysqlclient-dev
2.configure error: Invalid Net-SNMP directory - unable to find net-snmp-config
root@kallen:~# apt-get install snmp snmpd
[附-1]SNMP安裝及配置
(1)SNMP安裝
運行如下兩個命令:
root@kallen:~# apt-get install snmp snmpd
順利運行完畢,使用如下命令測試一下:
root@kallen:~# lsof -i:161COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAMEsnmpd 1141 snmp 9u IPv4 12780 0t0 UDP *:snmp snmpd 1141 snmp 12u IPv6 12781 0t0 UDP ip6-localhost:snmp
如果輸出了正在運行snmp協議,便說明安裝OK。
(2)SNMP配置
SNMP設定檔 /etc/snmp/snmpd.conf
我的目的是進行遠程SNMP串連,所以需要做如下的修改:
將下面這一行:agentAddress udp:127.0.0.1:161
注釋掉,即: #agentAddress udp:127.0.0.1:161
然後將原來的這一行:#agentAddress udp:161,udp6:[::1]:161
去掉注釋,即: agentAddress udp:161,udp6:[::1]:161
這樣便可以實現snmp的遠程監聽了。
但修改後cacti伺服器還是無法監測到CPU、記憶體、流量的資料,所以需要再做如下修改:
在snmpd.conf中找到下面
view systemonly included .1.3.6.1.2.1.1view systemonly included .1.3.6.1.2.1.25.1
加上 view systemonly included .1 80 允許監聽所有裝置了。
完成所有修改後,重啟snmp:service snmpd restart
驗證安裝是否成功,如下所示:>> snmpget --version
root@kallen:/usr/share/snmp#snmpd --versionNET-SNMP version:5.7.2Web: http://www.net-snmp.org/Email: net-snmp-coders@lists.sourceforge.net
本地測試SNMP是否監測各類指標的方法,運行如下命令:
root@kallen:~# snmpwalk -v 2c -c public localhost
如果輸出結果有好多頁好多頁,應該是設定成功了!
3.The frontend does not match Zabbix database
[問題原因] Zabbix的資料庫版本不對(因為匯入的是Zabbix-2.4中的sql)
[解決辦法] 先查看當前Zabbix的版本號碼:
root@kallen:~# dpkg -l | grep zabbixii zabbix-agent 1:2.2.2+dfsg-1ubuntu1 i386 network monitoring solution - agentii zabbix-frontend-php 1:2.2.2+dfsg-1ubuntu1 all network monitoring solution - PHP front-endii zabbix-server-mysql 1:2.2.2+dfsg-1ubuntu1 i386 network monitoring solution - server (using MySQL)
確認後重新匯入一下Zabbix資料庫的sql
( 源碼包下的路徑:zabbix –> database –> mysql –> *.sql )
mysql|-- data.sql|-- images.sql`-- schema.sql
root@kallen:~# mysql -uzabbix -pzabbix zabbix < schema.sqlroot@kallen:~# mysql -uzabbix -pzabbix zabbix < images.sql root@kallen:~# mysql -uzabbix -pzabbix zabbix < data.sql
4.zabbix-server stop/waiting
root@kallen:/etc/default# vim zabbix-server# defaults file for zabbix-server-mysql# Start the Zabbix server from the init.d script?# (Possible values:"yes"or"no")# This is by default set to"no" because a MySQL database needs to be prepared# and configured before you can start the Zabbix server for the first time.# Instructions on how to set up the database can be found in# /usr/share/doc/zabbix-server-mysql/README.DebianSTART=no# Absolute path to the configuration fileCONFIG_FILE="/etc/zabbix/zabbix_server.conf"
被設成no了, 當然啟動不了, 改成yes, 重啟即可:
root@kallen:/etc/default# service zabbix-server startzabbix-server start/spawned, process 17802
5.Unable to create the configuration file.
Unable to create the configuration file. Please install it manually,
or fix permissions on the conf directory.
手動複製zabbix.conf.php到/var/www/html/zabbix/conf即可,zabbix.conf.php檔案格式如下:
<?php// Zabbix GUI configuration fileglobal $DB;$DB['TYPE'] = 'MYSQL';$DB['SERVER'] = 'localhost';$DB['PORT'] = '3306';$DB['DATABASE'] = 'zabbix';$DB['USER'] = 'zabbix';$DB['PASSWORD'] = 'zabbix';// SCHEMA is relevant only for IBM_DB2 database$DB['SCHEMA'] = '';$ZBX_SERVER = '172.16.1.231';$ZBX_SERVER_PORT = '10051';$ZBX_SERVER_NAME = 'localhost';$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;?>
[附-2]Zabbix監控樣圖
(1) Server Perfermance
(2) CPU Load
(3) Disk Space Usage
(4) Internal Process Busy
(5) Value Cache Effectiveness
(6) Network Traffic
(7) CPU Utilization
(8) CPU Jumps
(9) Apache Access
(10) Apache Processes
(11) Apache Volume
【總結】
結合上述圖形及自己對Zabbix使用過程中的體驗,個人感覺Zabbix的繪圖(其實應該是PHP的繪圖模組PHP gdd)能力以及效果表現不錯,優於Cacti & Nagios (其繪圖模組為RRD Tools);另外,Zabbix的DashBoard體驗也比較好。
熱門推薦
LNMP環境搭建——Nginx篇
在RHEL6.5中配置本地YUM源
Ubuntu下Zabbix安裝及使用問題
MySQL雙主熱備問題處理
Rsync同步錯誤處理
- Fix Elementary Boot Screen (plymouth)
After Installing Nvidia Drivers
著作權聲明:本文為博主原創文章,未經博主允許不得轉載|Copyright ©2011-2015, Kallen Ding, All Rights Reserved.