首页 > 代码库 > 详解zabbix监控系统安装部署
详解zabbix监控系统安装部署
系统信息:系统版本:Centos6.5 64位
Server端IP:172.16.4.63
Server端IP:172.16.4.64
Zabbix版本:zabbix-2.0.14.tar.gz
1.安装LAMP环境
用yum安装server端:
[root@zabbix ~]# yum install gcc gcc-c++
[root@zabbix ~]# yum install -y httpd mysql mysql-server mysql-devel php php-mysql php-common php-mbstring php-gd php-odbc php-xml php-pe
[root@zabbix ~]#service httpd start (启动httpd)
[root@zabbix ~]#service mysqld start (启动mysqld)
Server和Agent端都要安装下面的库:
yum install -y curl curl-devel net-snmp net-snmp-devel perl-DBI
2.下载zabbix-2.0.14.tar.gz,到官网上下载
3.创useradd zabbix建Server端和Agent端用户帐号
[root@zabbix ~]# useradd zabbix;root@zabbix ~]# usermod -s /sbin/nologin zabbix
4.Server端数据库配置:初始化数据库-->创建zabbix数据库-->导入zabbix数据库
[root@zabbix ~]# mysqladmin -u root password ‘123456‘
[root@zabbix ~]# mysql -u root p
mysql>create database zabbix character set utf8;
mysql> grant all on zabbix.* to zabbix@localhost identified by ‘123456‘;
mysql> use zabbix;
mysql> source /root/zabbix-2.2.6/database/mysql/schema.sql
mysql> source /root/zabbix-2.2.6/database/mysql/images.sql
mysql> source /root/zabbix-2.2.6/database/mysql/data.sql
mysql> exit
5.Server端编译安装zabbix
[root@zabbix ~]#cd /root/zabbix-2.0.14.tar.gz
[root@zabbix zabbix-2.0.14]#tar zxvf zabbix-2.0.14
[root@zabbix zabbix-2.0.14]#./configure -enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --prefix=/usr/local/zabbix
[root@zabbix zabbix-2.0.14]#make install
6.配置Server端
[root@zabbix ~]#ln -s /usr/local/zabbix/sbin/zabbix_* /usr/local/sbin/
[root@zabbix ~]#vi /usr/local/zabbix/etc/zabbix_server.conf修改添加下面内容:
LogFile=/tmp/zabbix_server.log
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=123456
拷贝脚本并启动:
[root@zabbix ~]#cd /root/ zabbix-2.0.14
[root@zabbix zabbix-2.0.14]# cp misc/init.d/tru64/zabbix_server /etc/init.d/
[root@zabbix zabbix-2.0.14]# cp -a frontends/php/* /var/www/html/
[root@zabbix zabbix-2.0.14]# sed -i ‘/date.timezone/i date.timezone = PRC‘ /etc/php.ini
[root@zabbix zabbix-2.0.14]#chmod +x /etc/init.d/zabbix_server
[root@zabbix zabbix-2.0.14]#vi /etc/init.d/zabbix_server添加下面内容:
#!/bin/sh
#chkconfig: 35 95 95
#description:zabbix Agent server
添加服务:
[root@zabbix zabbix-2.0.14]#chkconfig add zabbix_server
开机自动启动:
[root@zabbix zabbix-2.0.14]#chkconfig zabbix_server on
启动服务:
[root@zabbix zabbix-2.0.14]#/etc/init.d/zabbix_server start
查看服务是否启动成功:
[root@zabbix zabbix-2.0.14]#ps ef |grep zabbix
zabbix 19719 1 0 05:43 ? 00:00:00 /usr/local/sbin/zabbix_server
zabbix 19721 19719 0 05:43 ? 00:00:00 /usr/local/sbin/zabbix_server
zabbix 19722 19719 0 05:43 ? 00:00:00 /usr/local/sbin/zabbix_server
zabbix 19723 19719 0 05:43 ? 00:00:00 /usr/local/sbin/zabbix_server
zabbix 19724 19719 0 05:43 ? 00:00:00 /usr/local/sbin/zabbix_server
zabbix 19725 19719 0 05:43 ? 00:00:00 /usr/local/sbin/zabbix_server
zabbix 19727 19719 0 05:43 ? 00:00:00 /usr/local/sbin/zabbix_server
zabbix 19728 19719 0 05:43 ? 00:00:00 /usr/local/sbin/zabbix_server
zabbix 19729 19719 0 05:43 ? 00:00:00 /usr/local/sbin/zabbix_server
zabbix 19730 19719 0 05:43 ? 00:00:00 /usr/local/sbin/zabbix_server
zabbix 19732 19719 0 05:43 ? 00:00:00 /usr/local/sbin/zabbix_server
zabbix 19734 19719 0 05:43 ? 00:00:00 /usr/local/sbin/zabbix_server
zabbix 19735 19719 0 05:43 ? 00:00:00 /usr/local/sbin/zabbix_server
[root@zabbix ~]# netstat -lantp |grep 10051
tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 19719/zabbix_server
7.配置Agent端
[root@zabbix zabbix-2.0.14]#./configure --prefix=/usr/local/zabbix --enable-agent
[root@zabbix zabbix-2.0.14]#make install
添加软链接:
[root@zabbix zabbix-2.0.14]# ln -s /usr/local/zabbix/sbin/zabbix_* /usr/local/sbin/
修改zabbix_agentd.conf:
[root@zabbix ~]#vi /usr/local/zabbix/etc/zabbix_agentd.conf 添加下面内容
LogFile=/tmp/zabbix_agentd.log
Server=172.16.4.63
ServerActive=172.16.4.63
Hostname=Zabbix server
UnsafeUserParametess=1
拷贝脚本并启动:
[root@zabbix ~]#cd /root/ zabbix-2.0.14
[root@zabbix zabbix-2.0.14]# cp misc/init.d/tru64/zabbix_agentd /etc/init.d/
[root@zabbix zabbix-2.0.14]#chmod +x /etc/init.d/zabbix_agentd
[root@zabbix zabbix-2.0.14]#vi /etc/init.d/zabbix_agentd添加下面内容:
#!/bin/sh
#chkconfig: 35 95 95
#description:zabbix Agent server
添加服务:
[root@zabbix zabbix-2.0.14]#chkconfig add zabbix_agentd
开机自动启动:
[root@zabbix zabbix-2.0.14]#chkconfig zabbix_agentd on
启动服务:
[root@zabbix zabbix-2.0.14]#/etc/init.d/zabbix_agentd start
8.开始安装
打开浏览器输入http://172.16.4.62显示如下
红色字报错:按提示修改/etc/php.ini如下:
[root@zabbix ~]# sed -i ‘/post_max_size/s/8/16/g;/max_execution_time/s/30/300/g;/max_input_time/s/60/300/g;‘ /etc/php.ini
<strong
详解zabbix监控系统安装部署