Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

net-snmp mib files

Hello guys......

i using snmp in uClinux .....it works with the default mibs but i need to do my own mib file .......

anybody knows how can i do that???............ one exemple how can i monitore a peripherial.....

thanks

Franz Wagner

15 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi

    i'm interested in compiling my own MIB in uclinux.. my snmp works fine but im not able to add my own MIB .. i followed the net-snmp tutorial but no avail ...

    regards

    Khushboo
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    hello Mr khushboo_q,

    I'm sorry for the delay in reply........

    to do you ow mib first you need to write your FILE-MIB.txt

    this file is used to generate a c skeleton...

    and look like this

    
    LINEAR-MIB DEFINITIONS ::= BEGIN
    IMPORTS
    NOTIFICATION-TYPE,
    MODULE-IDENTITY,
    enterprises,
    OBJECT-TYPE,
    Counter32,
    Integer32,
    Gauge32 
    FROM SNMPv2-SMI
    DisplayString,
    TruthValue
    FROM SNMPv2-TC
    ;
    tsoipProject MODULE-IDENTITY
    LAST-UPDATED "201105130000Z"
    ORGANIZATION "LINEAR Equipamentos Eletronicos S/A."
    CONTACT-INFO 
    "Contact: Franz Wagner
    Postal: LINEAR Equipamentos Eletronicos S/A,
    Praca Linear sn,
    Santa Rita do Sapucai, MG,
    Brasil,
    Web: www.linear-tv.com
    Email: fwagner@linear.com.br"
    DESCRIPTION
    "Rev. 1.33"
    ::= { linear 8 }
    linear OBJECT IDENTIFIER ::= { enterprises 25026 }
    -- top level MIB headings of the LAD MIB 
    tsoipTraps OBJECT IDENTIFIER ::= { tsoipProject 0 }
    tsoipSystem OBJECT IDENTIFIER ::= { tsoipProject 1 }
    tsoipTrapInfo OBJECT IDENTIFIER ::= { tsoipProject 2 }
    -- LAD System Information
    tsoipTables OBJECT IDENTIFIER ::= { tsoipSystem 1 }
    -- -----------------------------------------
    -- TX Table
    -- -----------------------------------------
    txTable OBJECT-TYPE
    SYNTAX SEQUENCE OF LinearTxEntry
    MAX-ACCESS not-accessible
    STATUS current
    DESCRIPTION
    "Tabelas com informacoes de Transmissao e Recepcao."
    ::= { tsoipTables 1 }
    linearTxEntry OBJECT-TYPE
    SYNTAX LinearTxEntry
    MAX-ACCESS not-accessible
    STATUS current
    DESCRIPTION
    "Tabela de Transmissao."
    INDEX { linearTxId }
    ::= { txTable 1 }
    LinearTxEntry ::=
    SEQUENCE {
    linearTxId Integer32,
    linearTxIp1 Integer32,
    linearTxIp2 Integer32,
    linearTxIp3 Integer32,
    linearTxIp4 Integer32,
    linearTxPort Integer32,
    linearTxencap DisplayString,
    linearTxpacket Integer32,
    linearTxFec DisplayString,
    linearTxFecV DisplayString,
    linearTxEthBps Integer32
    }
    linearTxId OBJECT-TYPE
    SYNTAX Integer32 (1..10)
    MAX-ACCESS not-accessible
    STATUS current
    DESCRIPTION
    "Index da Tabela."
    ::= { linearTxEntry 1 }
    linearTxIp1 OBJECT-TYPE
    SYNTAX Integer32 (1..255)
    MAX-ACCESS read-write
    STATUS current
    DESCRIPTION
    "1 octeto do IP de Destino"
    ::= { linearTxEntry 2 }
    linearTxIp2 OBJECT-TYPE
    SYNTAX Integer32 (1..255)
    MAX-ACCESS read-write
    STATUS current
    DESCRIPTION
    "2 octeto do IP de Destino."
    ::= { linearTxEntry 3 }
    linearTxIp3 OBJECT-TYPE
    SYNTAX Integer32 (1..255)
    MAX-ACCESS read-write
    STATUS current
    DESCRIPTION
    "3 octeto do IP de Destino"
    ::= { linearTxEntry 4 }
    linearTxIp4 OBJECT-TYPE
    SYNTAX Integer32 (1..255)
    MAX-ACCESS read-write
    STATUS current
    DESCRIPTION
    "4 octeto do IP de Destino"
    ::= { linearTxEntry 5 }
    linearTxPort OBJECT-TYPE
    SYNTAX Integer32 (1..65525)
    MAX-ACCESS read-write
    STATUS current
    DESCRIPTION
    "Porta de Destino"
    ::= { linearTxEntry 6 }
    linearTxencap OBJECT-TYPE
    SYNTAX DisplayString
    MAX-ACCESS read-write
    STATUS current
    DESCRIPTION
    "Encapsulamento RTP ou UDP"
    ::= { linearTxEntry 7 }
    linearTxpacket OBJECT-TYPE
    SYNTAX Integer32 (1..7)
    MAX-ACCESS read-write
    STATUS current
    DESCRIPTION
    "N de pacotes ts em cada pacote IP"
    ::= { linearTxEntry 8 }
    linearTxFec OBJECT-TYPE
    SYNTAX DisplayString
    MAX-ACCESS read-write
    STATUS current
    DESCRIPTION
    "FEC habilitado ou desabilitado"
    ::= { linearTxEntry 9 }
    linearTxFecV OBJECT-TYPE
    SYNTAX DisplayString
    MAX-ACCESS read-write
    STATUS current
    DESCRIPTION
    "Valor do Fec"
    ::= { linearTxEntry 10 }
    linearTxEthBps OBJECT-TYPE
    SYNTAX Integer32
    MAX-ACCESS read-only
    STATUS current
    DESCRIPTION
    "Taxa de transmissao na saida ETH"
    ::= { linearTxEntry 11 }
    -- -----------------------------------------
    -- LAD traps
    -- -----------------------------------------
    tsoipRefreshAlarm NOTIFICATION-TYPE
    OBJECTS {refreshTrap}
    STATUS current
    DESCRIPTION
    " Trap issued when an alarm is triggered. "
    ::= { tsoipTraps 1 }
    -- -----------------------------------------
    -- LAD Trap Info: varbinds sent with traps
    -- -----------------------------------------
    refreshTrap OBJECT-TYPE
    SYNTAX Integer32
    MAX-ACCESS accessible-for-notify
    STATUS current
    DESCRIPTION
    "This is the Id (row number in the ladAlarmTable) of the
    zone generating the alarm."
    ::= { tsoipTrapInfo 1 }
    END
    

    now you need a linux machine to walk away......

    install net-snmp .... and put your mib at mibs directory /opt/net-snmp/mibs

    and run mib2c

    $mib2c LINEAR-MIB.txt:linearProject

    this generate two files : linearProject.h and linearProject.c ......

    you need modify the .c file to do what you need.......

    and put this file at nios2-linux/uClinux-dist/user/net-snmp/net-snmp-5.2.1/agent/mibgroup

    add your mib at menuconfig and voila.....

    good luck

    Franz Wagner
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi all,

    I have a system with a nios2 and a network interface (Altera Triple speed Ethernet MAC).

    I use 2.6.30 kernel on my board and net-snmp 5.2.1.

    I can see my network interfaces using ifconfig :

    --- Quote Start ---

    /# ifconfig

    eth0 Link encap:Ethernet HWaddr 00:15:12:00:15:88

    inet addr:192.168.0.110 Bcast:192.168.0.255 Mask:255.255.255.0

    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

    RX packets:1400 errors:0 dropped:681 overruns:0 frame:0

    TX packets:400 errors:0 dropped:0 overruns:0 carrier:0

    collisions:0 txqueuelen:1000

    RX bytes:205531 (200.7 KiB) TX bytes:33239 (32.4 KiB)

    Base address:0x400

    lo Link encap:Local Loopback

    inet addr:127.0.0.1 Mask:255.0.0.0

    UP LOOPBACK RUNNING MTU:16436 Metric:1

    RX packets:0 errors:0 dropped:0 overruns:0 frame:0

    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

    collisions:0 txqueuelen:0

    RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

    --- Quote End ---

    So the systems know interface statistics.

    But I wonder why net-snmp is not able to handle these statistics automatically.

    I have the following :

    --- Quote Start ---

    /# snmpwalk -v 1 -c public 192.168.0.110 1

    iso.3.6.1.2.1.1.1.0 = STRING: "XXX"

    iso.3.6.1.2.1.1.2.0 = OID: ccitt.1

    iso.3.6.1.2.1.1.3.0 = Timeticks: (115) 0:00:01.15

    iso.3.6.1.2.1.1.4.0 = STRING: "System Contact (configurable)"

    iso.3.6.1.2.1.1.5.0 = STRING: "System Name (configurable)"

    iso.3.6.1.2.1.1.6.0 = STRING: "System Location (configurable)"

    iso.3.6.1.2.1.1.7.0 = INTEGER: 2

    iso.3.6.1.2.1.1.8.0 = Timeticks: (7) 0:00:00.07

    iso.3.6.1.2.1.1.9.1.2.1 = OID: iso.3.6.1.6.3.1

    iso.3.6.1.2.1.1.9.1.2.2 = OID: iso.3.6.1.6.3.16.2.2.1

    iso.3.6.1.2.1.1.9.1.2.3 = OID: iso.3.6.1.6.3.10.3.1.1

    iso.3.6.1.2.1.1.9.1.2.4 = OID: iso.3.6.1.6.3.11.3.1.1

    iso.3.6.1.2.1.1.9.1.2.5 = OID: iso.3.6.1.6.3.15.2.1.1

    iso.3.6.1.2.1.1.9.1.3.1 = STRING: "The MIB module for SNMPv2 entities"

    iso.3.6.1.2.1.1.9.1.3.2 = STRING: "View-based Access Control Model for SNMP."

    iso.3.6.1.2.1.1.9.1.3.3 = STRING: "The SNMP Management Architecture MIB."

    iso.3.6.1.2.1.1.9.1.3.4 = STRING: "The MIB for Message Processing and Dispatching."

    iso.3.6.1.2.1.1.9.1.3.5 = STRING: "The management information definitions for the SNMP User-based Security Model."

    iso.3.6.1.2.1.1.9.1.4.1 = Timeticks: (5) 0:00:00.05

    iso.3.6.1.2.1.1.9.1.4.2 = Timeticks: (6) 0:00:00.06

    iso.3.6.1.2.1.1.9.1.4.3 = Timeticks: (6) 0:00:00.06

    iso.3.6.1.2.1.1.9.1.4.4 = Timeticks: (6) 0:00:00.06

    iso.3.6.1.2.1.1.9.1.4.5 = Timeticks: (7) 0:00:00.07

    iso.3.6.1.2.1.11.1.0 = Counter32: 24

    iso.3.6.1.2.1.11.2.0 = Counter32: 25

    iso.3.6.1.2.1.11.3.0 = Counter32: 0

    iso.3.6.1.2.1.11.4.0 = Counter32: 0

    iso.3.6.1.2.1.11.5.0 = Counter32: 0

    iso.3.6.1.2.1.11.6.0 = Counter32: 0

    iso.3.6.1.2.1.11.8.0 = Counter32: 0

    iso.3.6.1.2.1.11.9.0 = Counter32: 0

    iso.3.6.1.2.1.11.10.0 = Counter32: 0

    iso.3.6.1.2.1.11.11.0 = Counter32: 0

    iso.3.6.1.2.1.11.12.0 = Counter32: 0

    iso.3.6.1.2.1.11.13.0 = Counter32: 34

    iso.3.6.1.2.1.11.14.0 = Counter32: 0

    iso.3.6.1.2.1.11.15.0 = Counter32: 0

    iso.3.6.1.2.1.11.16.0 = Counter32: 38

    iso.3.6.1.2.1.11.17.0 = Counter32: 0

    iso.3.6.1.2.1.11.18.0 = Counter32: 0

    iso.3.6.1.2.1.11.19.0 = Counter32: 0

    iso.3.6.1.2.1.11.20.0 = Counter32: 0

    iso.3.6.1.2.1.11.21.0 = Counter32: 0

    iso.3.6.1.2.1.11.22.0 = Counter32: 0

    iso.3.6.1.2.1.11.24.0 = Counter32: 0

    iso.3.6.1.2.1.11.25.0 = Counter32: 0

    iso.3.6.1.2.1.11.26.0 = Counter32: 0

    iso.3.6.1.2.1.11.27.0 = Counter32: 0

    iso.3.6.1.2.1.11.28.0 = Counter32: 48

    iso.3.6.1.2.1.11.29.0 = Counter32: 1

    iso.3.6.1.2.1.11.30.0 = INTEGER: 2

    iso.3.6.1.2.1.11.31.0 = Counter32: 0

    iso.3.6.1.2.1.11.32.0 = Counter32: 0

    iso.3.6.1.4.1.8072.2.1.1.0 = INTEGER: 43

    iso.3.6.1.6.3.10.2.1.1.0 = Hex-STRING: 80 00 1F 88 80 28 B8 EF 53 96 13 43 38

    iso.3.6.1.6.3.10.2.1.2.0 = INTEGER: 6

    iso.3.6.1.6.3.10.2.1.3.0 = INTEGER: 1

    iso.3.6.1.6.3.10.2.1.4.0 = INTEGER: 1500

    iso.3.6.1.6.3.11.2.1.1.0 = Counter32: 0

    iso.3.6.1.6.3.11.2.1.2.0 = Counter32: 0

    iso.3.6.1.6.3.11.2.1.3.0 = Counter32: 0

    iso.3.6.1.6.3.15.1.1.1.0 = Counter32: 0

    iso.3.6.1.6.3.15.1.1.2.0 = Counter32: 0

    iso.3.6.1.6.3.15.1.1.3.0 = Counter32: 0

    iso.3.6.1.6.3.15.1.1.4.0 = Counter32: 0

    iso.3.6.1.6.3.15.1.1.5.0 = Counter32: 0

    iso.3.6.1.6.3.15.1.1.6.0 = Counter32: 0

    iso.3.6.1.6.3.15.1.2.1.0 = INTEGER: 0

    iso.3.6.1.6.3.16.1.1.1.1.0 = ""

    [...]

    --- Quote End ---

    So it is ok for the system mibs and some other infos, but nothing about my network interface (eth0)...

    My (simple) config :

    --- Quote Start ---

    rwcommunity private

    rocommunity public

    sysServices 2

    sysDescr XXX

    interface eth0 6 100000000

    --- Quote End ---

    As you can see I tried to add "interface eth0 6 100000000" to my conf file but it is not recognized by this version of net-snmp

    I can't figure out if net-snmp is able to "automatically" retrieve network interface, or if my issue is related to the nios2 linux environment I use. I googled a lot for nothing.

    Do I need to add a MIB in menuconfig (I tried mibII/ifTable mibII/interface mibII Rmon if-mib...) ?

    Do you have any idea ?

    Thanks
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I think that I need succeed to add modules in menuconfig : mibII/ifTable mibII/interface mibII Rmon if-mib

    But there is compilation errors, and if I let only mibII/interface snmpd hangs the system ...
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hello mr zben

    try add your mib at computar that you do snmpwalk (i dont remenber what directory but look like Mibs) and add that mib at /user/net-snmp/.../mibs

    good luck

    Franz Wagner