标签:zabbix libmysql snmp ubuntu config
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:161
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
snmpd 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.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是否监测各类指标的方法,运行如下命令:
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 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;
?>
[附-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体验也比较好。
版权声明:本文为博主原创文章,未经博主允许不得转载|Copyright ©2011-2015, Kallen Ding, All Rights Reserved.
标签:zabbix libmysql snmp ubuntu config
原文地址:http://blog.csdn.net/beautifulencounter/article/details/46459173