Re: snmp API: read_objid should not return an error in the case
"Alexander Bubnov" <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
I guess the cause is not in path of mib because snmptranslate works
fine with that name:
~/trial/snmp> snmptranslate -IR sysDescr.0
SNMPv2-MIB::sysDescr.0
~/trial/snmp> snmptranslate -On SNMPv2-MIB::sysDescr.0
.1.3.6.1.2.1.1.1.0
~/trial/snmp> snmptranslate -Tp -IR system
+--system(1)
|
+-- -R-- String sysDescr(1)
| Textual Convention: DisplayString
| Size: 0..255
+-- -R-- ObjID sysObjectID(2)
+-- -R-- TimeTicks sysUpTime(3)
| |
| +--sysUpTimeInstance(0)
|
+-- -RW- String sysContact(4)
| Textual Convention: DisplayString
| Size: 0..255
+-- -RW- String sysName(5)
| Textual Convention: DisplayString
| Size: 0..255
+-- -RW- String sysLocation(6)
| Textual Convention: DisplayString
| Size: 0..255
+-- -R-- INTEGER sysServices(7)
| Range: 0..127
+-- -R-- TimeTicks sysORLastChange(8)
| Textual Convention: TimeStamp
|
+--sysORTable(9)
|
+--sysOREntry(1)
| Index: sysORIndex
|
+-- ---- INTEGER sysORIndex(1)
| Range: 1..2147483647
+-- -R-- ObjID sysORID(2)
+-- -R-- String sysORDescr(3)
| Textual Convention: DisplayString
| Size: 0..255
+-- -R-- TimeTicks sysORUpTime(4)
Textual Convention: TimeStamp
and if I pass "SNMPv2-MIB::sysDescr.0" instead of "system.sysDescr.0"
read_objid works as I expected:
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <string.h>
int main(int argc, char ** argv)
{
oid anOID[MAX_OID_LEN];
size_t anOID_len = MAX_OID_LEN;
init_snmp("snmptest");
/*if(!read_objid("system.sysDescr.0", anOID, &anOID_len))*/
if(!read_objid("SNMPv2-MIB::sysDescr.0", anOID, &anOID_len))
snmp_perror("read_objid");
else
puts("no errors");
}
~/trial/snmp> ./a.out
no errors
It is possible read_objid() uses different format from get_node() function...
2008/7/18 Richard Horton <[email protected]>:
> 2008/7/18 Alexander Bubnov <[email protected]>:
>> I am learning snmp API by tutorials
>> (http://net-snmp.sourceforge.net/wiki/index.php/Tutorials). One of
>> them prints an error in place where is no one as I suppose,
>> http://net-snmp.sourceforge.net/wiki/index.php/TUT:Simple_Async_Application
>>
>
> Might be stating the obvious but ensure that the MIBS and MIBDIR
> environment variables are setup, for testing use MIBS=ALL - makes life
> simpler than wondering what's loaded and what isn't...
>
> Have a look at the snmptranslate documentation and use it to check
> what mibs are loaded (hint: call snmptranslate with the flags to
> translate names to OID and pass it the name of the object you are
> trying to get.).
>
>
>
>
> --
> Richard Horton
> Users are like a virus: Each causing a thousand tiny crises until the
> host finally dies.
> http://www.solstans.co.uk - Solstans Japanese Bobtails and Norwegian Forest Cats
> http://www.pbase.com/arimus - My online photogallery
>
--
/BR, Alexander
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users