A versão utilizada foi: net-snmp-5.7.3
2) Baixar a mib no site da cisco: http://tools.cisco.com/Support/SNMP/do/BrowseMIB.do?local=en&step=2&mibName=ENTITY-SENSOR-MIB
- ENTITY-MIB.my
- ENTITY-SENSOR-MIB.my
3) Renomeá-las:
- ENTITY-MIB.my para ENTITY-MIB.txt
- ENTITY-SENSOR-MIB.my para ENTITY-SENSOR-MIB.txt
4) Descompacte o arquivo "net-snmp-5.7.3.tar.gz" baixado no site do NET-SMNP.
5) Na raiz da pasta "net-snmp-5.7.3/" execute os comandos a seguir:
./configure --prefix=/<caminho absoluto>/net-snmp-5.7.3/saida --disable-embedded-perl
Em seguida: make
Depois: sudo make install
6) Copie as mibs ENTITY-MIB e ENTITY-SENSOR-MIB para a pasta "./net-snmp-5.7.3/saida/share/snmp/mibs/"
Nas próximas etapas eu segui as informações do tutorial "MIBs For Dummies" do link: http://net-snmp.sourceforge.net/tutorial/tutorial-5/toolkit/mfd/index.html
7)Criei a pasta, junto com a sub-pasta: mkdir ENTITY-SENSOR-MIB/entPhySensorTable (fiz tudo dentro da pasta "saida", mas podia ser em qualquer lugar)
8) Executei o comando: MIBS="+ENTITY-SENSOR-MIB" ./../../bin/mib2c -c mib2c.mfd.conf entPhySensorTable (pasta atual: ./net-snmp-5.7.3/saida/ENTITY-SENSOR-MIB/entPhySensorTable)
- MIBS="+ENTITY-SENSOR-MIB": é uma variável de ambiente que serve para apontar para a MIB que deseja usar com o comando mib2c
- ./../../bin/mib2c: Após compilar o net-snmp-5.7.3 e instalar na pasta "./net-snmp-5.7.3/saida", os arquivos de configuração e binários ficam todos nessa pasta, inclusive o binário mib2c. Se desejar instalar o comando mib2c direto no sistema, basta baixar o pacote libsnmp-dev executando no shell: sudo apt-get install libsnmp-dev
- mib2c.mfd.conf: é o arquivo de configuração do mib2c feito para gerar arquivos .c e .h para usuários leigos em MIBs e SNMP.
- entPhySensorTable: é o mib node descrito no arquivo da mib ENTITY-SENSOR-MIB.TXT
9) Nas perguntas que aparecem após executar o comando anterior eu respondi tudo com resposta DEFAULT (pressionando ENTER em todas elas).
10) Executei o comando: MIBS="+ENTITY-SENSOR-MIB" ./../../bin/mib2c -c mfd-makefile.m2m entPhySensorTable para gerar o arquivo makefile.
11) MIBS="+ENTITY-SENSOR-MIB" ./../../bin/mib2c -c subagent.m2c entPhySensorTable para gerar o arquivo subagent.
Os arquivos gerados foram:
- entPhySensorTable.c
- entPhySensorTable.h
- entPhySensorTable_data_get.c
- entPhySensorTable_data_get.h
- entPhySensorTable_data_set.c
- entPhySensorTable_data_set.h
- entPhySensorTable_data_access.c
- entPhySensorTable_data_access.h
- entPhySensorTable_enums.h
- entPhySensorTable_interface.c
- entPhySensorTable_interface.h
- entPhySensorTable_Makefile
- entPhySensorTable_oids.h
- entPhySensorTable-README-entPhySensorTable.txt
- entPhySensorTable-README-FIRST.txt
- entPhySensorTable_subagent.c
Nenhum comentário:
Postar um comentário