zabbix 2.0.5 setup

 

首先安装好LAMP环境,参考此文章http://411742.blog.51cto.com/401742/1174323
我是Oracele Linux 5.9 X86_64,LAMP安装好后,安装php下enable bcmath和gettext
1,bcmath 安装方法
bcmath 这个扩展在php源安装包压缩包中都是有的,需要重新编译一下才能够支持;
cd   php-5.2.7/ext/bcmath (源包)
/usr/local/php/bin/phpize(编译后的)
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install (make 可以得到so路径/usr/local/php/lib/php/extensions/no-debug-zts-20100525/)
把so路径下文件拷贝到  extension路径下/usr/local/php/lib/php/extensions
vim php.ini  (/usr/loacal/php/etc/php.ini)
extension=bcmath.so(echo "extension=bcmath.so" >> /usr/local/php/etc/php.ini)
重启apache
2.gettext安装方法
此次安装是动态安装 php gettext 扩展模块 php 的源文件中,进入 ext/gettext
cd ext/gettext
/usr/local/php/bin/phpize
./configur –with-php-config=/usr/local/php/bin/php-config
make && make install
(make 可以得到so路径/usr/local/php/lib/php/extensions/no-debug-zts-20100525/)
把so路径下文件拷贝到  extension路径下/usr/local/php/lib/php/extensions
vim php.ini  (/usr/loacal/php/etc/php.ini)
extension=gettxt.so(echo "extension=gettext.so" >> /usr/local/php/etc/php.ini)

 apachectl stop
 apachectl start
重启apache
安装zabbix的一些组件
1 ) 编译安装一组小软件
*安装iksemel ##:library and header files. Required to enable Jabber messaging.
shell>cd /usr/local/src
shell>gunzip iksemel-1.4.tar.gz && tar –xvf iksemel-1.4.tar
shell>cd iksemel-1.4
shell>./configure
shell>make && make install
shell>updatedb
11
shell>locate libiksemel.so.3
/usr/local/iksemel/lib/libiksemel.so.3
shell>ln –s /usr/local/iksemel/lib/libiksemel.so.3 /lib/ ##:创建一个软链接到/lib/目录下
*安装OpenIPMI ##:Required for IPMI support
shell>cd /usr/local/src
shell>gunzip OpenIPMI-2.0.19.tar.gz && tar –xvf OpenIPMI-2.0.19.tar
shell>cd OpenIPMI-2.0.19
shell>./configure
shell>make && make install
*安装net-snmp ##:library and header files. Required for SNMP support.
shell>cd /usr/local/src
shell>gunzip net-snmp-5.3.4.tar.gz && tar –xvf net-snmp-5.3.4.tar
shell>cd net-snmp-5.3.4
shell>.configure
shell>make && make install
shell>yum install net-snmp-devel  # 安装snmp的依赖包
*安装libcurl ##:library and header files. Required for WEB monitoring module.
shell>cd /usr/local/src
shell>gunzip curl-7.24.0.tar.gz && tar –xvf curl-7.24.0.tar
shell>cd curl-7.24.0
shell>./configure
shell>make && make install
*安装fping ##:Required for ICMP ping items
shell>cd /usr/local/src
shell>gunzip fping-3.0.tar.gz && tar –xvf fping-3.0.tar
shell>cd fping-3.0
shell>./configure
shell>make && make install
2) 安装ZABBIX
*For Mysql
shell>/usr/local/mysql/bin/mysql –u root -p   #如果没有定义环境变量要打全路径
mysql>create database zabbix character set utf8;  # 创建数据库表
mysql>grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'mycreativepassword'; ##:替换mycreativepassword为想要设置的密码,保留引号
mysql>quit;
shell>cd /usr/local/src/zabbix-2.0.5/database/mysql #导入sql数据
shell>cat schema.sql| /usr/local/mysql/bin/mysql –uzabbix –pzabbix zabbix
shell>cat images.sql| /usr/local/mysql/bin/mysql –uzabbix –pzabbix zabbix
shell>cat data.sql | /usr/local/mysql/bin/mysql –uzabbix –pzabbix zabbix
*ZABBIX 安装
shell>cd /usr/local/src/zabbix-2.0.5/
shell>./configure --enable-server --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp=/usr/local/net-snmp/bin/net-snmp-config --with-jabber=/usr/local/iksemel --with-libcurl=/usr/local/curl/bin/curl-config --with-openipmi=/usr/local/openipmi --prefix=/usr/local/zabbix
shell>make && make install
# vim /usr/local/zabbix/etc/zabbix_server.conf   # 修改DB 连接数据库账户及密码
    DBName=zabbix
    DBUser=zabbix
DBPassword=zabbix 
 
# /usr/local/zabbix/sbin/zabbix_server          # 启动服务端,某些版本或者系统要求以zabbix 用户启动,下同。
# /usr/local/zabbix/sbin/zabbix_agentd
注意,如果在启动过程中,提示因为缺少某个库文件而导致启动失败,可先用 updatedb 命令更新数据库,然后用 locate xxxx 查看该库文件,找到之后用 ln –s 命令做一个软链接,将该库文件链接到 /lib/ 目录下即可。
启动时出现了下面的错误
这是因为我的 mysql client 库不在系统默认库中,做以下修改后重新启动就可以了:
# echo /usr/local/mysql/lib >> /etc/ld.so.conf
# ldconfig -v | grep mysql
 
可以看到 mysql 库已经载入成功,此时再启动 zabbix 服务就没有问题了
shell>netstat –ntlp
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 5130/zabbix_agentd
tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 5138/zabbix_server
添加服务自启动
# echo "/usr/local/zabbix/sbin/zabbix_server" >> /etc/rc.d/rc.local   # 添加服务自启动
# echo "/usr/local/zabbix/sbin/zabbix_agentd" >> /etc/rc.d/rc.local
 
#cat >>/etc/services <<EOF                        # 开放agent trapper 端口
>zabbix-agent 10050/tcp      #Zabbix Agent   
>zabbix-agent 10050/udp     #Zabbix Agent
>zabbix-trapper 10051/tcp     #Zabbix Trapper
>zabbix-trapper 10051/udo    #Zabbix Trapper
>EOF
 
                                                     
# 拷贝网页前端文件到apache 目录
*WEB 监控相关设置
shell>cd /usr/local/apache234/htdocs
shell>makedir zabbix && chown zabbix.zabbix zabbix
shell>cd /usr/local/src/zabbix-2.0.5/frontends/php
shell>cp –a . /usr/local/apache234/htdocs/zabbix
 
# vi /usr/local/php/etc/php.ini    # 修改php 参数
date.timezone = "Asia/ShanghAI"
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
memory_limit = 128M 
# /usr/local/apache234/bin/apachectl  restart
http://IP/zabbix /index.php 进行配置。
 

你可能感兴趣的:(zabbix)