zabbix源码下载: http://www.zabbix.com/download.php ,以“Zabbix 2.2 LTS” 为例。
zabbix2.2官方安装指导: https://www.zabbix.com/documentation/2.2/doku.php?id=manual/installation/install
创建账户
lamp环境搭建:
请确保php支持要求的扩展,如: --with-mysql , 如果phpinfo()信息为--without-mysql,则前端无法支持mysql的数据库。
PHP databases support: PostgreSQL
相关的环境要求以官网为准:
https://www.zabbix.com/documentation/2.2/manual/installation/requirements
服务端和agent安装在同一台机器上:
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2
遇到错误: unable to find net-snmp-config
安装依赖包: yum install -y net-snmp-devel
如果ubuntu系统: apt-get install libsnmp-dev snmp
常见错误: http://os.51cto.com/art/201104/252988.htm
配置成功信息:
***********************************************************
* Now run 'make install' *
* *
* Thank you for using Zabbix! *
* <http://www.zabbix.com> *
***********************************************************
根据提示,运行 : make ; make install
检查和修改配置文件:
/usr/local/zabbix/etc/zabbix_agent.conf
在所有的agent上指定 Server=ip
/usr/local/zabbix/etc/zabbix_server.conf
指定数据库相关配置的选项:
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
DBSocket=/tmp/mysql.sock
在 /etc/httpd/conf.d/zabbix.conf 配置文件中加入下面配置,下面举例:
<Directory "/var/www/html/zabbix">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value date.timezone Asia/Hong_Kong
</Directory>
时区的设置以系统实际的为准,相关的配置文件:
/etc/localtime
/usr/share/zoneinfo/Asia/Hong_Kong
创建数据库: https://www.zabbix.com/documentation/2.2/manual/appendix/install/db_scripts
shell> mysql -u<username> -p<password>
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@"%" IDENTIFIED BY "zabbix";
mysql> quit;
shell> cd zabbix-2.2.7/database/mysql
shell> mysql -u<username> -p<password> zabbix < database/mysql/schema.sql
# stop here if you are creating database for Zabbix proxy
shell> mysql -u<username> -p<password> zabbix < database/mysql/images.sql
shell> mysql -u<username> -p<password> zabbix < database/mysql/data.sql
7zabbix前端访问 http://IP/zabbix ;根据提示完成配置。 9