2014-12-27 2 views
0

Hy! 내가 내 자신의 그물 - SNMP MIB 모듈을 작성하려고하지만 약간의 문제가 ... :) 나는 www.net-snmp.org 사이트에 문서를 참조하십시오. 내가 한 단계 :MIB 모듈을 작성하는 Net-snmp

  • 나는 그렇게 NET-SNMP-예-MIB를 컴파일하려고합니다.

1) mib2c -c mib2c.scalar.conf의 netSnmpExampleScalars - 지금은 내가 디렉토리를

2 ../agent/mibgroup에 복사 것을하는이 .c과 .H 파일을 가져)

./configure \ 
    --with-ldflags="" \ 
    --with-cflags="-I/usr/src/net-snmp-5.4.4/agent/mibgroup" \ 
    --enable-mini-agent \ 
    --with-logfile="/var/log/snmpd.log" \ 
    --with-default-snmp-version=2 \ 
    [email protected] \ 
    --with-sys-location=HU/Sze \ 
    --disable-applications \ 
    --disable-debugging \ 
    --disable-manuals \ 
    --with-mib-modules="netSnmpExampleScalars" \ 
    --disable-scripts \ 
    --without-perl-modules \ 
    --disable-embedded-perl \ 
    --without-python-modules \ 
    --without-libwrap \ 
    --without-openssl \ 
    --without-rpm \ 
    --without-zlib 

3) ./myconfig

SNMP Versions Supported: 1 2c 3 
    Building for:    linux 
    Net-SNMP Version:   5.7.3 
    Network transport support: Callback Unix Alias TCP UDP IPv4Base SocketBase TCPBase UDPIPv4Base UDPBase 
    SNMPv3 Security Modules:  usm 
    Agent MIB code:   default_modules netSnmpExampleScalars => snmpv3mibs mibII/snmp_mib mibII/system_mib mibII/sysORTable mibII/vacm_vars mibII/vacm_conf 
    MYSQL Trap Logging:   unavailable 
    Embedded Perl support:  disabled 
    SNMP Perl modules:   disabled 
    SNMP Python modules:  disabled 
    Crypto support from: 
    Authentication support:  MD5 
    Encryption support: 
    Local DNSSEC validation: disabled 

4. 실행) 실행 명령

합니다 내가 설정 스크립트를 작성 6,
netSnmpExampleScalars.c: In function 'handle_netSnmpExampleInteger': 
netSnmpExampleScalars.c:55:90: error: expected expression before ',' token 
netSnmpExampleScalars.c:75:58: error: expected expression before ')' token 
netSnmpExampleScalars.c:88:34: error: expected expression before ')' token 
netSnmpExampleScalars.c:95:34: error: expected expression before ')' token 
netSnmpExampleScalars.c:103:34: error: expected expression before ')' token 
netSnmpExampleScalars.c: In function 'handle_netSnmpExampleSleeper': 
netSnmpExampleScalars.c:134:90: error: expected expression before ',' token 
netSnmpExampleScalars.c:154:58: error: expected expression before ')' token 
netSnmpExampleScalars.c:167:34: error: expected expression before ')' token 
netSnmpExampleScalars.c:174:34: error: expected expression before ')' token 
netSnmpExampleScalars.c:182:34: error: expected expression before ')' token 
netSnmpExampleScalars.c: In function 'handle_netSnmpExampleString': 
netSnmpExampleScalars.c:213:90: error: expected expression before ',' token 
netSnmpExampleScalars.c:233:58: error: expected expression before ')' token 
netSnmpExampleScalars.c:246:34: error: expected expression before ')' token 
netSnmpExampleScalars.c:253:34: error: expected expression before ')' token 
netSnmpExampleScalars.c:261:34: error: expected expression before ')' token 
make[2]: *** [netSnmpExampleScalars.lo] Error 1 
make[2]: Leaving directory `/usr/src/net-snmp-5.7.3/agent/mibgroup' 
make[1]: *** [subdirs] Error 1 
make[1]: Leaving directory `/usr/src/net-snmp-5.7.3/agent 
make: *** [subdirs] Error 1 

아직도 나는 mib2c 생성 된 C 파일을 편집해야합니다 = 아니면 다른 .conf 파일을 사용해야합니까? 또한 구성 스크립트가 올바른지 또는 올바르지 않은지 알 수 없습니다. Leaving directory error로 무엇을 할 수 있습니까?

+0

생성 된 c 파일에 구문 오류가 있습니다. 컴파일러는 거짓말을하지 않습니다. =) MIB 파일이나 생성 된 .c 및 .h 파일을 보지 않고서는 여기에서 무슨 일이 일어나는지 알기가 어렵습니다. – Jolta

답변

0

난 당신이 mib2c에 의해 생성 된 .c 파일을 편집하지 않은 것 같아요. mib2c는 C 코드로 MIB를 변환하지만 값을 MIB 데이터로 반환하도록 코드를 편집해야합니다 (또는 SET 처리시이를 수용). 예 : 귀하의 mib은 건강 모니터링 (하트 비트, ...)에 관한 것입니다. mib2c는 C 코드의 모든 것을 생성 할 것입니다 (snmp get request를 고려할 때). 물론 mib2c는 무엇을 반환해야하는지 모릅니다. 어떻게 심장 박동을 읽으시겠습니까? 이 정보는 장치 나 텍스트 파일 또는 다른 것으로 읽습니까? 그래서 이것을 mc2c가 공백으로 만들고 컴파일하지 않기 때문에 .c 코드에서 이것을 채워야합니다.

관련 문제