当前位置: IT大杂烩 > Ubuntu  > Ubuntu下Zabbix安装及使用问题

Ubuntu下Zabbix安装及使用问题

www.someabcd.com  网友分享于:Jun 8, 2018 5:52:33 PM

标签:zabbix   libmysql   snmp   ubuntu   config   

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;
?>

Ubuntu下Zabbix安装及使用问题

标签:zabbix   libmysql   snmp   ubuntu   config   

发布此文章仅为传递网友分享,不代表本站观点,若侵权请联系我们删除,本站将不对此承担任何责任。
Copyright ©2018  IT大杂烩  版权所有  京ICP备11030978号-1 网站地图