AIX--zabbix agnet的編譯安裝以及遇到的“坑”
上一篇講的是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系統
#rpm -ivh gcc-4.2.0-1.aix6.1.ppc.rpm |
這裏gcc已經安裝好了,很簡單吧。
接下來,我們將解壓好的zabbix-3.4.10也上傳到AIX系統上,進行開始編譯。
#cd /tmp/zabbix-3.4.10;chmod u+x configure #./configure --prefix=/usr/local/zabbix --enable-agent |
hecking for libpcre support... no configure: error: Unable to use libpcre (libpcre check failed) |
哦?報了一個libcpre的錯誤。嗯嗯,根據經驗,是pcre沒有安裝,那麽就下載pcre和相關的依賴RPM包吧。
。。。。。。終於找齊了
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 |
我們再次來configure一下吧
#./configure --prefix=/usr/local/zabbix --enable-agent |
還是報這個錯誤??應該缺了devel的開發包,GO,去下載,然後安裝
rpm -ivh pcre-devel-8.34-1.aix6.1.ppc.rpm |
再來configure一下
#./configure --prefix=/usr/local/zabbix --enable-agent |
蹭蹭蹭。哈哈,還是挺順利的嘛
接下來就make一下啦
#make |
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 |
#make |
什麽鬼?還是報這個錯誤,不是明明已經安裝了了嗎?忍痛,繼續百度。。。。。
找到了這個命令,在編譯的文件夾目錄裏執行
#autoreconf -ivf |
再來make
#make |
./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去查看
PKG_CHECK_MODULES(IKSEMEL,iksemel,
JABBER_INCDIR="$IKSEMEL_CPPFLAGS" JABBER_LIBDIR="$IKSEMEL_LDFLAGS" JABBER_LIBS="-liksemel" , found_iksemel="no" found_jabber="no" ) |
就是這行了,嗯嗯。怎麽多了一個空行?還多個參數分行了?再想一下。。。報的是(這個錯誤,會不會是。。。。。。
看到紅框框沒,其他地方都用{呀,這裏咋用(?帶著試試的心理,將()改成了{},並將多行的參數改成一行,效果如下
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 |
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. |
請允許我吐一下血。。。。。。那個報錯沒了,又來新的報錯。。。。內心那個奔。。。潰。。。
但是革命尚未成功成功。同誌!仍需努力。
仔細看看報錯
可能是這個兩個文件出問題,去試試吧(同樣,拷貝到win10環境查看,以下將默認在此環境查看)
打開sysinc.h文件,查看第292行。。。思考中。。。可能是缺少include某個庫文件吧,可惡的百度。。。
增加了<sys/protosw.h>,並傳回去覆蓋試試make
又來。。。。
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 |
找到了,打開看看吧
報錯說'perfstat_partition_config_t' 未定義,我註釋掉可不可以?試試吧
make一下
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行報錯,再註釋
再報錯
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.) |
再註釋
make一下。。。。。看著屏幕的跳轉。。。就如在絕對黑暗中看了了一束光。。。。
make過去啦。。。。。
那還不趕緊make install
#make install |
也install了。。。內心那個“雞凍”
試試啟動agent吧
#/usr/local/zabbix/sbin/zabbix_agentd -c /usr/local/zabbix/etc/zabbix_agentd.conf |
用戶不存在,這個好辦,add一下
#useradd zabbix #/usr/local/zabbix/sbin/zabbix_agentd -c /usr/local/zabbix/etc/zabbix_agentd.conf #ps aux | grep zabbix | grep -v grep |
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
AIX--zabbix agnet的編譯安裝以及遇到的“坑”