aaahd 发表于 2018-1-1 17:32:40

Ubuntu下Zabbix安装及使用问题

  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
  
COMMANDPID USER   FD   TYPE DEVICE>  
snmpd   1141 snmp    9uIPv412780      0t0UDP *:snmp
  
snmpd   1141 snmp   12uIPv612781      0t0UDP 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   systemonlyincluded   .1.3.6.1.2.1.1  
view   systemonlyincluded   .1.3.6.1.2.1.25.1
  

  

  加上view   systemonlyincluded   .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  
iizabbix-agent            1:2.2.2+dfsg-1ubuntu1   i386 network    monitoring solution - agent
  
iizabbix-frontend-php   1:2.2.2+dfsg-1ubuntu1   all   network monitoring solution - PHP front-end
  
iizabbix-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>  
$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体验也比較好。

  热门推荐

[*]  LNMP环境搭建——Nginx篇
[*]  在RHEL6.5中配置本地YUM源
[*]  Ubuntu下Zabbix安装及使用问题
[*]  MySQL双主热备问题处理
[*]  Rsync同步错误处理
[*]Fix Elementary Boot Screen (plymouth)  After Installing Nvidia Drivers
页: [1]
查看完整版本: Ubuntu下Zabbix安装及使用问题