Ubuntu下Zabbix安裝及使用問題
1.configure: error: MySQL library not found MySQL library not found
apt-get install libmysqlclient-dev
2.configure: error: Invalid Net-SNMP directory - unable to find net-snmp-config
apt-get install snmp snmpd
[附]SNMP安裝及配置
(1)SNMP安裝
運行如下兩個命令:
apt-get install snmp snmpd
順利運行完畢,使用如下命令測試一下:
lsof -i:161
如果輸出了正在運行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是否監測各類指標的方法,運行如下命令:
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