Hi,all
I'm trying to extend snmpd agent using net-snmp5.4.1 and porting it to PPC
platform. Firstly I test it in my redhat 9 linux platform. I modified
default_modules.h in directory INSTALL_PATH/agent/mibgroup to include extending
MIB objects such as scalar_int, watched, data_set etc. that defined in
NET-SNMP-EXAMPLES-MIB.txt. then compile and install it. The modified
default_modules.h is as follows(abbreviated):
......
#else /* !NETSNMP_MINI_AGENT == the full shabang */
config_require(mibII)
config_require(ucd_snmp)
config_require(notification)
config_require(notification-log-mib)
config_require(target)
config_require(agent_mibs)
config_require(agentx)
config_require(disman/event)
config_require(disman/schedule)
config_require(utilities)
config_require(examples)
/* default MIBs to auto-include for parsing */
/* NOTE: we consider these MIBs users will likely want to load by
default, even if they're not supporting it in the agent (ie, the
command line tools need to load them anyway) */
config_add_mib(IP-MIB)
config_add_mib(IF-MIB)
config_add_mib(TCP-MIB)
config_add_mib(UDP-MIB)
config_add_mib(HOST-RESOURCES-MIB)
config_add_mib(SNMPv2-MIB)
config_add_mib(RFC1213-MIB)
config_add_mib(NOTIFICATION-LOG-MIB)
config_add_mib(DISMAN-EVENT-MIB)
config_add_mib(DISMAN-SCHEDULE-MIB)
config_add_mib(NET-SNMP-EXAMPLES-MIB)
......
The modified examples.h in direcotry INSTALL_PATH/agent/mibgroup is as
follows(abbreviated):
config_require(examples/scalar_int)
config_require(examples/watched)
config_require(examples/data_set)
config_require(examples/delayed_instance)
config_require(examples/netSnmpHostsTable)
when I operated on these extending objects using snmpget or snmpwalk command,it
return the correct results.
On my redhat 9 linux platform, the output is :
[r...@virtual-linux net-snmp-5.4.1]# snmpd -f -Le -d &
[1] 11498
[r...@virtual-linux net-snmp-5.4.1]# netsnmp_assert !"registration !=
duplicate" failed agent_registry.c:535 netsnmp_subtree_load()
netsnmp_assert !"registration != duplicate" failed agent_registry.c:535
netsnmp_subtree_load()
netsnmp_assert !"registration != duplicate" failed agent_registry.c:535
netsnmp_subtree_load()
NET-SNMP version 5.4.1
[r...@virtual-linux net-snmp-5.4.1]# snmpget -c private localhost
netSnmpExampleInteger.0
Received 47 bytes from UDP: [127.0.0.1]:32783
0000: 30 2D 02 01 01 04 07 70 72 69 76 61 74 65 A0 1F 0-.....private..
0016: 02 04 28 61 35 40 02 01 00 02 01 00 30 11 30 0F ..([email protected].
0032: 06 0B 2B 06 01 04 01 BF 08 02 01 01 00 05 00 ..+............
Received SNMP packet(s) from UDP: [127.0.0.1]:32783
GET message
-- NET-SNMP-EXAMPLES-MIB::netSnmpExampleInteger.0
Sending 48 bytes to UDP: [127.0.0.1]:32783
0000: 30 2E 02 01 01 04 07 70 72 69 76 61 74 65 A2 20 0......private.
0016: 02 04 28 61 35 40 02 01 00 02 01 00 30 12 30 10 ..([email protected].
0032: 06 0B 2B 06 01 04 01 BF 08 02 01 01 00 02 01 2A ..+............*
NET-SNMP-EXAMPLES-MIB::netSnmpExampleInteger.0 = INTEGER: 42
Then I port it to my PPC platform and my config file is as follows:
./configure --build=i386-linux --host=powerpc-linux --with-gnu-ld
--prefix=/mnt/nfs/usr/local/net-snmp --with-default-snmp-version="2"
--with-logfile="/mnt/nfs/var/log/snmpd.log"
--with-persistent-directory="/mnt/nfs/var/net-snmp" CC=ppc_82xx-gcc
LDFLAGS="-L/opt/montavista/pro/devkit/ppc/82xx/target/lib
-L/opt/montavista/pro/devkit/ppc/82xx/target/usr/lib -static"
--with-sys-contact="[email protected]" --with-sys-location="china"
--with-endianness=big --disable-manuals --disable-scripts --disable-md5
make && make install succeed!
But when I operated on the same objects as before:
[r...@virtual-linux net-snmp-5.4.1]# snmpwalk -c private localhost
netSnmpHostsTable
NET-SNMP-EXAMPLES-MIB::netSnmpHostsTable = No Such Object available on this
agent at this OID
[r...@virtual-linux net-snmp-5.4.1]# snmpget -c private localhost
netSnmpExampleInteger.0
NET-SNMP-EXAMPLES-MIB::netSnmpExampleInteger.0 = No Such Object available on
this agent at this OID
the error appears.But It can return correct results when I operated on MIBII
objects such as interfaces,system.
when I trigger the debug on snmpd using snmpd -f -Le -d, it shows:
[email protected]:~# snmpd -f -Le -d -c /usr/share/snmp/snmpd.conf &
[1] 143
[email protected]:~# UCD-SNMP version 4.2.6
And the output is as follows:
Received 46 bytes from 127.0.0.1:1024
0000: 30 2C 02 01 01 04 07 70 72 69 76 61 74 65 A1 1E 0,.....private..
0016: 02 04 57 30 90 BB 02 01 00 02 01 00 30 10 30 0E ..W0........0.0.
0032: 06 0A 2B 06 01 04 01 BF 08 02 02 02 05 00 ..+...........
Connection from 127.0.0.1
Received SNMP packet(s) from 127.0.0.1
GETNEXT message
--
enterprises.netSnmp.netSnmpExamples.netSnmpExampleTables.netSnmpHostsTable
>>
.iso.org.dod.internet.snmpV2.snmpModules.snmpFrameworkMIB.snmpFrameworkMIBObjects.snmpEngine.snmpEngineID.0
= Hex: 80 00 07 E5 80 34 4B D2 0A 00 00 02 E9
Sending 59 bytes to 127.0.0.1:1024
0000: 30 39 02 01 01 04 07 70 72 69 76 61 74 65 A2 2B 09.....private.+
0016: 02 04 57 30 90 BB 02 01 00 02 01 00 30 1D 30 1B ..W0........0.0.
0032: 06 0A 2B 06 01 06 03 0A 02 01 01 00 04 0D 80 00 ..+.............
0048: 07 E5 80 34 4B D2 0A 00 00 02 E9 ...4K......
Received 46 bytes from 127.0.0.1:1024
0000: 30 2C 02 01 01 04 07 70 72 69 76 61 74 65 A0 1E 0,.....private..
0016: 02 04 57 30 90 BC 02 01 00 02 01 00 30 10 30 0E ..W0........0.0.
0032: 06 0A 2B 06 01 04 01 BF 08 02 02 02 05 00 ..+...........
Connection from 127.0.0.1
Received SNMP packet(s) from 127.0.0.1
GET message
--
enterprises.netSnmp.netSnmpExamples.netSnmpExampleTables.netSnmpHostsTable
Sending 46 bytes to 127.0.0.1:1024
0000: 30 2C 02 01 01 04 07 70 72 69 76 61 74 65 A2 1E 0,.....private..
0016: 02 04 57 30 90 BC 02 01 00 02 01 00 30 10 30 0E ..W0........0.0.
0032: 06 0A 2B 06 01 04 01 BF 08 02 02 02 80 00 ..+...........
enterprises.netSnmp.netSnmpExamples.netSnmpExampleTables.netSnmpHostsTable = No
Such Object available on this agent
[email protected]:~# snmpwalk -v 2c -c private localhost netSnmpHostsTable
[email protected]:~# snmp[4Pd -f -Le -d -c /usr/share/snmp/snmpd.conf
&[3P/usr/share/snmp/snmpd.conf &
[email protected]:~# kill 139[K[2Pps -efsnmpwalk -v 2c -c
private localhost netSnmpHostsTable
[email protected]:~# snmp[4Pd -f -Le -d -c /usr/share/snmp/snmpd.conf
&[3P/usr/share/snmp/snmpd.conf &
[email protected]:~# ps -ef[Kkill 130[2Pps
-efsnmptranslate -IR -On portSetting[6P
netSnmpIETFW-IR -On portSetting
[email protected]:~# ps -ef[Kkill 130[2Pps -efsnmpd -f
-Le -d /usr/share/snmp/snmpd.conf &...@-c
/usr/share/snmp/snmpd.conf &
[email protected]:~# snmpwalk -v 2c -c private localhost netSnmpHostsTable
[1p[1p[1p[1p...@g[1@e...@t [1@
...@-[1@v [1@ ...@2[1@c [1@ ...@-[1@c [1@
...@p[1@r...@i[1@v...@a[1@t...@e [1@ ...@l[1@o...@c[1@a...@lh -v 2c -c
private localhost [[email protected]:~# snmpget -v 2c -c private localho -v
2c -c private localhost
[[email protected]:~# snmpget -v 2c -c private localhos -v 2c -c private
localhost [[email protected]:~# snmpget -v 2c -c private localhost -v 2c -c
private localhost [email protected]:~# snmpget -v 2c -c private localhost -v
2c -c private localhost[1P [[email protected]:~# snmpget -v 2c -c private
localhos -v 2c -c private localhost [k[[email protected]:~# snmpget -v 2c -c
private localho -v 2c -c private localhost
[k[[email protected]:~# snmpget -v 2c -c private localh[1P
[k[[email protected]:~# snmpget -v 2c -c private
local[1P[1P[1P[1P[1P -v 2c -c
private[1P[1P[1P[1P[1P[1P[1P[1P[1P[1P[1P[1P[1P[1P[1P[1P[1P
localhost n e t S n m p E x a m p l e I n t e g e r
[[email protected]:~# snmpget -v 2c -c private localhost
netSnmpExampleInteger.
0
Received 47 bytes from 127.0.0.1:1024
0000: 30 2D 02 01 01 04 07 70 72 69 76 61 74 65 A0 1F 0-.....private..
0016: 02 04 59 AA F6 DE 02 01 00 02 01 00 30 11 30 0F ..Y.........0.0.
0032: 06 0B 2B 06 01 04 01 BF 08 02 01 01 00 05 00 ..+............
Connection from 127.0.0.1
Received SNMP packet(s) from 127.0.0.1
GET message
--
enterprises.netSnmp.netSnmpExamples.netSnmpExampleScalars.netSnmpExampleInteger.0
Sending 47 bytes to 127.0.0.1:1024
0000: 30 2D 02 01 01 04 07 70 72 69 76 61 74 65 A2 1F 0-.....private..
0016: 02 04 59 AA F6 DE 02 01 00 02 01 00 30 11 30 0F ..Y.........0.0.
0032: 06 0B 2B 06 01 04 01 BF 08 02 01 01 00 80 00 ..+............
enterprises.netSnmp.netSnmpExamples.netSnmpExampleScalars.netSnmpExampleInteger.0
= No Such Object available on this agent
[email protected]:~#
please give me some suggestions.
Regards,
------------------------------------------------------------------------------
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders