码迷,mamicode.com
首页 > 系统相关 > 详细

Ubuntu下Zabbix安装及使用问题

时间:2015-08-21 15:49:20      阅读:235      评论:0      收藏:0      [点我收藏+]

标签: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.

Ubuntu下Zabbix安装及使用问题

标签:zabbix   libmysql   snmp   ubuntu   config   

原文地址:http://blog.csdn.net/beautifulencounter/article/details/46459173

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!