Chinaunix首页 | 论坛 | 博客
  • 博客访问: 437418
  • 博文数量: 78
  • 博客积分: 2030
  • 博客等级: 大尉
  • 技术积分: 1002
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-28 15:25
文章分类

全部博文(78)

文章存档

2012年(1)

2011年(1)

2010年(4)

2009年(12)

2008年(60)

我的朋友

分类: LINUX

2008-10-30 17:54:44

net-snmp 5.3.2 for embedded

compile:

cross compile using following method

./configure
 --------------------------------------------
 #these paras can be treated by openwrt source tree
     CC=mips-linux-uclibc-gcc \
            CPP=mips-linux-uclibc-cpp \
            AR=mips-linux-uclibc-ar \
            STRIP=mips-linux-uclibc-strip \
            RANLIB=mips-linux-uclibc-ranlib\
            LD=mips-linux-uclibc-ld \
 ----------------------------------
    --prefix=/home/river/netsnmp/lib \
    --with-transports="UDP" \
    --with-logfile="/var/log/snmpd.log" \
    --with-sys-location="shanghai" \
    --with-sys-contact="" \
    --with-persistent-directory="/var/net-snmp" \
    --with-default-snmp-version="2" \
    --with-ldflags=-static \
    --with-endianness=big  \
    --enable-mini-agent \
    --with-mib-modules="ip-mib" \
    --disable-mib-loading   \
    --without-kmem-usage


install:
    snmpd and mibs files are useful for us.
    snmpd is in agent directory.

    mibs files in prefix/share/snmp/mibs
    Don't use the mib files in the source code.
    if you associate the disable-mib-loading para when doing configure. You needn't install the mibs files at all.The

function for mib files is only to convert the numeric numbers into meaningful words.

config files: snmpd.conf
--------------------------------------------------------------------
#       sec.name  source          community
com2sec local     127.0.0.1       public
com2sec mynetwork 0.0.0.0/24      public
#               sec.model  sec.name
group MyRWGroup v1         local
group MyRWGroup v2c        local
group MyRWGroup usm        local
group MyROGroup v1         mynetwork
group MyROGroup v2c        mynetwork
group MyROGroup usm        mynetwork
#           incl/excl subtree                          mask
view all    included  .1                               80
#                context sec.model sec.level match  read   write  notif
access MyROGroup ""      any       noauth    exact  all    none   none
access MyRWGroup ""      any       noauth    exact  all    all    none
# System contact information
syslocation DNI, shanghai.
syscontact Chiangming<>
-------------------------------------------------------------------------

I don't know which is the default directory for this config files. So I using -c para to start the snmpd

running:
 using the following command
 /usr/sbin/snmpd -c /etc/snmp/snmpd.conf

Debugging:
 ./snmpd -f -Le -d
  -f : don't fork
  -Le : log to stderr
  -d : show sent and received SNMP packets

 snmpwalk -v 2c -c public 172.17.144.44 .1.3.6.1.2.1.4
 

 if you don't compile the ip-mib mode into your target. no result will show.  
---------------------------------------------------------------------------------

with more mibs configure it as follows

 --with-mib-modules="ip-mib mymib_init" 

------------------------------------------------------------------------------------

mibs extentions:
 just add .c and .h file into agent/mibgroup. then add your mib module para to
--with-mib-modules. It will be OK! if you find that you can't set value for this node.
It may caused by access problem. you can edit your snmpd.conf. add the write prevelidge for MyROGroup.

Also See the following reference website for more details on mibs extension
 http://www.net-snmp.org/dev/agent/scalar__int_8c-example.html

阅读(2749) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~