Zabbix安装:
将zabbixServer+mysql端与PHP+APACHE分离
在usr路径下建立了software文件夹,放入net-snmp msyql zabbix 三个tar文件
1.安装NET-SNMP包:为zabbix提供snmp支持,建议直接安装,不要指定路径,好处在后面安装zabbix的会提到;
在linux端安装mysql-5.1.46-linux-i686-glibc23.tar.gz
下载:http://dev.mysql.com/downloads
mysql-5.1.46-linux-i686-glibc23.tar.gz
安装mysql
创建mysql用户及用户组
groupadd mysql
useradd -g mysql mysql
tar -zxvf mysql-5.1.46-linux-i686-glibc23.tar.gz
复制目录
cp -r mysql-5.1.46-linux-i686 /usr/local/
mv /usr/local/mysql-5.1.46-linux-i686 /usr/local/mysql
配置文件
cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
mysql目录权限
chown -R root /usr/local/mysql
chgrp -R mysql /usr/local/mysql
chown -R mysql /usr/local/mysql/data
mysql数据库生成
/usr/local/mysql/scripts/mysql_install_db --user=mysql&
启动mysql
/usr/local/mysql/bin/mysqld_safe --user=mysql&
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/
/etc/init.d/mysql.server start
/etc/init.d/mysql.server stop
mv mysql.server mysql
chkconfig --add mysql
chkconfig msyql on
mysql 的 root 密码
# /usr/local/mysql/bin/mysqladmin -u root -p password "[密码]"
在这里我设的是 空
zabbix 写道
创建zabbix用户
#groupadd zabbix
#useradd –g zabbix –m zabbix
tar zxvf zabbix-1.6.tar.gz
cd zabbix-1.6
编译
./configure --prefix=/etc/zabbix --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --enable- server --enable-agent (--with-curl web monitoring)
这里安装时无需指定net-snmp的路径,这就是为什么前面直接将net-snmp安装即可,无需指定路径的原因。因为此时编译zabbix时,会自动去bin或者etc、usr等目录找net-snmp的安装路径。
4.创建zabbix数据库
进入数据库
mysql -uroot -p
输入数据库密码
create database zabbix character set utf8;
允许以root用户远程连接zabbix数据库
grant all privileges on zabbix.* to root@'%' identified by ''; //password null
退出数据库
5.导入zabbix数据
mysql -D zabbix -uroot -proot < /usr/software/zabbix-1.8.5/create/schema/mysql.sql
mysql -D zabbix -uroot -proot < /usr/software/zabbix-1.8.5/create/data/data.sql
mysql -D zabbix -uroot -proot </usr/software/zabbix-1.8.5/create/data/images_mysql.sql
注:-D 要导入数据的数据库名
-u 数据库用户名
-p 数据库用户密码
• vi /etc/services
• zabbix-agent 10050/tcp Zabbix Agent
• zabbix-agent 10050/udp Zabbix Agent
• zabbix-trapper 10051/tcp Zabbix Trapper
• zabbix-trapper 10051/udp Zabbix Trapper
添加配置文件
# mkdir -p /etc/zabbix
# cp <zabbix>/misc/conf/* /etc/zabbix
# chown -R zabbix:zabbix /etc/zabbix
• vi /etc/zabbix/zabbix_server.conf
•
• ListenPort=10051
• DBHost=localhost
• DBName=zabbix
• DBUser=root
• DBPassword=
• DBSocket=/tmp/mysql.sock
cp /usr/software/zabbix-1.8.5/misc/init.d/redhat/zabbix_server_ctl /etc/init.d/
cp /usr/software/zabbix-1.8.5/misc/init.d/redhat/zabbix_agentd_ctl /etc/init.d/
修改zabbix_server_ctl
#!/bin/bash
#chkconfig:345 61 61 //此行的345参数表示,在哪些运行级别启动,启动序号(S61);关闭序号(K61)
#description:zabbix_server_ctl //此行必写,描述服务.
修改zabbix_agentd_ctl类似
自启动
//chkconfig --add zabbix-server
//chkconfig --add zabbix-agent
chkconfig zabbix-server on
chkconfig zabbix-agent on
登陆
http://IP/zabbix
admin/zabbix
置于apache+php,直接安装在windows端即可:
推荐直接使用Wamp集成程序,安装完成后,导入zabbix目录下的frontends/php/*导入到apache的www目录下,输入http://IP/zabbix
进入install页面,
此时监测到php参数不对,到apache目录下对php.ini参数进行配置,将那些参数改为required或者最大的值即可。
此外还需开启gd、ssl等,在php.ini将其模块前面的;去除即可启动gd等,整个过程比起在纯linux下的配置要简单很多,非常建议大家使用这种方法来安装zabbix,彻底实现前台和后台的分离。
1. 改时区 page_header.php:date_default_timezone_set("PRC");
2. 修改apache下面的php.ini文件:符合zabbix最低要求
但是一定要注意wamp的版本。例如太低的版本已经装不了zabbix1.8.5了,一定要下最新版本的wamp才可,搞了哥一个晚上,无语
启动zabbix server时出现snort: error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: N
Please add this line to /etc/ld.so.conf :
echo /usr/local/mysql/lib/ >> /etc/ld.so.conf
and afterward run # /sbin/ldconfig
zabbix后台服务与前台服务的分离
猜你喜欢
转载自glyustb.iteye.com/blog/1096184
今日推荐
周排行