Goodshirly
2007-06-13 03:25:59 UTC
Hi,all
I'm doing some job with the NET-SNMP upon Linux.But there is something strange arised.
I wanted to write a MIB module of my own,but i didn't know how to start with it.
So i followed the tutorial in the web site: http://net-snmp.sourceforge.net/wiki/index.php/TUT:Writing_a_MIB_Module. As this is an example of how to write a MIB module. Then I've done the job as follows:
Firstly,I've downloaded the MIB named "NET-SNMP-TUTORIAL-MIB" from the web site,then I put this .txt file into the directory:/usr/local/share/ snmp/mibs; Then i've downloaded "example mib module"(nstAgentModuleObject.c) and "header file"(nstAgentModuleObject.h ) and put them into the directory:/usr/ local/src/net-snmp-5.1.4/agent/mibgroup.
Secondly,I entered the commands in the terminal as follows: # export MIBS=ALL # ./configure --with-mib-modules="nstAgentModuleObject" # make # make install
Then when i asked for a snmptranslate command,it gave me the right result: # snmptranslate -On NET-SNMP-TURORIAL-MIB::nstAgentModuleObject.0 .1.3.6.1.4.1.8072.2.4.1.1.1.0
but when i asked for a snmpget command,it gave me the result: # snmpget -v 2c -c xzpublic localhost NET-SNMP-TUTORIAL- MIB::nstAgentModuleObject.0 NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0=No Such Object available on this agent at this OID
Why?Why it didn't return the correct value to me?Is there anything important I ignored?
But when i entered the command as follows,it gave me the correct value: # snmpget -v 2c -c xzpublic loalhost sysUpTime.0 SNMPv2-MIB::sysUpTime.0=Timeticks:(500804)1:23:28.40
Why?
The information in the /usr/local/share/snmp/snmpd.conf are as follows: rocommunity xzpublic rwcommunity private trapsink localhost trap2sink 192.168.1.100
The information in the /etc/snmp/snmpd.conf are as follows:
com2sec notConfigUser default public com2sec read default xzpublic com2sec write default private
group notConfigGroup v1 notConfigUser group notConfigGroup v2 notConfigUser group readgroup v1 read group readgroup v2 read group writegroup v1 write group writegroup v2 write
view systemview included .1.3.6.1.2.1.1 view systemview included .1.3.6.1.25.1.1 view allview included .1 80
access notConfigGroup "" any noauth exact systemview none none access readgroup "" any noauth 0 allview none allview access writegroup "" any noauth 0 none allview allview
What's wrong with the whole procedure? Oh,one more question,what's the difference between the /usr/local/ share/snmp/snmpd.conf file and the /ect/snmp/snmpd.conf file?
Could you help me?
Thanks a lot! Looking forward to your help!
_________________________________________________________________
ʹÓÃÏÂÒ»ŽúµÄ MSN Messenger¡£
http://imagine-msn.com/messenger/launch80/default.aspx?locale=zh-cn&source=wlmailtagline
I'm doing some job with the NET-SNMP upon Linux.But there is something strange arised.
I wanted to write a MIB module of my own,but i didn't know how to start with it.
So i followed the tutorial in the web site: http://net-snmp.sourceforge.net/wiki/index.php/TUT:Writing_a_MIB_Module. As this is an example of how to write a MIB module. Then I've done the job as follows:
Firstly,I've downloaded the MIB named "NET-SNMP-TUTORIAL-MIB" from the web site,then I put this .txt file into the directory:/usr/local/share/ snmp/mibs; Then i've downloaded "example mib module"(nstAgentModuleObject.c) and "header file"(nstAgentModuleObject.h ) and put them into the directory:/usr/ local/src/net-snmp-5.1.4/agent/mibgroup.
Secondly,I entered the commands in the terminal as follows: # export MIBS=ALL # ./configure --with-mib-modules="nstAgentModuleObject" # make # make install
Then when i asked for a snmptranslate command,it gave me the right result: # snmptranslate -On NET-SNMP-TURORIAL-MIB::nstAgentModuleObject.0 .1.3.6.1.4.1.8072.2.4.1.1.1.0
but when i asked for a snmpget command,it gave me the result: # snmpget -v 2c -c xzpublic localhost NET-SNMP-TUTORIAL- MIB::nstAgentModuleObject.0 NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0=No Such Object available on this agent at this OID
Why?Why it didn't return the correct value to me?Is there anything important I ignored?
But when i entered the command as follows,it gave me the correct value: # snmpget -v 2c -c xzpublic loalhost sysUpTime.0 SNMPv2-MIB::sysUpTime.0=Timeticks:(500804)1:23:28.40
Why?
The information in the /usr/local/share/snmp/snmpd.conf are as follows: rocommunity xzpublic rwcommunity private trapsink localhost trap2sink 192.168.1.100
The information in the /etc/snmp/snmpd.conf are as follows:
com2sec notConfigUser default public com2sec read default xzpublic com2sec write default private
group notConfigGroup v1 notConfigUser group notConfigGroup v2 notConfigUser group readgroup v1 read group readgroup v2 read group writegroup v1 write group writegroup v2 write
view systemview included .1.3.6.1.2.1.1 view systemview included .1.3.6.1.25.1.1 view allview included .1 80
access notConfigGroup "" any noauth exact systemview none none access readgroup "" any noauth 0 allview none allview access writegroup "" any noauth 0 none allview allview
What's wrong with the whole procedure? Oh,one more question,what's the difference between the /usr/local/ share/snmp/snmpd.conf file and the /ect/snmp/snmpd.conf file?
Could you help me?
Thanks a lot! Looking forward to your help!
_________________________________________________________________
ʹÓÃÏÂÒ»ŽúµÄ MSN Messenger¡£
http://imagine-msn.com/messenger/launch80/default.aspx?locale=zh-cn&source=wlmailtagline