Old stories/Unix&Linux

OpenSolaris Net-SNMP 설치 (삽질기)

드카니 2010. 3. 4. 15:17

Cacti에 자원 모니터링을 등록하기 위하여 OpenSolaris를 설치한 신규 서버에 Net-SNMP 설치를 진행하였다.
기본 Package가 제공되지 않는 관계로.. 사이트(http://net-snmp.sourceforge.net/)에서 소스를 받아서 Compile 해야 된다.. 불편하다... Centos는 걍 yum으로 설치만하면 땡인데...

OpenSolaris 기본 설치 및 Package Update를 진행 후 다음 사이트를 참조하여 설치를 진행하였다.

http://wiki.csclub.uwaterloo.ca/OpenSolaris#SNMP

진행중 make를 하는데 다음과 같은 에러가...

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LC_ALL = (unset),
        LANG = "ko_KR.eucKR"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
cc -c    -I../../include -g -O2 -Usolaris2 -Dsolaris2=solaris2 -I. -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TS_ERRNO -xO3 -xspace -xildoff    -DVERSION=\"5.04021\"  -DXS_VERSION=\"5.04021\" -KPIC "-I/usr/perl5/5.8.4/lib/i86pc-solaris-64int/CORE"   default_store.c
cc: unrecognized option `-KPIC'
cc: language ildoff not recognized
cc: default_store.c: linker input file unused because linking not done
rm -f ../blib/arch/auto/NetSNMP/default_store/default_store.so
LD_RUN_PATH="/export/home/admin/download/net-snmp-5.4.2.1/perl/default_store/../../snmplib/.libs:/lib" cc  -G default_store.o  -o ../blib/arch/auto/NetSNMP/default_store/default_store.so   -L/export/home/admin/download/net-snmp-5.4.2.1/perl/default_store/../../snmplib/.libs -L/export/home/admin/download/net-snmp-5.4.2.1/perl/default_store/../../snmplib -lnetsnmp -lgen -lelf -lnsl -lsocket  
cc: default_store.o: No such file or directory
*** Error code 1
make: Fatal error: Command failed for target `../blib/arch/auto/NetSNMP/default_store/default_store.so'
Current working directory /export/home/admin/download/net-snmp-5.4.2.1/perl/default_store
*** Error code 1
The following command caused the error:
cd default_store && make -f Makefile all LIB="" LIBPERL_A="libperl.a" LINKTYPE="dynamic" PREFIX="" OPTIMIZE="-xO3 -xspace -xildoff" PASTHRU_DEFINE="" PASTHRU_INC=""
make: Fatal error: Command failed for target `subdirs'
Current working directory /export/home/admin/download/net-snmp-5.4.2.1/perl
*** Error code 1
The following command caused the error:
(cd perl ; make LD_RUN_PATH="/usr/local/lib:`/usr/bin/perl -e 'use Config; print qq($Config{archlibexp}/CORE);'`") ; \
        if test $? != 0 ; then \
           exit 1 ; \
        fi
make: Fatal error: Command failed for target `perlmodules'

일단 locale을 변경하고... (export LANG=C) 구글 사마에 도움을 청하니.. 다음의 사이트를 발견하였다.

https://72.5.123.5/jive/thread.jspa?threadID=122320&tstart=150

기본 설치된 Perl로는 설치 진행이 불가한듯..

최신 버전의 Perl을 다운로드 한 후에 사이트에 Posting되어 있는 대로 설치를 진행하였다.

~/download/perl-5.10.1# sh Configure -Dcc=gcc -Dprefix=/usr/local/net-snmp -Uinstallusrbinperl \
-Duseshrplib -Dcf_email=your_email@your_domain \
-Dperladmin=your_email@your_domain -Uuselargefiles -de

설정 후에 config.sh를 확인하라는 내용이 있는데 내용 확인 결과 약간의 차이가 있는듯..

"-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" --> 요 부분을 확인하라는데...

cppsymbols='__ELF__=1 _FILE_OFFSET_BITS=32 __GNUC__=3 __GNUC_MINOR__=4 _ILP32= _LARGEFILE64_SOURCE=1 _LARGEFILE_SOURCE=1 _LITTLE_ENDIAN= __STDC__=1 __SVR4=1 i386=1 __i386=1 __i386__=1 sun=1 __sun=1 __sun__=1 __svr4__=1 unix=1 __unix=1 __unix__=1' --> 다르다.. ㅡ.ㅡ;;; 걍 무시하고 진행...

make && make test (시간 오래 걸림..) && make install

다음 Net-SNMP를 설치를 다음과 같이 설정..

env PERLPROG=/usr/local/net-snmp/bin/perl ./configure --enable-embedded-perl \
--with-out-mib-modules=ucd-snmp/lmSensors \
--with-mib-modules=ucd-snmp/diskio,smux,mibII/mta_sendmail \
--with-cc=gcc 

lmSensors는 Linux 모니터링용이란다..

다음.. Compile.. 및 설치..

make

젠장 오류다...

ld: warning: file /export/home/admin/download/net-snmp-5.4.2.1/agent/helpers/.libs/libnetsnmphelpers.so: linked to helpers/.libs/libnetsnmphelpers.so: attempted multiple inclusion of file
ld: warning: file /export/home/admin/download/net-snmp-5.4.2.1/agent/.libs/libnetsnmpagent.so: linked to ./.libs/libnetsnmpagent.so: attempted multiple inclusion of file
ld: warning: file ../snmplib/.libs/libnetsnmp.so: linked to /export/home/admin/download/net-snmp-5.4.2.1/snmplib/.libs/libnetsnmp.so: attempted multiple inclusion of file
Undefined                       first referenced
 symbol                             in file
netsnmp_arch_interface_container_load ./.libs/libnetsnmpmibs.so
netsnmp_arch_interface_index_find   ./.libs/libnetsnmpmibs.so
netsnmp_arch_set_admin_status       ./.libs/libnetsnmpmibs.so
netsnmp_arch_interface_init         ./.libs/libnetsnmpmibs.so
ld: fatal: symbol referencing errors. No output written to .libs/snmpd
collect2: ld returned 1 exit status
*** Error code 1
make: Fatal error: Command failed for target `snmpd'
Current working directory /export/home/admin/download/net-snmp-5.4.2.1/agent
*** Error code 1
The following command caused the error:
if test "snmplib  agent apps man local mibs" != ""; then \
        it="snmplib  agent apps man local mibs" ; \
        for i in $it ; do \
                echo "making all in `pwd`/$i"; \
                ( cd $i ; make ) ; \
                if test $? != 0 ; then \
                        exit 1 ; \
                fi  \
        done \
fi
make: Fatal error: Command failed for target `subdirs'


위에 Perl 설정 부분을 무시해서 그런가.. 다시 Perl부터 재 설정 및 설치.. 역시 같은 오류가 떨어진다.. 망할...

흠.. Net-SNMP 버전을 바꺼서 시도해 봤다.. (5.4.2.1 --> 5.5)

어...어... 몇 가지 warning이 뜨긴하지만..  Compile 성공이다...

헐 .. 테스트도 해봤다.. (make test) ... 잘 된다...

Perl v5.10.1 // Net-SNMP v5.5 가 궁합이 맞군..

설치까지 완료.. (make install)

이제 snmpd.conf 파일을 생성한다..

# /usr/local/bin/snmpconf
...
해당 내역을 설정해줌..
....

다음은 서비스에 등록을 해 주기 위해서 다시 다음 사이트를 참조한다.

http://wiki.csclub.uwaterloo.ca/OpenSolaris#SNMP
의 net-snmp.xml 생성 및 svccfg import 부분, /lib/svc/method/svc-net-snmp 생성 부분까지..

이제 최종 설정을 확인 후 서비스를 활성해 시켜 준다.

# svcadm enable net-snmp

정상적으로 동작하는지 확인..

# /usr/local/bin/snmpwalk -c COMMUNITY -v SNMP_VERSION localhost

끝...
반응형