设为首页 收藏本站
查看: 1029|回复: 0

[经验分享] zabbix部署

[复制链接]
累计签到:10 天
连续签到:1 天
发表于 2016-6-26 19:13:54 | 显示全部楼层 |阅读模式
安装前准备:
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/archi ... sql-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/j ... -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 ... projects%2Fopenipmi
%2F&ts=1401936534&use_mirror=superb-dca3
wget --limit-rate 500k http://www.fping.org/dist/fping-3.8.tar.gz

安装MYSQL

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

[iyunv@yz6245 soft]# tar zxvf mysql-5.6.5-m8.tar.gz
[iyunv@yz6245 soft]# cd mysql-5.6.5-m8
[iyunv@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
[iyunv@yz6245 mysql-5.6.5-m8]# make && make install
[iyunv@yz6245 mysql-5.6.5-m8]# useradd -s /sbin/nologin mysql
[iyunv@yz6245 mysql-5.6.5-m8]# cp support-files/my-large.cnf /etc/my.cnf
[iyunv@yz6245 mysql]# cd /data0/mysql
[iyunv@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/
[iyunv@yz6245 mysql]# chkconfig --add mysql.server
[iyunv@yz6245 mysql]# service mysql.server start

问题:
[iyunv@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/
[iyunv@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

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

安装nginx
[iyunv@yz6245 soft]# tar zxvf nginx-1.2.9.tar.gz
[iyunv@yz6245 soft]# cd nginx-1.2.
[iyunv@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.
解决:
[iyunv@yz6245 nginx-1.2.9]# yum -y install pcre-devel


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

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

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

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

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

准备数据库:
[iyunv@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)

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

安装UnixODBC
[iyunv@yz6245 zabbix-3.0.2]# yum -y install unixODBC unixODBC-devel
[iyunv@yz6245 zabbix-3.0.2]# yum -y install mysql-connector-odbc
[iyunv@yz6245 zabbix-3.0.2]# vim /etc/odbcinst.ini #不用修改,默认即可
[iyunv@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软件包
[iyunv@yz6245 zabbix-3.0.2]# id zabbix
uid=579(zabbix) gid=580(zabbix) groups=580(zabbix)
[iyunv@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
[iyunv@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
解决:
[iyunv@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选项,通过 ?


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

问题:
[iyunv@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]
解决:
[iyunv@yz6245 zabbix-3.0.2]# updatedb
[iyunv@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
[iyunv@yz6245 sbin]# ln -s /usr/local/iksemel/lib/libiksemel.so.3 /usr/lib64/
[iyunv@yz6245 sbin]# ln -s /usr/local/lib/libiconv.so.2 /usr/lib64/
[iyunv@yz6245 sbin]# /etc/init.d/zabbix_server start
Starting Zabbix Server: [ OK ]

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

安装:fping工具包
[iyunv@yz6245 soft]# tar zxvf fping-3.8.tar.gz
[iyunv@yz6245 soft]# cd fping-3.8
[iyunv@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 安装:
安装依赖
[iyunv@yz3110 soft]# yum -y install gcc make glibc-static libstdc++-static
[iyunv@yz3110 soft]# tar zxvf zabbix-3.0.2.tar.gz
[iyunv@yz3110 soft]# cd zabbix-3.0.2
[iyunv@yz3110 zabbix-3.0.2]# ./configure --prefix=/usr/local/zabbix --enable-agent --enable-static && make
[iyunv@yz3110 zabbix-3.0.2]# strip -s ./src/zabbix_agent/zabbix_agentd
[iyunv@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

转载自博客园http://www.cnblogs.com/liyongsan/p/5484244.html


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-235589-1-1.html 上篇帖子: zabbix 3.0.3 agent 日志报错 下篇帖子: zabbix Event acknowledgment事件确认 软件包
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表