首页 > 代码库 > zabbix3.2安装
zabbix3.2安装
硬件需求
Examples of hardware configuration
The table provides several examples of hardware configurations:
Name | Platform | CPU/Memory | Database | Monitored hosts |
---|---|---|---|---|
Small | CentOS | Virtual Appliance | MySQL InnoDB | 100 |
Medium | CentOS | 2 CPU cores/2GB | MySQL InnoDB | 500 |
Large | RedHat Enterprise Linux | 4 CPU cores/8GB | RAID10 MySQL InnoDB or PostgreSQL | >1000 |
Very large | RedHat Enterprise Linux | 8 CPU cores/16GB | Fast RAID10 MySQL InnoDB or PostgreSQL | >10000 |
部署环境(硬件)需求
主机数量:50台、网络设备数量:20台。总计监控点位70个。
根据官方提供的硬件设备需求表,提出以下硬件需求
CPU:1核。
内存:2G
磁盘容量:45G
磁盘容量计算方式:
linux操作系统+软件部署:6G
服务器:50个点,每一分钟读取一次数据,每秒数据量为50*30/60=25个/秒。
网络设备:20个点,每20秒读取一次数据,每秒数据量为20*30/20=30个/秒。
zabbix每秒处理的数据量:55个/秒
一条记录大小:5字节
保存记录的值(一个月):24*30*3600(一个月的秒)*55*5=712800000字节(约为6.6G)
趋势数据(5年):2100个*24小时*356天*128字节(一条趋势数据大小)*5=11G
事件记录保存(一年):1年*365天*24小时*3600秒*130字节(一条事件记录的大小)=4.1G
按照保存记录的值3个月,趋势数据5年,时间保存记录的值2年进行计算:
所需磁盘容量为:6G+6.6G*3+11+4.1G*2=45G
数据库需求
Database management system
Software | Version | Comments |
---|---|---|
MySQL | 5.0.3 or later | Required if MySQL is used as Zabbix backend database. InnoDB engine is required. |
Oracle | 10g or later | Required if Oracle is used as Zabbix backend database. |
PostgreSQL | 8.1 or later | Required if PostgreSQL is used as Zabbix backend database. It is suggested to use at least PostgreSQL 8.3, which introduced much better VACUUM performance. |
SQLite | 3.3.5 or later | Required if SQLite is used as Zabbix backend database. |
IBM DB2 | 9.7 or later | Required if IBM DB2 is used as Zabbix backend database. |
前端需求
Frontend
The following software is required to run Zabbix frontend:
Software | Version | Comments |
---|---|---|
Apache | 1.3.12 or later | |
PHP | 5.4.0 or later | |
PHP extensions: | ||
gd | 2.0 or later | PHP GD extension must support PNG images (--with-png-dir), JPEG (--with-jpeg-dir) images and FreeType 2 (--with-freetype-dir). |
bcmath | php-bcmath (--enable-bcmath) | |
ctype | php-ctype (--enable-ctype) | |
libXML | 2.6.15 or later | php-xml or php5-dom, if provided as a separate package by the distributor. |
xmlreader | php-xmlreader, if provided as a separate package by the distributor. | |
xmlwriter | php-xmlwriter, if provided as a separate package by the distributor. | |
session | php-session, if provided as a separate package by the distributor. | |
sockets | php-net-socket (--enable-sockets). Required for user script support. | |
mbstring | php-mbstring (--enable-mbstring) | |
gettext | php-gettext (--with-gettext). Required for translations to work. | |
ldap | php-ldap. Required only if LDAP authentication is used in the frontend. | |
ibm_db2 | Required if IBM DB2 is used as Zabbix backend database. | |
mysqli | Required if MySQL is used as Zabbix backend database. | |
oci8 | Required if Oracle is used as Zabbix backend database. | |
pgsql | Required if PostgreSQL is used as Zabbix backend database. | |
sqlite3 |
Required if SQLite is used as Zabbix backend database. |
|
要点:( --with-mysqli=mysqlnd和--with-gettext一定要加上,否则前者不装时安装 zabbix时database type没有选项 默认出来的数据库是SqLite 3,且不能切换 ,后者不装时,会报PHP gettext warning)
|
Pre-requisite | Minimum value | Description |
---|---|---|
PHP version | 5.4.0 | |
PHP memory_limit option | 128MB | In php.ini: memory_limit = 128M |
PHP post_max_size option | 16MB | In php.ini: post_max_size = 16M |
PHP upload_max_filesize option | 2MB | In php.ini: upload_max_filesize = 2M |
PHP max_execution_time option | 300 seconds (values 0 and -1 are allowed) | In php.ini: max_execution_time = 300 |
PHP max_input_time option | 300 seconds (values 0 and -1 are allowed) | In php.ini: max_input_time = 300 |
PHP session.auto_start option | must be disabled | In php.ini: session.auto_start = 0 |
Database support | One of: IBM DB2, MySQL, Oracle, PostgreSQL, SQLite | One of the following modules must be installed: ibm_db2, mysql, oci8, pgsql, sqlite3 |
bcmath | php-bcmath | |
mbstring | php-mbstring | |
PHP mbstring.func_overload option | must be disabled | In php.ini: mbstring.func_overload = 0 |
PHP always_populate_raw_post_data option | must be disabled | Required only for PHP versions 5.6.0 or newer. In php.ini: always_populate_raw_post_data = http://www.mamicode.com/-1 |
sockets | php-net-socket. Required for user script support. | |
gd | 2.0 or higher | php-gd. PHP GD extension must support PNG images (--with-png-dir), JPEG (--with-jpeg-dir) images and FreeType 2 (--with-freetype-dir). |
libxml | 2.6.15 | php-xml or php5-dom |
xmlwriter | php-xmlwriter | |
xmlreader | php-xmlreader | |
ctype | php-ctype | |
session | php-session | |
gettext | php-gettext Since Zabbix 2.2.1, the PHP gettext extension is not a mandatory requirement for installing Zabbix. If gettext is not installed, the frontend will work as usual, however, the translations will not be available. |
其他扩展需求
Requirement | Description |
---|---|
OpenIPMI | Required for IPMI support. yum install OpenIPMI-devel OpenIPMI |
libssh2 | Required for SSH support. Version 1.0 or higher.yum install libssh2 libssh2-devel |
fping | Required for ICMP ping items.yum install fping |
libcurl | Required for web monitoring, VMware monitoring and SMTP authentication. For SMTP authentication, version 7.20.0 or higher is required.yum install libcurl libcurl-devel |
libiksemel | Required for Jabber support. |
libxml2 | Required for VMware monitoring. yum install libxml2 libxml2-devel |
net-snmp | Required for SNMP support. yum install net-snmp net-snmp-devel |
yum install OpenIPMI-devel OpenIPMI libssh2 libssh2-devel fping libxml2 libxml2-devel net-snmp net-snmp-devel -y
环境及相关软件
系统: CentOS release 6.7 (Final)
软件包:/home/tools
mysql-5.5.49.tar.gz
libiconv-1.14.tar.gz
nginx-1.8.1.tar.gz
php-5.6.22.tar.gz
zabbix-3.2.6.tar.gz
数据库安装
yum install cmake ncurses-devel openssl-devel -y useradd mysql -s /bin/nologin -M mkdir /data chown -R mysql.mysql /data cd /home/tools/ tar -xf mysql-5.5.49.tar.gz cd mysql-5.5.49 cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql5.5.49 -DMYSQL_DATADIR=/data -DSYSCONFDIR=/etc -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DWITH_READLINE=1 -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_LIBWRAP=0 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_EMBEDDED_SERVER=1 -DENABLED_PROFILING=1 -DWITH_DEBUG=0 make make install ln -s /usr/local/mysql5.5.49 /usr/local/mysql /bin/cp /home/tools/mysql-5.5.49/support-files/my-large.cnf /etc/my.cnf chown -R mysql.mysql /usr/local/mysql #vi /etc/my.cnf #增加 #datadir = /data #innodb_file_per_table = 1 /bin/cp /home/tools/mysql-5.5.49/support-files/mysql.server /etc/init.d/mysqld chmod +x /etc/init.d/mysqld chkconfig --add mysqld echo ‘export PATH=/usr/local/mysql/bin:$PATH‘ >>/etc/profile source /etc/profile cd /usr/local/mysql/scripts ./mysql_install_db --basedir=/usr/local/mysql --datadir=/data/ --user=mysql /etc/init.d/mysqld start
nginx安装
yum install pcre pcre-devel -y yum install openssl-devel openssl -y useradd nginx -s /sbin/nologin -M
cd /home/tools tar -zxvf nginx-1.8.1.tar.gz cd nginx-1.8.1 ./configure --prefix=/usr/local/nginx-1.8.1 --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module make make install ln -s /usr/local/nginx-1.8.1/ /usr/local/nginx cd /usr/local/nginx egrep -v "#|^$" conf/nginx.conf.default >conf/nginx.conf 在nginx.conf中的server内添加: #vi conf/nginx.conf location ~.*\.(php|php5)$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; } /usr/local/nginx/sbin/nginx
php安装
yum install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel openssl-devel -y
cd /home/tools tar zxf libiconv-1.14.tar.gz cd libiconv-1.14 ./configure --prefix=/usr/local/libiconv make make install
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo yum -y install libmcrypt libmcrypt-devel mhash mhash-devel mcrypt -y
cd /home/tools tar xf php-5.6.22.tar.gz cd php-5.6.22 ./configure --prefix=/usr/local/php5.6.22 --with-mysql=/usr/local/mysql --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir=/usr/local/libiconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --with-gettext --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=nginx --with-fpm-group=nginx --enable-ftp --enable-opcache --enable-ctype make make install ln -s /usr/local/php5.6.22/ /usr/local/php
============================================== #vi /etc/ld.so.conf.d/local.conf /usr/local/lib64 #ldconfig configure: error: Don‘t know how to define struct flock on this system, set --enable-opcache=no
如果无法解决,尝试如下
echo /usr/local/mysql/lib >> /etc/ld.so.conf
ldconfig
============================================= cp /home/tools/php-5.6.22/php.ini-production /usr/local/php/lib/php.ini cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf /usr/local/php/sbin/php-fpm #check whether fastcgi can connect php vi /usr/local/nginx/html/phpinfo.php <?php phpinfo() ?> 在浏览器中访问http://zabbix服务器IP/phpinfo.php
安装zabbix
mysql> create database zabbix character set utf8 collate utf8_bin; mysql> grant all privileges on zabbix.* to zabbix@localhost identified by ‘zabbix‘; mysql> quit;
cd /home/tools
tar -xf zabbix-3.2.6.tar.gz
cd /home/tools/zabbix-3.2.6/database/mysql
mysql -uzabbix -pzabbix zabbix < schema.sql
mysql -uzabbix -pzabbix zabbix < images.sql
mysql -uzabbix -pzabbix zabbix < data.sql
cd /home/tools/zabbix-3.2.6
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-openipmi --with-ssh2
make install
cp -a /home/tools/zabbix-3.2.6/frontends/php/* /usr/local/nginx/html/
chown -R nginx.nginx /usr/local/nginx/html/
vi /usr/local/zabbix/etc/zabbix_server.conf
LogFile=/tmp/zabbix_server.log
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
useradd zabbix -s /sbin/nologin -M
cd /usr/local/php/lib/
sed -i "s#post_max_size = 8M#post_max_size = 16M#g" php.ini
sed -i "s#max_execution_time = 30#max_execution_time = 300#g" php.ini
sed -i "s#max_input_time = 60#max_input_time = 300#g" php.ini
sed -i "s#;date.timezone =#date.timezone = Asia/Shanghai#g" php.ini
sed -i "s#;always_populate_raw_post_data = http://www.mamicode.com/-1#always_populate_raw_post_data = -1#g" php.ini
killall php-fpm
/usr/local/php/sbin/php-fpm
浏览器,按照提示完成
http://zabbix ip/setup.php
配置开机启动 cd /home/tools/zabbix-3.2.6/misc/init.d/fedora/core/ cp zabbix_* /etc/init.d/ chmod +x /etc/init.d/zabbix_server chmod +x /etc/init.d/zabbix_agentd chkconfig zabbix_server on chkconfig zabbix_agentd on 修改zabbix开机启动脚本中的zabbix安装目录 vi /etc/rc.d/init.d/zabbix_server #编辑服务端配置文件 BASEDIR=/usr/local/zabbix/ #zabbix安装目录 vi /etc/rc.d/init.d/zabbix_agentd #编辑客户端配置文件 BASEDIR=/usr/local/zabbix/ #zabbix安装目录
zabbix3.2安装
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。