zabbix2.0安装配置教程

------------zabbix检测的一些东西---------------
Current value Required
PHP version 5.1.6 5.1.6 OK
PHP option memory_limit 128M 128M OK
PHP option post_max_size 18M 16M OK
PHP option upload_max_filesize 2M 2M OK
PHP option max_execution_time 300 300 OK
PHP option max_input_time 300 300 OK
PHP timezone PRC OK
PHP databases support MySQL OK
PHP bcmath yes OK
PHP mbstring yes OK
PHP sockets yes OK
PHP gd 2.0.28 2.0 OK
PHP gd PNG support yes OK
PHP gd JPEG support yes OK
PHP gd FreeType support yes OK
PHP libxml 2.6.26 2.6.15 OK
PHP xmlwriter yes OK
PHP xmlreader yes OK
PHP ctype yes OK
PHP session yes OK
PHP gettext yes OK
-----------------下面是安装教程---------------------

1 安装LAMP和SNMP

[root@localhost ~]# yum install httpd php php-devel php-gd php-bcmath php-mbstring mysql-devel mysql-serverphp-xml php-mysql gd net-snmp net-snmp-devel net-snmp-utils
[root@localhost ~]# chkconfig httpd on
[root@localhost ~]# chkconfig mysqld on
[root@localhost ~]# chkconfig snmpd on

2 编译安装zabbix. 前面几个步骤一样. 我就直接复制了

[root@localhost ~]# wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.0.2/zabbix-2.0.2.tar.gz/download

[root@localhost ~]# tar zxvf zabbix-2.0.0.tar.gz
[root@localhost ~]# cd zabbix-2.0.0
[root@localhost zabbix-2.0.0]# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl
[root@localhost zabbix-2.0.0]# make install

3 创建数据库

[root@localhost ~]# /etc/init.d/mysqld start #启动mysql
[root@localhost ~]# mysqladmin -uroot password 'root' #配置用户密码
[root@localhost ~]# mysql -uroot -proot
mysql> create database zabbix character set utf8;
mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix';
#建立一个zabbix用户
mysql> quit

4 导入zabbixsql文件到数据库

[root@localhost ~]# cd zabbix-2.0.0/database/mysql/
[root@localhost mysql]# mysql -uzabbix -pzabbix zabbix < schema.sql
[root@localhost mysql]# mysql -uzabbix -pzabbix zabbix < images.sql
[root@localhost mysql]# mysql -uzabbix -pzabbix zabbix < data.sql

配置zabbix连接数据库选项
[root@localhost ~]# vim /usr/local/zabbix/etc/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
DBSocket=/var/lib/mysql/mysql.sock #注意你的mysql.sock位置
DBPort=3306

5 配置启动服务,这里是重点.新版本新位置
[root@localhost zabbix-2.0.0]# cp misc/init.d/fedora/core/zabbix_* /etc/init.d/
[root@localhost zabbix-2.0.0]# vim /etc/init.d/zabbix_server
BASEDIR=/usr/local/zabbix/sbin/zabbix_server #修改为zabbix安装的路径
[root@localhost zabbix-2.0.0]# vim /etc/init.d/zabbix_agentd
BASEDIR=/usr/local/zabbix/sbin/zabbix_agentd #修改为zabbix安装的路径
[root@localhost ~]# echo "/etc/init.d/zabbix_server start" >> /etc/rc.local
[root@localhost ~]# echo "/etc/init.d/zabbix_agentd start" >> /etc/rc.local
[root@localhost ~]# /etc/init.d/zabbix_server start
[root@localhost ~]# /etc/init.d/zabbix_agentd start

6 最后设置,网页安装
[root@localhost ~]# /etc/init.d/httpd start
[root@localhost ~]# mkdir /var/www/html/zabbix
[root@localhost ~]# cp -a zabbix-2.0.0/frontends/php/* /var/www/html/zabbix/
[root@localhost html]# chown apache:apache -R /var/www/html/zabbix/

打开http://192.168.1.1/zabbix/将会看到zabbix安装向导

一些PHP检测的东西
(修改/etc/php.ini记得重启httpd服务)
[root@localhost ~]# vim /etc/php.in
post_max_size = 8M
max_execution_time = 30
max_input_time = 60
;date.timezone =

修改:
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = PRC
[root@localhost ~]# /etc/init.d/httpd restart

web一直下一步,安装完成后 . 通过web登录,默认用户:admin 密码:zabbix

>>>客户端安装(本人没有验证)
下载地址:http://www.zabbix.com/download.php
[root@localhost ~]# useradd zabbix
[root@localhost ~]# mkdir /usr/local/zabbix/
[root@localhost ~]# tar zxf zabbix_agents_2.0.0.linux2_6.i386.tar.gz -C /usr/local/zabbix/
[root@localhost ~]# ln -s /usr/local/zabbix/bin/* /usr/local/bin/
[root@localhost ~]# ln -s /usr/local/zabbix/sbin/* /usr/local/sbin/
[root@localhost ~]# echo "/usr/local/zabbix/sbin/zabbix_agent start" >>/etc/rc.local #开机自启动

官网上下载相应平台的agent包里没有运行agent所需的配置文件,可以从zabbix Server上拷贝一份zabbix.agentd.conf放到/usr/local/etc目录下,这个配置文件是所有平台都通用的。
修改zabbix.agentd.conf
[root@localhost ~]# vim /usr/local/etc/zabbix_agentd.conf
将server修改成zabbix_server的服务器IP
Server=192.168.209.128
手动启动:
[root@localhost ~]# zabbix_agentd start
[root@localhost ~]# netstat -nlp | grep zabbix_agentd
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 2855/zabbix_agentd

Leave a Comment