2003년 7월 9일 수요일

net-snmp 5.0.8 설치하기

http://www.net-snmp.org/#Documentation
http://www.net-snmp.org/tutorial-5/
http://www.net-snmp.org/FAQ.html

mkdir -p /home/ilashman/local/src
cd /home/ilashman/local/src
(net-snmp-5.0.8.tar.gz 받아서 복사한다.)
tar xzvf net-snmp-5.0.8.tar.gz
cd /home/ilashman/local/src/net-snmp-5.0.8
./configure --prefix=/home/ilashman/local/net-snmp-5.0.8 --with-defaults
make
make install

cd /home/ilashman/local
ln -s net-snmp-5.0.8 net-snmp

~/.bashrc 에 다음 내용을 추가한다.
-----------------------------------
export PATH=$PATH:/home/ilashman/local/net-snmp/bin:/home/ilashman/local/net-snmp/sbin:
-----------------------------------
source ~/.bashrc

/etc/ld.so.conf 에 다음 내용을 추가한다.
-----------------------------------
/home/ilashman/local/net-snmp/lib
-----------------------------------
sudo /sbin/ldconfig


SNMP Perl Module 설치하기.

우선 /home/ilashman/local/perl5 에 perl을 설치해둔다.

cd /home/ilashman/local/src/net-snmp-5.0.8/perl
perl Makefile.PL PREFIX=/home/ilashman/local/perl5
LIBRARY_PATH=$LIBRARY_PATH:/home/ilashman/local/net-snmp/lib make
make install

~/.bashrc 에 다음 내용을 추가한다.
-----------------------------------
export PERL5LIB=$PERL5LIB:/home/ilashman/local/perl5/lib/perl5/5.8.0:/home/ilashman/local/perl5/lib/perl5/site_perl/5.8.0:/home/ilashman/local/perl5/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
-----------------------------------
source ~/.bashrc

local/net-snmp/share/snmp/snmpd.conf 설정파일
-----------------------------------
syslocation     KIDC
syscontact      austin
sysservices     72
agentaddress    161

com2sec         public          localhost       public
com2sec         austin          localhost       austin
com2sec         austin          default         austin

group           public          v1              public
group           austin          usm             austin

access          austin          ""  usm priv    prefix  all none none
access          public          ""  v1  noauth  exact   all none none
access          public          ""  v2c noauth  exact   all none none

view            all included    .1  80

disk            /
disk            /link
disk            /usr
disk            /var
disk            /home
proc            httpd

pass_persist    .1.3.6.1.4.1.11139.100  /home/ilashman/local2/net-snmp-5.1/share/snmp/mserver.pl
-----------------------------------

MIB Tree가 정상인지 확인하는 방법
-----------------------------------
snmptranslate -Tp -IR -m ALL
snmptranslate -Tp -IR -m ALL neowiz
snmptranslate -Tp -IR -m ALL system
등...

snmp request 던지기
-----------------------------------
snmpwalk -v 3 -l authPriv -u austin -A austinpower -X austinpower -c austin -m ALL localhost neowiz

에러 상황 1)
snmpwalk를 실행했을 때. Unknown user라고 나온다면?
/var/net-snmp/snmpd.conf 파일을 수정해야 한다. (net-snmp-script 등의 도움을 받을 것, 그리고 root 권한이 필요하다.)

에러 상황 2)
/tmp/에 있는 mondy의 log 파일에 다음 에러가 난다면?
--------------------------------------
Can't locate SNMP.pm in @INC (@INC contains: /austin/local/mondy2/rrd_pet/lib /austin/local/perl5/lib/site_perl/5.8.0 /austin/local/rrdtool/lib/perl /austin/local/perl5/lib/perl5/5.8.0/i386-linux-thread-multi /austin/local/perl5/lib/perl5/5.8.0 /austin/local/perl5/lib/perl5/5.8.0/i386-linux-thread-multi /austin/local/perl5/lib/perl5/5.8.0 /austin/local/perl5/lib/perl5 /austin/local/perl5/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at /austin/local/mondy2/rrd_pet/lib/Monitor.pm line 13.
BEGIN failed--compilation aborted at /austin/local/mondy2/rrd_pet/lib/Monitor.pm line 13.
Compilation failed in require at /austin/local/mondy2/rrd_pet/bin/rrd_update.pl line 7.
BEGIN failed--compilation aborted at /austin/local/mondy2/rrd_pet/bin/rrd_update.pl line 7
-------------------------------------
SNMP.pm 파일은 snmp에 대한 perl module 파일이고
Monitor.pm은 mondy에 대한 perl module파일이다.
두 파일이 crontab에서 환경변수 PERL5LIB에 들어가도록 등록시켜 준다.

댓글 없음:

댓글 쓰기