[转帖]安装zabbix-2.2.5 _MySQL, Oracle及数据库讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  MySQL, Oracle及数据库讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 1875 | 回复: 0   主题: [转帖]安装zabbix-2.2.5         下一篇 
xicheng.liu
注册用户
等级:中尉
经验:498
发帖:14
精华:0
注册:1970-1-1
状态:离线
发送短消息息给xicheng.liu 加好友    发送短消息息给xicheng.liu 发消息
发表于: IP:您无权察看 2018-8-24 15:21:54 | [全部帖] [楼主帖] 楼主

#wget http://downloads.sourceforge.net/project/zabbix/ZABBIX Latest Stable/2.2.5/zabbix-2.2.5.tar.gz?r=http://www.zabbix.com/download.php&ts=1409107559&use_mirror=jaist


下载zabbix-2.2.5.tar.gz安装包

 #tar -zxvf zabbix-2.2.5.tar.gz
#cd zabbix-2.2.5
#sh ./configure --prefix=/usr/local/zabbix/ -enable-server -enable-agent -with-mysql -with-net-snmp -with-libcurl -with-libxml2
#sh ./configure --prefix=/usr/local/zabbix/ -enable-agent
#make && make install


现在zabbix就被安装到了/usr/local/zabbix-2.2.5/
下面需要创建zabbix用户和初始化数据库。

 # groupadd zabbix
# useradd -g zabbix zabbix -s /sbin/nologin
#初始化数据库
# mysql -uroot -p
#mysql> create database zabbix;
mysql> grant all privileges on zabbix.* to zabbix@’%’ identified by ‘zabbix123′;
# mysql -uroot -p zabbix < database/mysql/schema.sql
# mysql -uroot -p zabbix < database/mysql/images.sql
# mysql -uroot -p zabbix < database/mysql/data.sql


修改zabbix的配置文件。

# cat /usr/local/zabbix-2.2.5/etc/zabbix_server.conf | egrep -v '^#|^$'
LogFile=/tmp/zabbix_server.log
DBHost=192.168.11.28
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix123
DBPort=3306
[root@localhost zabbix-2.2.5]# cat /usr/local/zabbix-2.2.5/etc/zabbix_agentd.conf | egrep -v '^#|^$'
LogFile=/tmp/zabbix_agentd.log
Server=127.0.0.1 //被动接受这个服务器的监控数据提取
ServerActive=127.0.0.1 //主动发送监控数据到这个服务器
Hostname=Zabbix server
# /usr/local/zabbix-2.2.5/sbin/zabbix_server
# /usr/local/zabbix-2.2.5/sbin/zabbix_agentd


可以通过/tmp/zabbix*的log文件调试服务器和客户端运行情况.如果启动成功,服务会监听端口的。

 # netstat -tulnp | grep zabbix
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 18235/zabbix_agentd
tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 18127/zabbix_server


到此zabbix就安装完成了。

安装zabbix使出错

1、 checking for mysql_config... /usr/bin/mysql_config checking for main in -lmysqlclient ... no configure: error: Not found mysqlclient library 解决: 确认安装了mysql mysql-devel mysql-server 包 查找系统内有没有 libmysqlclient.so  有的yum安装的mysql没有这个文件,需要自行链接一下 cd /usr/lib/mysql/ [root@test mysql]# ln -s libmysqlclient.so.15.0.0 libmysqlclient.so [root@test mysql]# ln -s libmysqlclient_r.so.15.0.0 libmysqlclient_r.so 网上有些资料说的是64位的,注意识别 2、 In file included from ../../../include/db.h:25,                  from db.c:22: ../../../include/zbxdb.h:67:20: error: mysql.h: No such file or directory ../../../include/zbxdb.h:68:21: error: errmsg.h: No such file or directory ../../../include/zbxdb.h:69:27: error: mysqld_error.h: No such file or directory In file included from ../../../include/db.h:25,                  from db.c:22: ../../../include/zbxdb.h:71: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token ../../../include/zbxdb.h:174: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token ../../../include/zbxdb.h:175: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token ../../../include/zbxdb.h:177: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘zbx_db_fetch’ In file included from db.c:22: ../../../include/db.h:546: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token ../../../include/db.h:548: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token ../../../include/db.h:549: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘DBfetch’ ../../../include/db.h:586: error: expected declaration specifiers or ‘...’ before ‘MYSQL_ROW’ db.c:34: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token db.c: In function ‘zbx_db_connect’: db.c:119: error: ‘conn’ undeclared (first use in this function) db.c:119: error: (Each undeclared identifier is reported only once db.c:119: error: for each function it appears in.) db.c:121: error: ‘CLIENT_MULTI_STATEMENTS’ undeclared (first use in this function) db.c:145: error: ‘CR_CONN_HOST_ERROR’ undeclared (first use in this function) db.c:146: error: ‘CR_SERVER_GONE_ERROR’ undeclared (first use in this function) db.c:147: error: ‘CR_CONNECTION_ERROR’ undeclared (first use in this function) db.c:148: error: ‘CR_SERVER_LOST’ undeclared (first use in this function) db.c:149: error: ‘ER_SERVER_SHUTDOWN’ undeclared (first use in this function) db.c:150: error: ‘ER_ACCESS_DENIED_ERROR’ undeclared (first use in this function) db.c:151: error: ‘ER_ILLEGAL_GRANT_FOR_TABLE’ undeclared (first use in this function) db.c:152: error: ‘ER_TABLEACCESS_DENIED_ERROR’ undeclared (first use in this function) db.c:153: error: ‘ER_UNKNOWN_ERROR’ undeclared (first use in this function) db.c: In function ‘zbx_db_close’: db.c:350: error: ‘conn’ undeclared (first use in this function) db.c: At top level: db.c:409: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token db.c: In function ‘zbx_db_vexecute’: db.c:656: error: ‘conn’ undeclared (first use in this function) db.c:668: error: ‘CR_CONN_HOST_ERROR’ undeclared (first use in this function) db.c:669: error: ‘CR_SERVER_GONE_ERROR’ undeclared (first use in this function) db.c:670: error: ‘CR_CONNECTION_ERROR’ undeclared (first use in this function) db.c:671: error: ‘CR_SERVER_LOST’ undeclared (first use in this function) db.c:672: error: ‘ER_SERVER_SHUTDOWN’ undeclared (first use in this function) db.c:673: error: ‘ER_ACCESS_DENIED_ERROR’ undeclared (first use in this function) db.c:674: error: ‘ER_ILLEGAL_GRANT_FOR_TABLE’ undeclared (first use in this function) db.c:675: error: ‘ER_TABLEACCESS_DENIED_ERROR’ undeclared (first use in this function) db.c:676: error: ‘ER_UNKNOWN_ERROR’ undeclared (first use in this function) db.c: At top level: db.c:825: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token db.c:1124: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token db.c:1139: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘zbx_db_fetch’ make[3]: *** [db.o] Error 1 make[3]: Leaving directory `/tmp/zabbix-1.8.4/src/libs/zbxdb' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/tmp/zabbix-1.8.4/src/libs' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/tmp/zabbix-1.8.4/src' make: *** [all-recursive] Error 1 解决: zabbix编译时找不到mysql.h文件 需要安装 mysql-devel 包 yum install mysql-devel 2、 configure: error: SQLite3 library not found 解决: 自己编译一个sqlite3再指定 --with-sqlite3=/usr/local/app/tools/sqlite3 3、 ../../../include/sysinc.h:383:24: error: curl/curl.h: No such file or directory make[3]: *** [md5.o] Error 1 解决: 加环境变量 base_dir=/usr/local/app/tools export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/app/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/local/app/libxml2/bin:/usr/local/app/ruby/bin:/usr/kerberos/bin:/usr/local/app/mysql/bin:/home/kingnet/bin:/usr/local/app/tools/libxml2/bin:/usr/local/app/tools/sqlite3/bin:/usr/local/app/tools/ruby/bin:/usr/kerberos/bin:/usr/local/app/tools/mysql/bin:/home/kingnet/bin:/usr/local/app/tools/mysql/bin export LD_LIBRARY_PATH=/usr/local/app/tools/libevent/lib:/usr/local/app/tools/sqlite3/lib:/usr/local/app/tools/zlib/lib:/usr/local/app/tools/bzip2/lib:/usr/local/app/tools/mysql/lib/mysql:/usr/local/app/tools/logserver/lib:/usr/local/app/tools/tokyocabinet/lib:/usr/local/app/tools/tokyotyrant/lib:/usr/local/app/tools/curl/lib export C_INCLUDE_PATH=$base_dir/curl/include export CPLUS_INCLUDE_PATH=$base_dir/curl/include

解决zabbix安装出现php databases support off,报错

使用yum解决依赖关系

yum install -y php-mysql.x86_64


重启apche服务和sql服务

如果不重启的话下一步连接sql会报错,即使你的帐号密码都是对的

六、启动Server

1、安装完成后的server程序在目录下,可以直接启动 #/opt/zabbix-2.0.9/sbin/zabbix_server 2、将程序注册为服务 (1)复制配置文件 # cp /opt/zabbix-2.0.9/misc/init.d/fedora/core/zabbix_* /etc/init.d/ 修改配置文件/etc/init.d/zabbix_server和/etc/init.d/zabbix_agentd。

修改:zabbix_server # Zabbix-DirectoryBASEDIR=/opt/zabbix-2.0.9 # custom VariableCONFILE=/etc/zabbix/zabbix_server.conf # functionsstart() {if [ $RUNNING -eq 1 ]    then     echo "$0 $ARG: $BINARY_NAME (pid $PID) already running"else    action $"Starting $BINARY_NAME: " $FULLPATH -c $CONFILE    touch /var/lock/subsys/$BINARY_NAME    fi}

修改:zabbix_agentd # Zabbix-Directory BASEDIR=/opt/zabbix-2.0.9

3、加入开机启动 # echo '/etc/init.d/zabbix_server start &' >>/etc/rc # echo '/etc/init.d/zabbix_agentd start &' >>/etc/rc 4、创建快键方式 # ln -s /etc/init.d/zabbix_server /usr/bin/zabbix_server # ln -s /etc/init.d/zabbix_agentd /usr/bin/zabbix_agentd 5、启动Server和Agentd(可以通过start stop restart来操作) # zabbix_server start # zabbix_agentd start 6、检查启动是否正常,查看进程是否起来,分server和agentd #ps -ef|grep zabbix 如果进程没起来,可以查看对应的日志错误,默认在/tmp/zabbix-*.log 至此Zabbix Server的安装已完成,重启

七、开启zabbix_server监控 http://127.0.0.1/zabbix配置->主机->列表: Zabbix Server 在状态栏开启monitor即可。

八、问题: 1、cannot send list of active checks to [127.0.0.1]: host [Zabbix server] not monitored     在监控中显示Zabbix状态:Zabbix服务端运行中 值是NO(不) 解决方法:(1)检查端口是否已开启 (2)检查是否已打开防火墙,已打开,请加例外, 或者关闭防火墙(3)服务端的主机名必须与客户端Hostname一样 (4)关闭SELinux(Security Enhanced Linux[安全加強的 Linux])     gedit /etc/sysconfig/selinux    修改为:SELINUX=disabled




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论