Pedi um PEN(Private Enterprise Number)
e comprei. A PEN é 50743 . Eu tenho um MIB
muito simples que se parece com isso:
SAMPLE-SNMP-MIB DEFINITIONS ::= BEGIN
IMPORTS
MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE,
Integer32, enterprises FROM SNMPv2-SMI
;
sampleSnmp MODULE-IDENTITY
LAST-UPDATED "201709120200Z"
ORGANIZATION "Company Name"
CONTACT-INFO
"[email protected]"
DESCRIPTION
"A test MIB"
REVISION "201709220200Z"
DESCRIPTION
"initial Draft"
::= { enterprises 50743 }
sampleSnmpScalar OBJECT IDENTIFIER ::= { sampleSnmp 1 }
sampleVar OBJECT-TYPE
SYNTAX Integer32
MAX-ACCESS read-write
STATUS current
DESCRIPTION
"A simple test object"
::= { sampleSnmpScalar 1}
END
Após a compilação (sampleVar.c sampleVar.h) e configuração, quando eu faço snmpwalk
, eu recebo algo assim:
root@ashish:~# snmpwalk -v 2c -c ncs 192.168.5.13 SAMPLE-SNMP-MIB::sampleSnmp
SAMPLE-SNMP-MIB::sampleSnmpScalar.0 = INTEGER: 1
SAMPLE-SNMP-MIB::sampleSnmp.2.1.2.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51 = STRING: "/bin/echo"
SAMPLE-SNMP-MIB::sampleSnmp.2.1.3.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51 = ""
SAMPLE-SNMP-MIB::sampleSnmp.2.1.4.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51 = ""
SAMPLE-SNMP-MIB::sampleSnmp.2.1.5.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51 = INTEGER: 5
SAMPLE-SNMP-MIB::sampleSnmp.2.1.6.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51 = INTEGER: 1
SAMPLE-SNMP-MIB::sampleSnmp.2.1.7.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51 = INTEGER: 1
SAMPLE-SNMP-MIB::sampleSnmp.2.1.20.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51 = INTEGER: 4
SAMPLE-SNMP-MIB::sampleSnmp.2.1.21.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51 = INTEGER: 1
SAMPLE-SNMP-MIB::sampleSnmp.3.1.1.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51 = ""
SAMPLE-SNMP-MIB::sampleSnmp.3.1.2.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51 = ""
SAMPLE-SNMP-MIB::sampleSnmp.3.1.3.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51 = INTEGER: 1
SAMPLE-SNMP-MIB::sampleSnmp.3.1.4.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51 = INTEGER: 0
SAMPLE-SNMP-MIB::sampleSnmp.4.1.2.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51.1 = ""
O que há de errado com o OID? Quero dizer, para usar snmpget
, preciso consultar como:
snmpget ... sampleSnmp.2.1.5.18.46.49.46.51.46.54.46.49.46.52.46.49.46.53.48.55.52.51
ATUALIZAÇÃO: snmptranslate
funciona bem:
root@ashish:~# snmptranslate -IR -On SAMPLE-SNMP-MIB::sampleSnmp SAMPLE-SNMP-MIB::sampleSnmpScalar SAMPLE-SNMP-MIB::sampleVar
.1.3.6.1.4.1.50743
.1.3.6.1.4.1.50743.1
.1.3.6.1.4.1.50743.1.1
Alguma sugestão sobre isso? Qualquer ajuda seria muito apreciada. obrigado