zabbix安装配置

1.准备工作:

  平台:centos6.5

  软件:zabbix-2.4.6.tar.gz

2.安装开发软件包:

yum  -y groupinstall  "Development Tools"

3.安装环境:

yum -y install httpd mysql mysql-server php php-mysql php-common php-mbstring php-gd php-odbc php-pear curl curl-devel net-snmp net-snmp-devel perl-DBI php-xml ntpdate  php-bcmath

4.同步服务端的时间,保持所有服务器时间一致避免出现时间不同导致的不可用的监控数据:

ntpdate pool.ntp.rog

5.创建zabbix服务运行所需要的用户和组:

groupadd  -g 201  zabbix
useradd  -g zabbix  -u 201 -m zabbix

6.配置mysql:

/etc/init.d/mysqld start
mysqladmin  -uroot -h127.0.0.1  password "123456"
mysql -uroot -h127.0.0.1 –p123456
create database zabbix character set utf8;
grant all privileges on zabbix.* to zabbixuser@'%' identified by 'zabbixpass';
flush privileges;

7.导入数据库:

cd /myshell/zabbix-2.4.6/database/mysql/
mysql -uzabbixuser -h192.168.239.130 -p zabbix <database/mysql/schema.sql
mysql -uzabbixuser -h192.168.239.130 -p zabbix <database/mysql/images.sql
mysql -uzabbixuser -h192.168.239.130 -p zabbix <database/mysql/data.sql

登录数据库查看下表是否都创建成功

8.编译安装zabbix:

cd /myshell/zabbix-2.4.6
./configure -sysconfdir=/etc/zabbix/ -enable-server -enable-agent -with-net-snmp -with-libcurl -with-mysql
make && make install

此处指定sysconfdir配置文件的路径就在/etc/zabbix/目录下了,如果不指定默认在/usr/local/etc下

9.cp zabbixserver端跟agent端的启动脚本,并设置执行权限:

cp misc/init.d/tru64/zabbix_agentd /etc/init.d/
cp misc/init.d/tru64/zabbix_server /etc/init.d/
chmod +x /etc/init.d/zabbix_*

10.将zabbix的页面文件copy到指定目录(跟apache配置的相同即可):

mkdir /var/www/html/zabbix
cp -a  zabbix-2.2.2/frontends/php/* /var/www/html/zabbix/
chown -R  apache.apache /var/www/html/zabbix/

11.配置php文件,适应zabbix安装所需的参数:

vim /etc/php.ini:
date.timezone = Asia/Shanghai
max_execution_time = 300
max_input_time = 300
post_max_size = 32M
memory_limit = 128M

12.配置apache文件,定义安装访问zabbix的虚拟主机:

vim /etc/httpd/conf/httpd.conf
ServerName 127.0.0.1
<VirtualHost *:80>
 DocumentRoot  "/var/www/html"
 ServerName 192.168.239.130   #此处IP要修改为本机IP
</VirtualHost>

13.配置zabbix server端的文件,定义数据库的IP、用户名、密码:

vim /etc/zabbix/zabbix_server.conf
DBHost=192.168.239.130        #数据库IP
DBName= zabbix
DBUser=zabbixuser
DBPassword=zabbixpass
StartPollers=30                         #开启多线程数,一般不要超过30个
StartTrappers=20                        #trapper线程数
StartPingers=10                         #fping线程数
StartDiscoverers=120            
MaxHousekeeperDelete=5000       
CacheSize=1024M                         #用来保存监控数据的缓存数,根据监控主机的数量适当调整
StartDBSyncers=8                        #数据库同步时间
HistoryCacheSize=1024M          
TrendCacheSize=128M                     #总趋势缓存大小
HistoryTextCacheSize=512M
AlertScriptsPath=/etc/zabbix/alertscripts
LogSlowQueries=1000

14.关闭selinux:

chkconfig iptables off
vi /etc/selinux/conf
注释掉:
#SELINUX=enforcing
#SELINUXTYPE=targeted 
添加    SELINUX=disable

重启系统

15.启动apache服务跟zabbix服务:

/etc/init.d/httpd start
/etc/init.d/zabbix_server start

16.访问安装界面按照界面提示一步一步的完成安装:

http://192.168.239.130/zabbix/setup.php

你可能感兴趣的:(zabbix安装配置)