Chinaunix首页 | 论坛 | 博客
  • 博客访问: 356289
  • 博文数量: 34
  • 博客积分: 2236
  • 博客等级: 大尉
  • 技术积分: 476
  • 用 户 组: 普通用户
  • 注册时间: 2006-02-25 14:36
文章分类

全部博文(34)

文章存档

2016年(2)

2014年(1)

2012年(2)

2011年(3)

2010年(3)

2009年(5)

2008年(9)

2007年(3)

2006年(6)

分类:

2009-10-26 14:58:41

导言,不知是hp unix自带的snmp不好用,还是我太笨了:断断续续折腾了半年都没有折腾出来利用net-snmp对其资源利用的监控,
编译也总是报错,晕人。今天上午一来我就重新下载net-snmp 5.5的源码包编译,没有想到一下就对了,现终结如下:
1 编译对象版本:
    a net-snmp 5.4.x      
    b net-snmp 5.5
2 环境:
    a os:HP-UX SCDB01 B.11.31 U ia64
    b gcc:
      gcc -v
      Using built-in specs.
      Target: ia64-hp-hpux11.31
      Configured with: ../gcc/configure
      Thread model: posix
      gcc version 4.2.3
    c 环境变量 cat .bash_profile
export PATH=/opt/hzjnet/snmpd55/sbin:/opt/hzjnet/snmpd55/bin:/usr/local/bin:\
/usr/local/sbin:/sbin:/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/contrib/bin:\
/usr/contrib/Q4/bin:/opt/perl/bin:/opt/ipf/bin:/opt/gvsd/bin:/opt/nettladm/bin:\
/opt/fcms/bin:/opt/wbem/bin:/opt/wbem/sbin:/opt/sas/bin:/opt/graphics/common/bin:\
/opt/atok/bin:/usr/bin/X11:/usr/contrib/bin/X11:/opt/sec_mgmt/bastille/bin:\
/opt/caliper/bin:/opt/drd/bin:/opt/dsau/bin:/opt/dsau/sbin:/opt/resmon/bin:\
/opt/firefox:/opt/gnome/bin:/usr/contrib/kwdb/bin:/opt/mozilla:/opt/perl_32/bin:\
/opt/perl_64/bin:/opt/prm/bin:/opt/sfm/bin:/opt/swm/bin:/opt/sec_mgmt/spc/bin:\
/opt/ssh/bin:/opt/sentinel/bin:/opt/swa/bin:/opt/hpsmh/bin:/opt/thunderbird:\
/opt/langtools/bin:/opt/gwlm/bin:/opt/omni/bin:/sbin
      export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/hplx/lib:/usr/lib
     
3 编译:
   a net-snmp 5.4.x
    vi make.sh
    make clean;./configure --prefix=/opt/hzjnet/snmpd --sysconfdir=/opt/hzjnet/snmpd/etc --with-logfile=/var/adm/snmpd541.log --with-sys-contact=contact --with-sys-location=location --with-persistent-directory=/var/ucd-snmp --with-openssl=/usr/local/openssl --disable-FEATURE --with-default-snmp-version=2 --without-perl-modules --disable-embedded-perl --disable-ucd-snmp-compatibility --disable-des --disable-md5 --disable-ipv6 --disable-privacy
    出现错误:
    host/hr_swrun.c: In function 'var_hrswrun':
    host/hr_swrun.c:1137: error: 'PGSHIFT' undeclared (first use in this
    function)
    host/hr_swrun.c:1137: error: (Each undeclared identifier is reported
    only once
    host/hr_swrun.c:1137: error: for each function it appears in.)
    *** Error exit code 1
    根据一文:
    编辑hr_swrun.c在147行前加入:   #define PGSHIFT 12
    编辑route_write.c在79行前加入: #define rn_key rn_u.rn_leaf.rn_Key
    之后重新运行make.sh即可。
   b  net-snmp 5.5
      vi make.sh
      make clean;
      ./configure --prefix=/opt/hzjnet/snmpd55 --sysconfdir=/opt/hzjnet/snmpd55/etc --with-logfile=/var/adm/snmpd55.log --with-sys-contact=contact --with-sys-location=location --with-persistent-directory=/var/ucd-snmp --with-openssl=/usr/local/openssl --disable-FEATURE --with-default-snmp-version=2 --without-perl-modules --disable-embedded-perl --disable-ucd-snmp-compatibility --disable-des --disable-md5 --disable-ipv6 --disable-privacy 
4  验证:
   配置文件snmpd.conf:
        com2sec local      localhost    public
        com2sec mynetwork  0.0.0.0      public
        group   MyROGroup  v2c          local
        group   MyROGroup  v2c          mynetwork
        view    all        included     .1                               80
        access MyROGroup ""      any       noauth    exact  all    none   none
        syslocation Right here, right now.
        syscontact Me <>
        proc mountd
        proc ntalkd 4
        proc sendmail 10 1
        exec echotest /bin/echo hello world
        disk / 10000
        load 12 14 14
    运行:
         a  /opt/hzjnet/snmpd/sbin/snmpd -c /opt/hzjnet/snmpd/etc/snmpd.conf
         b  /opt/hzjnet/snmpd55/sbin/snmpd -c /opt/hzjnet/snmpd55/etc/snmpd.conf
    验证:本机验证:snmpwalk -c public -v 2c 127.0.0.1 system
          异地验证:snmpwalk -c public -v 2c 111.111.108.78 system
    以上验证得到以下结果就正常:
            SNMPv2-MIB::sysDescr.0 = STRING: HP-UX SCDB02 B.11.31 U ia64
            SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::org
            DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (54379) 0:09:03.79
            SNMPv2-MIB::sysContact.0 = STRING: Me <>
            SNMPv2-MIB::sysName.0 = STRING: SCDB02
            SNMPv2-MIB::sysLocation.0 = STRING: Right here, right now.
            SNMPv2-MIB::sysORLastChange.0 = Timeticks: (0) 0:00:00.00
            SNMPv2-MIB::sysORID.1 = OID: SNMP-MPD-MIB::snmpMPDMIBObjects.3.1.1
            SNMPv2-MIB::sysORID.2 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance
            SNMPv2-MIB::sysORID.3 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance
            SNMPv2-MIB::sysORID.4 = OID: SNMPv2-MIB::snmpMIB
            SNMPv2-MIB::sysORID.5 = OID: TCP-MIB::tcpMIB
            SNMPv2-MIB::sysORID.6 = OID: IP-MIB::ip
            SNMPv2-MIB::sysORID.7 = OID: UDP-MIB::udpMIB
            SNMPv2-MIB::sysORID.8 = OID: SNMP-VIEW-BASED-ACM-MIB::vacmBasicGroup
            SNMPv2-MIB::sysORID.9 = OID: IF-MIB::ifMIB
            SNMPv2-MIB::sysORDescr.1 = STRING: The MIB for Message Processing and Dispatching.
            SNMPv2-MIB::sysORDescr.2 = STRING: The MIB for Message Processing and Dispatching.
            SNMPv2-MIB::sysORDescr.3 = STRING: The SNMP Management Architecture MIB.
            SNMPv2-MIB::sysORDescr.4 = STRING: The MIB module for SNMPv2 entities
            SNMPv2-MIB::sysORDescr.5 = STRING: The MIB module for managing TCP implementations
            SNMPv2-MIB::sysORDescr.6 = STRING: The MIB module for managing IP and ICMP implementations
            SNMPv2-MIB::sysORDescr.7 = STRING: The MIB module for managing UDP implementations
            SNMPv2-MIB::sysORDescr.8 = STRING: View-based Access Control Model for SNMP.
            SNMPv2-MIB::sysORDescr.9 = STRING: The MIB module to describe generic objects for network interface sub-layers
            SNMPv2-MIB::sysORUpTime.1 = Timeticks: (0) 0:00:00.00
            SNMPv2-MIB::sysORUpTime.2 = Timeticks: (0) 0:00:00.00
            SNMPv2-MIB::sysORUpTime.3 = Timeticks: (0) 0:00:00.00
            SNMPv2-MIB::sysORUpTime.4 = Timeticks: (0) 0:00:00.00
            SNMPv2-MIB::sysORUpTime.5 = Timeticks: (0) 0:00:00.00
            SNMPv2-MIB::sysORUpTime.6 = Timeticks: (0) 0:00:00.00
            SNMPv2-MIB::sysORUpTime.7 = Timeticks: (0) 0:00:00.00
            SNMPv2-MIB::sysORUpTime.8 = Timeticks: (0) 0:00:00.00
            SNMPv2-MIB::sysORUpTime.9 = Timeticks: (0) 0:00:00.00
                     
阅读(2663) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~