前文再续,书接上一回。

    上一篇讲的是AIX 6.1操作系统的安装,可是胡哥的任务还没完成呀,老板需要的是zabbix agent的编译安装。既然需要编译,那怎么能少gcc这个编译利器呢?工欲善其事必先利其器,咱们先来安装gcc吧。(可从http://www.bullfreeware.com/或https://www.ibm.com/developerworks/aix/library/aix-toolbox/alpha.html#L 下载RPM包)

    我们用xshell的这个功能上传到AIX系统

image.png

#rpm -ivh gcc-4.2.0-1.aix6.1.ppc.rpm

image.png

这里gcc已经安装好了,很简单吧。

接下来,我们将解压好的zabbix-3.4.10也上传到AIX系统上,进行开始编译。

#cd /tmp/zabbix-3.4.10;chmod u+x configure

#./configure --prefix=/usr/local/zabbix --enable-agent

image.png

hecking for libpcre support... no

configure: error: Unable to use libpcre (libpcre check failed)

哦?报了一个libcpre的错误。嗯嗯,根据经验,是pcre没有安装,那么就下载pcre和相关的依赖RPM包吧。

。。。。。。终于找齐了

首先要安装了这个gettext,否则安装bash会报错

#rpm -ivh gettext-0.19.8-1.aix6.1.ppc.rpm --nodeps

image.png

rpm -ivh pcre-8.34-1.aix6.1.ppc.rpm bzip2-1.0.6-2.aix6.1.ppc.rpm zlib-1.2.11-1.aix6.1.ppc.rpm readline-6.3-1.aix6.1.ppc.rpm readline-devel-6.3-1.aix6.1.ppc.rpm info-5.0-2.aix6.1.ppc.rpm bash-4.4-3.aix6.1.ppc.rpm libiconv-1.14-22.aix6.1.ppc.rpm

image.png

我们再次来configure一下吧

#./configure --prefix=/usr/local/zabbix --enable-agent

image.png

还是报这个错误??应该缺了devel的开发包,GO,去下载,然后安装

rpm -ivh pcre-devel-8.34-1.aix6.1.ppc.rpm

image.png

再来configure一下

#./configure --prefix=/usr/local/zabbix --enable-agent

蹭蹭蹭。哈哈,还是挺顺利的嘛

image.png

接下来就make一下啦

#make

image.png

WARNING: 'aclocal-1.15' is missing on your system.

         You should only need it if you modified 'acinclude.m4' or

         'configure.ac' or m4 files included by 'configure.ac'.

         The 'aclocal' program is part of the GNU Automake package:

         <http://www.gnu.org/software/automake>

         It also requires GNU Autoconf, GNU m4 and Perl in order to run:

         <http://www.gnu.org/software/autoconf>

         <http://www.gnu.org/software/m4/>

         <http://www.perl.org/>

???什么鬼?应该也是缺少某个命令或lib库。好吧,百度一下(可恶不能用谷歌)

下载了一些RPM包去尝试安装,再来make一下

#rpm -ivh autoconf-2.65-1.aix6.1.noarch.rpm automake-1.15-1.aix6.1.noarch.rpm m4-1.4.14-1.aix6.1.ppc.rpm

image.png

#make

image.png

什么鬼?还是报这个错误,不是明明已经安装了了吗?忍痛,继续百度。。。。。

找到了这个命令,在编译的文件夹目录里执行

#autoreconf -ivf

再来make

#make

image.png

./configure[7961]: syntax error at line 9102 : `(' unexpected

 cd . && /bin/sh ./config.status Makefile

config.status: creating Makefile

 cd ../../.. && /bin/sh ./config.status src/libs/zbxcrypto/Makefile depfiles

config.status: creating src/libs/zbxcrypto/Makefile

config.status: executing depfiles commands

        gcc -DHAVE_CONFIG_H -I. -I../../../include     -g -O2  -MT libzbxcrypto_a-md5.o -MD -MP -MF .deps/libz

bxcrypto_a-md5.Tpo -c -o libzbxcrypto_a-md5.o `test -f 'md5.c' || echo './'`md5.cIn file included from /usr/include/sys/corral.h:25,

                 from /usr/include/libperfstat.h:28,

                 from ../../../include/sysinc.h:292,

                 from ../../../include/common.h:23,

                 from md5.c:54:

/usr/include/netinet/in6_var.h:65: error: array type has incomplete element type

make: 1254-004 The error code from the last command is 1.

 

 

Stop.

make: 1254-004 The error code from the last command is 1.

 

 

Stop.

make: 1254-004 The error code from the last command is 1.

 

 

Stop.

make: 1254-004 The error code from the last command is 1.

 

 

Stop.


纳尼~~~~原来那个错误没有了,可是还有新的报错。内心那个奔溃呀。

看报错的信息,是在configure文件的9102行,未识别(,这个左括号?

带着好奇,将configure传到win10环境,使用editplus去查看

image.png

                   PKG_CHECK_MODULES(IKSEMEL,iksemel,

 

                             JABBER_INCDIR="$IKSEMEL_CPPFLAGS"

                             JABBER_LIBDIR="$IKSEMEL_LDFLAGS"

                             JABBER_LIBS="-liksemel"

                            ,

                             found_iksemel="no"

                             found_jabber="no"

                            )

就是这行了,嗯嗯。怎么多了一个空行?还多个参数分行了?再想一下。。。报的是(这个错误,会不会是。。。。。。

image.png

看到红框框没,其他地方都用{呀,这里咋用(?带着试试的心理,将()改成了{},并将多行的参数改成一行,效果如下

image.png

PKG_CHECK_MODULES{IKSEMEL,iksemel,JABBER_INCDIR="$IKSEMEL_CPPFLAGS",JABBER_LIBDIR="$IKSEMEL_LDFLAGS",JABBER_LIBS="-liksemel",found_iksemel="no",found_jabber="no"}

保存,传回AIX系统,覆盖它吧,再来make一下

#make

image.png

        gcc -DHAVE_CONFIG_H -I. -I../../../include     -g -O2  -MT libzbxcrypto_a-md5.o -MD -MP -MF .deps/libz

bxcrypto_a-md5.Tpo -c -o libzbxcrypto_a-md5.o `test -f 'md5.c' || echo './'`md5.cIn file included from /usr/include/sys/corral.h:25,

                 from /usr/include/libperfstat.h:28,

                 from ../../../include/sysinc.h:292,

                 from ../../../include/common.h:23,

                 from md5.c:54:

/usr/include/netinet/in6_var.h:65: error: array type has incomplete element type

make: 1254-004 The error code from the last command is 1.

 

 

Stop.

make: 1254-004 The error code from the last command is 1.

 

 

Stop.

make: 1254-004 The error code from the last command is 1.

 

 

Stop.

make: 1254-004 The error code from the last command is 1.

 

 

Stop.

请允许我吐一下血。。。。。。那个报错没了,又来新的报错。。。。内心那个奔。。。溃。。。

但是革命尚未成功成功。同志!仍需努力。

仔细看看报错

image.png

可能是这个两个文件出问题,去试试吧(同样,拷贝到win10环境查看,以下将默认在此环境查看)

打开sysinc.h文件,查看第292行。。。思考中。。。可能是缺少include某个库文件吧,可恶的百度。。。

增加了<sys/protosw.h>,并传回去覆盖试试make

image.png

又来。。。。

image.png

cpu.c: In function 'SYSTEM_CPU_NUM':

cpu.c:29: error: 'perfstat_partition_config_t' undeclared (first use in this function)

cpu.c:29: error: (Each undeclared identifier is reported only once

cpu.c:29: error: for each function it appears in.)

cpu.c:29: error: expected ';' before 'part_cfg'

cpu.c:47: error: 'part_cfg' undeclared (first use in this function)

这是什么鬼呀。。。。这么多报错。。。难怪zabbix自从2.X以后都没出预编译的agent了

我想安静一下。。。。

看这个报错,估计是没识别CPU集吧

#find ./ -name cpu.c

image.png

找到了,打开看看吧

报错说'perfstat_partition_config_t' 未定义,我注释掉可不可以?试试吧

image.png

make一下

image.png


cpu.c: In function 'SYSTEM_CPU_NUM':

cpu.c:47: error: 'part_cfg' undeclared (first use in this function)

cpu.c:47: error: (Each undeclared identifier is reported only once

cpu.c:47: error: for each function it appears in.)

cpu.c:47: error: 'perfstat_partition_config_t' undeclared (first use in this function)

第47行报错,再注释

image.png

再报错

image.png


cpu.c: In function 'SYSTEM_CPU_NUM':

cpu.c:55: error: 'part_cfg' undeclared (first use in this function)

cpu.c:55: error: (Each undeclared identifier is reported only once

cpu.c:55: error: for each function it appears in.)

再注释

image.png

make一下。。。。。看着屏幕的跳转。。。就如在绝对黑暗中看了了一束光。。。。

image.png

make过去啦。。。。。

那还不赶紧make install

#make install

image.png

也install了。。。内心那个“鸡冻”

试试启动agent吧

#/usr/local/zabbix/sbin/zabbix_agentd -c /usr/local/zabbix/etc/zabbix_agentd.conf

image.png

用户不存在,这个好办,add一下

#useradd zabbix

#/usr/local/zabbix/sbin/zabbix_agentd -c /usr/local/zabbix/etc/zabbix_agentd.conf

#ps aux | grep zabbix | grep -v grep

image.png

Celebrate


此实验并非这么顺利,其中遇到很多“坑”,下一篇将介绍一下踩过的“坑”


------------------------------------------------------------------------------------美丽的分割线

本实验参考了以下资料:

https://blog.csdn.net/arackethis/article/details/42222905

https://blog.csdn.net/frank0521/article/details/7542884

本文涉及的RPM包可通过以下链接下载:

链接:https://pan.baidu.com/s/1HCbwj_rEjsXUu6FeuFOQTw 密码:rqmr

RPM包一览表

autoconf-2.65-1.aix6.1.noarch.rpm
automake-1.15-1.aix6.1.noarch.rpm
bash-4.4-3.aix6.1.ppc.rpm
bzip2-1.0.6-2.aix6.1.ppc.rpm
gcc-4.2.0-1.aix6.1.ppc.rpm
gettext-0.19.8-1.aix6.1.ppc.rpm
info-5.0-2.aix6.1.ppc.rpm
libiconv-1.14-22.aix6.1.ppc.rpm
m4-1.4.14-1.aix6.1.ppc.rpm
pcre-8.34-1.aix6.1.ppc.rpm
pcre-devel-8.34-1.aix6.1.ppc.rpm
readline-6.3-1.aix6.1.ppc.rpm
readline-devel-6.3-1.aix6.1.ppc.rpm
zlib-1.2.11-1.aix6.1.ppc.rpm