码迷,mamicode.com
首页 > 其他好文 > 详细

zabbix部署

时间:2016-05-12 06:55:57      阅读:382      评论:0      收藏:0      [点我收藏+]

标签:

安装前准备:
yum -y install beecrypt beecry-devel curl curl-devel freetype freetype-devel fontconfig fontconfig-devel gettext gettext-devel ImageMagick ImageMagick-devel mingw32-
iconv.noarch libmcrypt libmcrypt-devel libpng libpng-devel libxml2 libxml2-devel libxslt libxslt-devel mhash mhash-devel mcrypt zlib zlib-devel gd gd-devel libjpeg
libjpeg-devel

软件包下载:
wget http://downloads.mysql.com/archives/get/file/mysql-5.6.5-m8.tar.gz
wget http://www.cmake.org/files/v2.8/cmake-2.8.8.tar.gz
wget http://cn2.php.net/get/php-5.4.29.tar.gz/from/this/mirror
wget http://ftp.gnu.org/gnu/libiconv/libiconv-1.14.tar.gz
wget http://download.oracle.com/otn/java/6u38-b05/jdk-6u38-linux-x64.bin
wget http://nginx.org/download/nginx-1.2.9.tar.g
wget http://iksemel.googlecode.com/files/iksemel-1.4.tar.gz
https://www.libssh2.org/download/libssh2-1.4.3.tar.gz
http://downloads.sourceforge.net/project/openipmi/OpenIPMI%202.0%20Library/OpenIPMI-2.0.21.tar.gz?r=http%3A%2Fsourceforge.net%2Fprojects%2Fopenipmi
%2F&ts=1401936534&use_mirror=superb-dca3
wget --limit-rate 500k http://www.fping.org/dist/fping-3.8.tar.gz

安装MYSQL

[root@yz6245 soft]# tar -zxvf cmake-2.8.8.tar.gz
[root@yz6245 soft]# cd cmake-2.8.8
[root@yz6245 cmake-2.8.8]# ./bootstrap
[root@yz6245 cmake-2.8.8]# gmake
[root@yz6245 cmake-2.8.8]# gmake install
[root@yz6245 cmake-2.8.8]# cmake -version
cmake version 2.8.8

[root@yz6245 soft]# tar zxvf mysql-5.6.5-m8.tar.gz
[root@yz6245 soft]# cd mysql-5.6.5-m8
[root@yz6245 mysql-5.6.5-m8]# cmake -DCMAKE_INSTALL_PREFIX=/data0/mysql \
> -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf-8 \
> -DDEFAULT_COLLATION=utf-8_general_ci \
> -DWITH_EXTRA_CHARSETS:STRING=all \
> -DWITH_INNODB_STORAGE_ENGINE=1 \
> -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 \
> -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306
[root@yz6245 mysql-5.6.5-m8]# make && make install
[root@yz6245 mysql-5.6.5-m8]# useradd -s /sbin/nologin mysql
[root@yz6245 mysql-5.6.5-m8]# cp support-files/my-large.cnf /etc/my.cnf
[root@yz6245 mysql]# cd /data0/mysql
[root@yz6245 mysql]# scripts/mysql_install_db --datadir=/data0/mysql/data/ --default-file=/etc/my.cnf --user=mysql
ot@yz6245 mysql]# cp support-files/mysql.server /etc/init.d/
[root@yz6245 mysql]# chkconfig --add mysql.server
[root@yz6245 mysql]# service mysql.server start

问题:
[root@yz6245 mysql]# scripts/mysql_install_db --datadir=/data0/mysql/data/ --default-file=/etc/my.cnf --user=mysql
Installing MySQL system tables...
./bin/mysqld: Character set ‘utf-8‘ is not a compiled character set and is not specified in the ‘/data0/mysql/share/charsets/Index.xml‘ file
160509 22:58:59 [ERROR] Aborting

160509 22:58:59 [Note] ./bin/mysqld: Shutdown complete


Installation of system tables failed! Examine the logs in
/data0/mysql/data/ for more information.

You can try to start the mysqld daemon with:

shell> ./bin/mysqld --skip-grant &

and use the command line tool ./bin/mysql
to connect to the mysql database and look at the grant tables:

shell> ./bin/mysql -u root mysql
mysql> show tables

Try ‘mysqld --help‘ if you have problems with paths. Using --log
gives you a log in /data0/mysql/data/ that may be helpful.

Please consult the MySQL manual section
‘Problems running mysql_install_db‘, and the manual section that
describes problems on your OS. Another information source are the
MySQL email archives available at http://lists.mysql.com/.

Please check all of the above before mailing us! And remember, if
you do mail us, you MUST use the ./bin/mysqlbug script!


cd /usr/local/mysql55/bin/
[root@yz6245 bin]# ./mysql

./configure --prefix=/usr/local/php --disable-debug --disable-ipv6 \
--disable-repath --enable-bcmath --enable-exif \
--enable-gd-native-ttf --enable-mbregex --enable-mbstring=all --enable-pcntl \
--enable-safe-mode --enable-shmop --enable-soap --enable-sockets \
--enable-xml --with-config-file-path=/usr/local/php/etc \
--with-curl --with-curlwrappers --with-freetype-dir --with-gd --with-gettext \
--with-iconv-dir=/usr/local --with-jpeg-dir --with-ldap \
--with-ldap-sasl --with-libdir=lib --with-libxml-dir=/usr --with-mcrypt \
--with-mhash --with-openssl --with-pdo-mysql --with-pear --with-png-dir \
--with-xmlrpc --with-zlib-dir --with-mysqli=/data0/mysql/bin/mysql_config \
--with-mysql=/data0/mysql \
--enable-fastcgi --enable-fpm --enable-force-cgi-redirect

问题:
checking for MySQL UNIX socket location... no
checking for MySQLi support... yes
checking whether to enable embedded MySQLi support... no
mysql_config not found
configure: error: Please reinstall the mysql distribution

解决:只需要找 这个 mysql的配置文件,可能是 mysql的配置文件 路径有问题
/usr/bin/mysql_config 一般 找到 mysql_config 这个配置文件就可以了
./configure --with-php-config=/usr/local/php5/bin/php-config --with-mysqli=/usr/local/mysql/bin/mysql_config


./configure --prefix=/usr/local/php --disable-debug --disable-ipv6 --disable-rpath --enable-bcmath --enable-exif --enable-gd-native-ttf --enable-mbregex --enable-
mbstring=all --enable-pcntl --enable-safe-mode --enable-shmop --enable-soap --enable-sockets --enable-xml --with-config-file-path=/usr/local/php/etc --with-curl --
with-curlwrappers --with-freetype-dir --with-gd --with-gettext --with-iconv-dir=/usr/local --with-jpeg-dir --with-ldap --with-ldap-sasl --with-libdir=lib --with-
libxml-dir=/usr --with-mcrypt --with-mhash --with-openssl --with-pdo-mysql --with-pear --with-png-dir --with-xmlrpc --with-zlib-dir --with-
mysqli=/usr/local/mysql55/bin/mysql_config --with-mysql=/usr/local/mysql55 --enable-fastcgi --enable-fpm --enable-force-cgi-redirect

[root@yz6245 php-5.4.29]# make ZEND_EXTRA_LIBS=‘-liconv‘
[root@yz6245 php-5.4.29]# make install
[root@yz6245 php-5.4.29]# cp php.ini-production /usr/local/php/etc/php.ini
[root@yz6245 php-5.4.29]# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

安装nginx
[root@yz6245 soft]# tar zxvf nginx-1.2.9.tar.gz
[root@yz6245 soft]# cd nginx-1.2.
[root@yz6245 nginx-1.2.9]# ./configure --prefix=/usr/local/nginx --user=nobody --group=nobody \
> --with-poll_module --with-http_ssl_module --with-http_sub_module \
> --with-http_perl_module --with-mail --with-pcre
问题
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
解决:
[root@yz6245 nginx-1.2.9]# yum -y install pcre-devel


[root@yz6245 nginx-1.2.9]# make && make install

启动命令:
[root@yz6245 nginx-1.2.9]# killall php-fpm
[root@yz6245 nginx-1.2.9]# /usr/local/php/sbin/php-fpm
[root@yz6245 nginx-1.2.9]# /usr/local/nginx/sbin/nginx

安装jdk
[root@yz6245 soft]# chmod +x jdk-6u20-linux-i586.bin
[root@yz6245 soft]# mv jdk1.6.0_20/ /usr/java
[root@yz6245 soft]# echo "Java_HOME=/usr/java" >> /etc/profile
[root@yz6245 soft]# echo "PATH=\$PATH:/usr/java/bin" >> /etc/profile
[root@yz6245 soft]# echo "export Java_HOME" >> /etc/profile
[root@yz6245 soft]# echo "export PATH" >> /etc/profile
[root@yz6245 soft]# source /etc/profile

安装iksemel
[root@yz6245 soft]# tar zxvf iksemel-1.4.tar.gz
[root@yz6245 soft]# cd iksemel-1.4
[root@yz6245 iksemel-1.4]# ./configure --prefix=/usr/local/iksemel ;make ;make install

安装OpenIPMI
[root@yz6245 soft]# tar zxvf OpenIPMI-2.0.21.tar.gz
[root@yz6245 soft]# cd OpenIPMI-2.0.21
[root@yz6245 OpenIPMI-2.0.21]# ./configure --prefix=/usr/loca/OpenIMPI;make ;make install

准备数据库:
[root@yz6245 bin]# mysql
mysql> create database zabbix default character set=utf8;
Query OK, 1 row affected (0.04 sec)
mysql> grant all on zabbix.* to ‘zabbix‘@‘%‘ identified by ‘123qwe‘;
Query OK, 0 rows affected (0.03 sec)

安装
[root@yz6245 soft]# tar zxvf zabbix-3.0.2.tar.gz
[root@yz6245 soft]# cd zabbix-3.0.2
[root@yz6245 zabbix-3.0.2]# mysql -uzabbix -p123qwe -h 10.39.6.245 zabbix < database/mysql/schema.sql
[root@yz6245 zabbix-3.0.2]# mysql -uzabbix -p123qwe -h 10.39.6.245 zabbix < database/mysql/images.sql
[root@yz6245 zabbix-3.0.2]# mysql -uzabbix -p123qwe -h 10.39.6.245 zabbix < database/mysql/data.sql

安装UnixODBC
[root@yz6245 zabbix-3.0.2]# yum -y install unixODBC unixODBC-devel
[root@yz6245 zabbix-3.0.2]# yum -y install mysql-connector-odbc
[root@yz6245 zabbix-3.0.2]# vim /etc/odbcinst.ini #不用修改,默认即可
[root@yz6245 zabbix-3.0.2]# vim /etc/odbc.ini #添加以下内容
[mysql]
Description = Zabbix server MySQL database
Driver = MySQL
Server = 10.39.6.245
User = zabbix
password = 123qwe
Port = 3306
Socket = /tmp/mysql.sock


odbc-sqlserver未安装

安装zabbix软件包
[root@yz6245 zabbix-3.0.2]# id zabbix
uid=579(zabbix) gid=580(zabbix) groups=580(zabbix)
[root@yz6245 zabbix-3.0.2]# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent \
> --enable-java --with-mysql=/usr/local/mysql55/bin/mysql_config \
> --with-jabber=/usr/local/iksemel/ --with-net-snmp --with-libcurl \
> --with-openipmi --with-unixodbc=/usr/bin/odbc_config
[root@yz6245 zabbix-3.0.2]# make && make install

/usr/bin/ld: cannot find -lOpenIPMIposix
collect2: ld returned 1 exit status
make[3]: *** [zabbix_server] Error 1
make[3]: Leaving directory `/data0/zabbix/soft/zabbix-3.0.2/src/zabbix_server‘
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/data0/zabbix/soft/zabbix-3.0.2/src/zabbix_server‘
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/data0/zabbix/soft/zabbix-3.0.2/src‘
make: *** [all-recursive] Error 1
You have mail in /var/spool/mail/root
解决:
[root@yz6245 zabbix-3.0.2]# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --enable-java --with-mysql=/usr/local/mysql55/bin/mysql_config --
with-jabber=/usr/local/iksemel/ --with-net-snmp --with-libcurl --with-openipmi=/usr/local/OpenIMPI/ --with-unixodbc=/usr/bin/odbc_config
还是不行
最终处理方法:去掉--with-openipmi选项,通过 ?


[root@yz6245 zabbix-3.0.2]# vim /usr/local/zabbix/etc/zabbix_server.conf
[root@yz6245 zabbix-3.0.2]# cp misc/init.d/fedora/core5/zabbix_server /etc/init.d/
[root@yz6245 zabbix-3.0.2]# cp misc/init.d/fedora/core5/zabbix_agentd /etc/init.d/
[root@yz6245 zabbix-3.0.2]# chkconfig --add zabbix_server
[root@yz6245 zabbix-3.0.2]# chkconfig --add zabbix_agentd

问题:
[root@yz6245 zabbix-3.0.2]# /etc/init.d/zabbix_server start
Starting Zabbix Server: /usr/local/zabbix/sbin/zabbix_server: error while loading shared libraries: libiksemel.so.3: cannot open shared object file: No such file or
directory
[FAILED]
解决:
[root@yz6245 zabbix-3.0.2]# updatedb
[root@yz6245 zabbix-3.0.2]# locate libiksemel.so.3
/data0/zabbix/soft/iksemel-1.4/src/.libs/libiksemel.so.3
/data0/zabbix/soft/iksemel-1.4/src/.libs/libiksemel.so.3.1.1
/usr/local/iksemel/lib/libiksemel.so.3
/usr/local/iksemel/lib/libiksemel.so.3.1.1
[root@yz6245 sbin]# ln -s /usr/local/iksemel/lib/libiksemel.so.3 /usr/lib64/
[root@yz6245 sbin]# ln -s /usr/local/lib/libiconv.so.2 /usr/lib64/
[root@yz6245 sbin]# /etc/init.d/zabbix_server start
Starting Zabbix Server: [ OK ]

[root@yz6245 sbin]# vim /etc/init.d/zabbix_agentd
[root@yz6245 sbin]# /etc/init.d/zabbix_agentd start
Starting Zabbix Agent: [ OK ]

安装:fping工具包
[root@yz6245 soft]# tar zxvf fping-3.8.tar.gz
[root@yz6245 soft]# cd fping-3.8
[root@yz6245 fping-3.8]# ./configure --prefix=/usr/local/fping;make ;make install

Install

Congratulations! You have successfully installed Zabbix frontend.
Configuration file "/usr/local/nginx/html/zabbix/conf/zabbix.conf.php" created.

zabbix agent 安装:
安装依赖
[root@yz3110 soft]# yum -y install gcc make glibc-static libstdc++-static
[root@yz3110 soft]# tar zxvf zabbix-3.0.2.tar.gz
[root@yz3110 soft]# cd zabbix-3.0.2
[root@yz3110 zabbix-3.0.2]# ./configure --prefix=/usr/local/zabbix --enable-agent --enable-static && make
[root@yz3110 zabbix-3.0.2]# strip -s ./src/zabbix_agent/zabbix_agentd
[root@yz3110 zabbix-3.0.2]# /usr/local/zabbix/sbin/zabbix_agentd -V
zabbix_agentd (daemon) (Zabbix) 3.0.2
Revision 59540 20 April 2016, compilation time: May 10 2016 22:40:28

zabbix部署

标签:

原文地址:http://www.cnblogs.com/liyongsan/p/5484244.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!