64位CentOS 6.2下安装Zabbix 2.0.6
1、安装组件
yum install make mysql-server httpd php mysql-devel gcc net-snmp-devel curl-devel p3rl-DBI php-gd php-mysql php-bcmath php-mbstring php-xml -y
useradd zabbix
2、启动mysql
service mysqld start
mysqladmin –u root password root
mysql –u root –p
输入密码root
3、创建zabbix数据库
Mysql> create database zabbix character set utf8;
Mysql> grant all on zabbix.* TO zabbix@'localhost' identified by 'zabbixpass';
Mysql> flush privileges;
4、导入数据库sql
zabbix-2.0.6/database/mysql
mysql -h localhost -uroot -proot zabbix <schema.sql
mysql -h localhost -uroot -proot zabbix <images.sql
mysql -h localhost -uroot -proot zabbix <data.sql
5、调整当前时间(这个时间对的话就不要调整了)
date -s "2013-04-26 20:48:55"
6、编译安装
./configure --with-mysql --with-net-snmp --with-libcurl --enable-server --enable-agent --enable-proxy --prefix=/usr/local/zabbix
make && make install
7、添加端口
vim /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
8、修改配置文件
修改/etc/httpd/conf/httpd.conf
DirectoryIndex index.html index.html.var index.php
修改/usr/local/zabbix/etc/zabbix_server.conf参数:
DBName=zabbix
DBUser=root
DBPassword=root
cp misc/init.d/Fedora/core5/zabbix_server /etc/init.d/
cp misc/init.d/fedora/core5/zabbix_agentd /etc/init.d/
chmod 700 /etc/init.d/zabbix_*
vim /etc/init.d/zabbix_server
修改
ZABBIX_BIN="/usr/local/sbin/zabbix_server"
为
ZABBIX_BIN="/usr/local/zabbix/sbin/zabbix_server"
vim /etc/init.d/zabbix_agentd
修改
ZABBIX_BIN="/usr/local/sbin/zabbix_agentd"
为
ZABBIX_BIN="/usr/local/zabbix/sbin/zabbix_agentd"
9、启动服务并设置开机启动
/etc/init.d/zabbix_server start
/etc/init.d/zabbix_agentd start
chkconfig zabbix_server on
chkconfig zabbix_agentd on
10、修改php相关参数
# vi /etc/php.ini 找到如下几项,改成下面的值,前面有;号的要删掉
max_execution_time = 300
max_input_time = 300
date.timezone = PRC
post_max_size = 32M
重启httpd
/etc/init.d/httpd restart
11、配置php文件
# cd zabbix-2.0.6
# cd frontends/
# cp -rf php /var/www/html/
# cd /var/www/html
# mv php zabbix
# chown -R zabbix:zabbix zabbix
登录http://ip/zabbix
其中配置DB时mysql的账号和密码都是root,
最后这步显示fail,后来按照提示将zabbix.conf.php的文件下载了cp 到/var/www/html/conf/
最后显示
Configuration file
"/var/www/html/zabbix/conf/zabbix.conf.php"
created: OK
安装成功后,初始登录账号admin,密码zabbix
进入界面,发现一直报错
vim /etc/selinux/conf,将selinux改为disabled,结果发现还不行,后来查看/tmp/zabbix_server.log,发现报如下错误:
5763:20130426:211659.749 Database is down. Reconnecting in 10 seconds.
5763:20130426:211709.751 [Z3001] connection to database 'zabbix' failed: [1045] Access
denied for user 'zabbix'@'localhost' (using password: YES)
经过排查,发现(我在安装zabbix到第4步配置数据库时输入账号和密码都输入zabbix时会提示连接不上,但是mysqladm那边我设置了账号和密码root,所以用root就OK了)
/usr/local/zabbix/etc/zabbix_server.conf参数:
DBName=zabbix
DBUser=zabbix 改为 DBUser=root
DBPassword=zabbix 改为 DBPassword=root
OK,大功告成。
至于zabbix agent的安装就很简单了,将源码安装包拷到客户机上,解压后
groupadd zabbix
useradd zabbix -g zabbix
1、编译安装
./configure --with-net-snmp --with-libcurl --enable-agent --enable-proxy --prefix=/usr/local/zabbix
make && make install
2、添加端口
vim /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
3、修改配置文件
cp misc/init.d/Fedora/core5/zabbix_agentd /etc/init.d/
chown -R zabbix:zabbix /etc/init.d/zabbix_*
chmod 700 /etc/init.d/zabbix_*
su - zabbix
vim /etc/init.d/zabbix_agentd
修改
ZABBIX_BIN="/usr/local/sbin/zabbix_agentd"
为
ZABBIX_BIN="/usr/local/zabbix/sbin/zabbix_agentd"
4、启动服务并设置开机启动
/etc/init.d/zabbix_agentd start
chkconfig zabbix_agentd on
(责任编辑:IT) |