码迷,mamicode.com
首页 > 其他好文 > 详细

安装zabbix2.2.3

时间:2014-06-27 00:39:01      阅读:1087      评论:0      收藏:0      [点我收藏+]

标签:style   class   blog   code   java   http   

系统版本:CentOS 6.3_x86_64

zabbix版本:zabbix-2.2.3

zabbix服务端IP:172.16.10.72

 

1.yum安装LAMP环境

# yum -y install gcc gcc-c++ autoconf httpd php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-gd php-xml php-mbstringphp-ldap php-pear php-xmlrpc php-bcmath mysql-connector-odbc mysql-devel libdbi-dbd-mysql net-snmp-devel curl-devel unixODBC-devel OpenIPMI-devel ja va-devel

2.配置LAMP使用环境

编辑/etc/php.ini文件,修改以下内容

date.timezone = Asia/Shanghai
max_execution_time = 300
post_max_size = 32M
max_input_time = 300
memory_limit = 128M
mbstring.func_overload = 2

启动httpd、mysqld服务

# chkconfig mysqld on
# chkconfig httpd on 
# service mysqld start
# service httpd start

3.下载并安装zabbix服务端

下载页面:http://www.zabbix.com/download.php

# wget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.2.3/zabbix-2.2.3.tar.gz

创建zabbix用户

# groupadd zabbix
# useradd zabbix -g zabbix

安装zabbix

# tar xf zabbix-2.2.3.tar.gz
# cd zabbix-2.2.3
# ./configure --prefix=/usr --sysconfdir=/etc/zabbix --enable-server --enable-proxy --enable-agent --enable-ipv6 --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl --with-openipmi --with-unixodbc --with-ldap --with-ssh2 --enable-java

报错如下:
checking for SSH2 support... no
configure: error: SSH2 library not found

解决办法:
yum -y install libssh2-devel

上面一个报错解决了,继续./configure,又出现如下错误:
checking for LDAP support... no
configure: error: Invalid LDAP directory - unable to find ldap.h

解决办法:
yum -y install openldap openldap-devel

# make
# make install

4.添加zabbix 到系统服务文件

# vi /etc/services(在rhel/centos系列中,下面的服务参数可以不用添加,默认已经有了)
zabbix-agent    10050/tcp               # Zabbix Agent
zabbix-agent    10050/udp               # Zabbix Agent
zabbix-trapper  10051/tcp               # Zabbix Trapper
zabbix-trapper  10051/udp               # Zabbix Trapper

5.导入zabbix数据库

[root@zabbix zabbix-2.2.3]# mysqladmin -uroot password abc123, 
[root@zabbix zabbix-2.2.3]# mysqladmin -uroot password abc123,   
[root@zabbix zabbix-2.2.3]# mysql -uroot -p
mysql> create database zabbix character set utf8;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by zabbix;
mysql> flush privileges;

测试下连接是否正常

[root@zabbix zabbix-2.2.3]# mysql -uzabbix -pzabbix zabbix
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type help; or \h for help. Type \c to clear the current input statement.

mysql> 

导入数据库文件

[root@zabbix zabbix-2.2.3]# mysql -uzabbix -pzabbix zabbix < ./database/mysql/schema.sql
[root@zabbix zabbix-2.2.3]# mysql -uzabbix -pzabbix zabbix < ./database/mysql/images.sql
[root@zabbix zabbix-2.2.3]# mysql -uzabbix -pzabbix zabbix < ./database/mysql/data.sql

6.创建zabbix日志目录

# mkdir /var/log/zabbix
# chown zabbix.zabbix /var/log/zabbix

7.设置zabbix启动脚本

[root@zabbix zabbix-2.2.3]# cp misc/init.d/fedora/core/zabbix_* /etc/init.d/
[root@zabbix zabbix-2.2.3]# chmod 755 /etc/init.d/zabbix_*
[root@zabbix zabbix-2.2.3]# sed -i "s#BASEDIR=/usr/local#BASEDIR=/usr/#" /etc/init.d/zabbix_server
[root@zabbix zabbix-2.2.3]# sed -i "s#BASEDIR=/usr/local#BASEDIR=/usr/#" /etc/init.d/zabbix_agentd

8.编辑/etc/zabbix/zabbix_server.conf文件,修改以下参数

LogFile=/var/log/zabbix/zabbix_server.log
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
DBSocket=/var/lib/mysql/mysql.sock
DBPort=3306
StartPollers=160 (测试环境默认值即可)
StartTrappers=20 (测试环境默认值即可)
StartPingers=100 (测试环境默认值即可)
StartDiscoverers=120 (测试环境默认值即可)
MaxHousekeeperDelete=5000 (测试环境默认值即可)
CacheSize=1024M (测试环境默认值即可)
StartDBSyncers=16 (测试环境默认值即可)
HistoryCacheSize=1024M (测试环境默认值即可)
TrendCacheSize=1024M (测试环境默认值即可)
HistoryTextCacheSize=512M (测试环境默认值即可)
AlertScriptsPath=/etc/zabbix/alertscripts
LogSlowQueries=1000

修改完成后可通过以下命令进行查看:
grep -Ev "(#|^$)" /etc/zabbix/zabbix_server.conf

9.编辑/etc/zabbix/zabbix_agentd.conf文件,修改以下参数

LogFile=/var/log/zabbix/zabbix_agentd.log
EnableRemoteCommands=0
Server=127.0.0.1,172.16.10.72  #zabbix服务端IP
StartAgents=8
ServerActive=172.16.10.72:10051
Hostname=Zabbix server
Timeout=30
Include=/etc/zabbix/zabbix_agentd.conf.d/
UnsafeUserParameters=1

修改完成后可通过以下命令进行查看:
grep -Ev "(#|^$)" /etc/zabbix/zabbix_agentd.conf

10.拷贝zabbix网页文件到apache目录

[root@zabbix zabbix-2.2.3]# cp -r ./frontends/php/ /var/www/html/zabbix
[root@zabbix zabbix-2.2.3]# chown -R apache.apache /var/www/html/zabbix

11.开启zabbix服务

root@zabbix zabbix-2.2.3]# chkconfig zabbix_server on
[root@zabbix zabbix-2.2.3]# chkconfig zabbix_agentd on
[root@zabbix zabbix-2.2.3]# service zabbix_server start
Starting zabbix_server:                                    [  OK  ]
[root@zabbix zabbix-2.2.3]# service zabbix_agentd start
Starting zabbix_agentd:                                    [  OK  ]

#查看zabbix服务是否启动
[root@zabbix zabbix-2.2.3]# netstat -antpl|grep zabbix
tcp        0      0 0.0.0.0:10050               0.0.0.0:*                   LISTEN      22542/zabbix_agentd 
tcp        0      0 0.0.0.0:10051               0.0.0.0:*                   LISTEN      22473/zabbix_server 
tcp        0      0 :::10050                    :::*                        LISTEN      22542/zabbix_agentd 
tcp        0      0 :::10051                    :::*                        LISTEN      22473/zabbix_server

12.通过web页面配置zabbix

# service iptables stop #暂时关闭防火墙

打开浏览器,访问:http://172.16.10.72/zabbix,不出意外,会看到如下页面

bubuko.com,布布扣

点击next,进入下一步

bubuko.com,布布扣

bubuko.com,布布扣

bubuko.com,布布扣

bubuko.com,布布扣

bubuko.com,布布扣

到此web页面配置完毕,已经到了登陆界面,zabbix的默认登陆账号是admin,密码是zabbix

bubuko.com,布布扣

登录后发现一个报错:zabbbix server is not  running:the information displayed may not be current

bubuko.com,布布扣

经过排查,发现是selinux惹的祸

解决办法:关闭selinux

setenforce 0

再刷新页面看看,已经正常

bubuko.com,布布扣

zabbix 2.2.3安装到此结束。

安装zabbix2.2.3,布布扣,bubuko.com

安装zabbix2.2.3

标签:style   class   blog   code   java   http   

原文地址:http://www.cnblogs.com/Eivll0m/p/3807604.html

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