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.1
view 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 --version
NET-SNMP version:5.7.2
Web: 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 zabbix
ii zabbix-agent 1:2.2.2+dfsg-1ubuntu1 i386 network monitoring solution - agent
ii zabbix-frontend-php 1:2.2.2+dfsg-1ubuntu1 all network monitoring solution - PHP front-end
ii 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.sql
root@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.Debian
START=no
# Absolute path to the configuration file
CONFIG_FILE="/etc/zabbix/zabbix_server.conf"
被设成no了, 当然启动不了, 改成yes, 重启即可:
root@kallen:/etc/default# service zabbix-server start
zabbix-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 file
global $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;
?>
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。