R: R: extention snmp table with another sub-table inside

"Enzo Arlati" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>

-----Messaggio originale-----
Da: [email protected]
[mailto:[email protected]]Per conto di Dave
Shield
Inviato: mercoledì 8 novembre 2006 13.37
A: Enzo Arlati
Cc: [email protected]
Oggetto: Re: R: extention snmp table with another sub-table inside


On 07/11/06, Enzo Arlati <[email protected]> wrote:
> I look for some code which help to understand how tied seevral table of the same
> format to another master table, but I failed.
> What I want to achieve is to connect to a master table some child table
> ( more than one ) and with all the child table of the same kind.

Have you got the MIB definitions for the main table?
If you can let us have a copy of that, together with the structure of one of the
child tables,  we should be able to show you how to achieve this.

Dave
-----------------------------------------------



Thanks for your kindly offert to show me how to do the task.

Belowe I add the schema and the MIB descriptor of the what I want to build.
My problem is how to get a table crTablePanels and inside each of its row, named 
crEntryPanel I have to add and entry to crTableDevices, which is another table

In my previous version of this program I haven't the crTablePanels and the table crTableDevices where fitted just at top of schema ( cmv ).
At that time I have build the simple table using a pseudo-code like this 

    strcpy( table_name, "crTableDevices" );
    aesys_table_set_devices_devices = netsnmp_create_table_data_set( table_name );

    netsnmp_table_dataset_add_index(aesys_table_set_devices_devices, ASN_INTEGER );

    netsnmp_table_set_multi_add_default_row(aesys_table_set_devices_devices,
                                            COLUMN_INDEX,      ASN_INTEGER,   0, NULL, 0,
                                            COLUMN_TYPE,       ASN_INTEGER,   0, NULL, 0,
                                            COLUMN_STATUS,     ASN_INTEGER,   0, NULL, 0,
                                            COLUMN_DESCR,      ASN_OCTET_STR, 0, NULL, 0,
                                            COLUMN_STATO_VIS,  ASN_INTEGER,   0, NULL, 0,
                                            COLUMN_STATO_FLAG, ASN_INTEGER,   0, NULL, 0,
                                            COLUMN_MSG_VIS,    ASN_OCTET_STR, 0, NULL, 0,
                                            COLUMN_REV_FW,     ASN_OCTET_STR, 0, NULL, 0,
                                            0);

    and for each row
    ==================
    netsnmp_register_table_data_set( reginfo, aesys_table_set_devices_devices, NULL);
    
    aesys_UpdateRowTableDevice( DEVICE_ALFA1,        0, CODICE_ALFA,  ilvl, stato_vis, stato_flag, msgvis, rev_fw, descr );
    aesys_UpdateRowTableDevice( DEVICE_PITTO1,       0, CODICE_PITTO, ilvl, stato_vis, stato_flag, msgvis, rev_fw, descr );
    ........
    netsnmp_table_dataset_add_row( aesys_table_set_devices_devices, rows[idx] );



    Now to add all this under inside crTablePanels I tough that should use somethink similar, 
    with a column type which refere to an instance to crTableDevices , but this is not supported

    strcpy( table_name, "crTablePanels" );
    aesys_table_set_devices_panels = netsnmp_create_table_data_set( table_name );

    netsnmp_table_dataset_add_index(aesys_table_set_devices_panels, ASN_INTEGER );

    netsnmp_table_set_multi_add_default_row(aesys_table_set_devices_devices,
                                            COLUMN_INDEXPANEL,    ASN_INTEGER,   0, NULL, 0,
                                            COLUMN_TYPE,          ASN_INTEGER,   0, NULL, 0,
                                            COLUMN_STATUS,        ASN_INTEGER,   0, NULL, 0,
                                            COLUMN_REF_TO_DEVICE, ASN_THIS_SHOULD_BE_A_REF_TO_TABLE, 0, NULL, 0,
                                            0);

    How can do to emulate it in someway ?


The code has comment in Italian language. 
I don't think this comment should be helpfull to understand the MIB schema, so I didn't translation for it, 
but if some translation is required let me known ans I will provide for that.



[enzo@P0101222 tmp]$ snmptranslate -Tp -IR test-aesys
+--test-aesys(17378)
   |
   +--cmv(35)
   |  |
   |  +-- -R-- INTEGER   crNumber(1)
   |  +-- -R-- String    crVersion(2)
   |  +-- -R-- TimeTicks crStartime(3)
   |  +-- -R-- INTEGER   crDiskusage(4)
   |  +-- -R-- INTEGER   crActive(5)
   |  |
   |  +--crProcTable(6)
   |  |  |  Index: crIndexProcess
   |  |  |
   |  |  +--crProcEntry(1)
   |  |     |
   |  |     +-- ---- INTEGER   crIndexProcess(1)
   |  |     +-- -R-- EnumVal   stato(2)
   |  |     |        Values: lvlNull(0), lvlOk(1), lvlDegrado(2), lvlSpento(3)
   |  |     +-- -R-- String    nome(3)
   |  |
   |  +--crTipoPMV(7)
   |  |
   |  +--crSottoTipoPMV(8)
   |  |
   |  +-- -R-- EnumVal   crStatus(9)
   |  |        Values: lvlNull(0), lvlOk(1), lvlDegraded(2), lvlOff(3), lvlMaintenance(4)
   |  |
   |  +--crTablePanels(11)
   |     |  Index: crIndexPanels
   |     |
   |     +--crEntryPanel(1)
   |        |
   |        +-- ---- INTEGER   crIndexPanels(1)
   |        |
   |        +--crTipoPanel(2)
   |        |
   |        +-- -R-- EnumVal   crStatus(3)
   |        |        Values: lvlNull(0), lvlOk(1), lvlDegraded(2), lvlOff(3), lvlMaintenance(4)
   |        |
   |        +--crTableDevices(4)
   |           |  Index: crIndexDevices
   |           |
   |           +--crEntryDevice(1)
   |              |
   |              +-- ---- INTEGER   crIndexDevices(1)
   |              +-- -R-- INTEGER   crIndex(2)
   |              +-- -R-- EnumVal   crType(3)
   |              |        Values: devAlfanumerico(44), devPittogramma(45), devCentralina(46), devFrecciaCroce(47)
   |              +-- -R-- EnumVal   crStatus(4)
   |              |        Values: lvlNull(0), lvlOk(1), lvlDegraded(2), lvlOff(3), lvlMaintenance(4)
   |              +-- -R-- String    crDescr(5)
   |              +-- -R-- INTEGER   crStatoVisualizzazione(6)
   |              +-- -R-- INTEGER   crStatoFlag(7)
   |              +-- -R-- String    crMessaggioVisualizzato(8)
   |              +-- -R-- String    crFirmwareDisplay(9)
   |
   +--trapPmv(36)
      |
      +--A0(1701)
      +--A1(1702)
      +--A2(1703)
      +--A3(1704)
      +--A4(1705)
      +--A5(1706)
      +--A6(1707)
      +--LS04(1710)
      +--LS05(1711)
      +--LS06(1712)
      +--LS14(1713)
      +--LS15(1714)
      +--LS16(1715)
      +--LS24(1716)
      +--LS25(1717)
      +--LS26(1718)
      +--LS94(1737)
      +--LS95(1738)
      +--LS96(1739)



TEST-AESYS-MIB DEFINITIONS ::=BEGIN

--
--
-- Author : Enzo Arlati
-- Last update: 02.11.2006
--
--
-- File name : AESYS-MIB.txt
-- full path: /net-snmp/mibs/AESYS-MIB.txt & /usr/local/share/snmp/mibs/AESYS-MIB.txt
-- ASN.1 Description file *
-- Version 1.0 *
--
-- Description :Define the aesys MIB SR1
--

IMPORTS
    enterprises FROM SNMPv2-SMI,
    MODULE-IDENTITY FROM SNMPv2-SMI
    MODULE-COMPLIANCE, OBJECT-GROUP FROM SNMPv2-CONF;



test-aesys MODULE-IDENTITY
 LAST-UPDATED "0211060000Z"  -- 02 nov 2006
 ORGANIZATION "AESYS"
 CONTACT-INFO "
 Author: Enzo Arlati
 email: [email protected]
 "
 DESCRIPTION "MIB for PMV for aesys "
 ::={enterprises 17377 }



--groups in aesys
cmv OBJECT IDENTIFIER ::={test-aesys 35 }


--
-- CMV subsystem
--

crNumber OBJECT-TYPE
  SYNTAX INTEGER
  ACCESS read-only
  STATUS mandatory
  DESCRIPTION
  "The number of running process."
  ::={cmv 1 }

crVersion OBJECT-TYPE
  --SYNTAX DisplayString(SIZE (0..79))
  SYNTAX OCTET STRING
  ACCESS read-only
  STATUS mandatory
  DESCRIPTION
  "The software version of the linux o.s."
  ::={cmv 2 }

crStartime OBJECT-TYPE
  SYNTAX TimeTicks
  ACCESS read-only
  STATUS mandatory
  DESCRIPTION
  "The time since the cr01 was last started up."
  ::={cmv 3 }

crDiskusage OBJECT-TYPE
  SYNTAX INTEGER
  ACCESS read-only
  STATUS mandatory
  DESCRIPTION
  "The disk space percentage used on linux-box."
  ::={cmv 4 }

crActive OBJECT-TYPE
  SYNTAX INTEGER
  ACCESS read-only
  STATUS mandatory
  DESCRIPTION
  "A toggle to start or stop the subsystem (shutdown/restart all bcm processes)."
  ::={cmv 5 }

-- ----------------------------
--  Tabella dei processi bcm
-- ----------------------------

crProcTable OBJECT-TYPE
  SYNTAX SEQUENCE OF crProcEntry
  ACCESS read-only
  STATUS mandatory
  DESCRIPTION
  "Tabella dei processi bcm"
  INDEX   { crIndexProcess }
  ::={cmv 6 }

crProcEntry OBJECT-TYPE
  SYNTAX crProcEntry
  ACCESS read-only
  STATUS mandatory
  DESCRIPTION
  "Record con i parametri di un processo."
  ::={crProcTable 1 }

crProcEntry ::=
  SEQUENCE {
  crIndexProcess INTEGER,
  stato INTEGER,
  nome  OCTET STRING
  }


crIndexProcess OBJECT-TYPE
    SYNTAX      INTEGER
    ACCESS  not-accessible
    STATUS      current
    DESCRIPTION
        "Indice del processo."
    ::= { crProcEntry 1 }

stato OBJECT-TYPE
  SYNTAX INTEGER {
     lvlNull(0),
     lvlOk(1),
     lvlDegrado(2),
     lvlSpento(3)
  }
  ACCESS read-only
  STATUS mandatory
  DESCRIPTION
  "Livello di servizio del singolo device/displaty
   ( valori ammessi 1-Funzionante,2-degrado,3-Spento )  "
  ::={crProcEntry 2 }


nome OBJECT-TYPE
  SYNTAX OCTET STRING
  ACCESS read-only
  STATUS mandatory
  DESCRIPTION
  "Testo descrittivo del processo  "
  ::={crProcEntry 3 }

--
-- ----------------------------------
-- ----------------------------------
--


crTipoPMV OBJECT-TYPE
  SYNTAX DisplayString (SIZE (0..4))
  ACCESS read-only
  STATUS mandatory
  DESCRIPTION
  "Tipologia PMV ( es 430, 431 )."
  ::={cmv 7 }

crSottoTipoPMV OBJECT-TYPE
  SYNTAX DisplayString (SIZE (0..1))
  ACCESS read-only
  STATUS mandatory
  DESCRIPTION
  "Sottotipo Tipologia PMV ( es *, 1,2... )."
  ::={cmv 8 }

crStatus  OBJECT-TYPE
  SYNTAX INTEGER {
     lvlNull(0),
     lvlOk(1),
     lvlDegraded(2),
     lvlOff(3),
     lvlMaintenance(4)
  }
  ACCESS read-only
  STATUS mandatory
  DESCRIPTION
  "Livello di servizio del PMV "
  ::={cmv 9 }


-- -----------------------------
--  OLD -> Tabella dei device/display
-- posizione 10 lasciata libera per compatibilita' con vercchie revisioni
--  !!! DA VALUTARE !!!
-- -----------------------------

-- -----------------------------
--  Tabella dei cartelli/panel
-- -----------------------------
crTablePanels OBJECT-TYPE
  SYNTAX SEQUENCE OF crEntryPanel
  ACCESS read-only
  STATUS mandatory
  DESCRIPTION
  "Tabella dei Cartelli / (Panels)"
  INDEX   { crIndexPanels }
  ::={cmv 11 }

crEntryPanel OBJECT-TYPE
  SYNTAX crEntryPanel
  ACCESS read-only
  STATUS mandatory
  DESCRIPTION
  "Record con i parametri connessi ad uno specifico cartello"
  ::={crTablePanels 1 }

crEntryPanel ::=
  SEQUENCE {
  crIndexPanels    INTEGER,
  crTipoPanel      OCTET STRING,
  crStatus         INTEGER,
  crTableDevices   OBJECT-TYPE
  }

crIndexPanels OBJECT-TYPE
    SYNTAX      INTEGER
    ACCESS      not-accessible
    STATUS      current
    DESCRIPTION
        "Indice del device."
    ::= { crEntryPanel 1 }

crTipoPanel OBJECT-TYPE
  SYNTAX DisplayString (SIZE (0..4))
  ACCESS read-only
  STATUS mandatory
  DESCRIPTION
  "Tipologia Cartello ."
  ::={crEntryPanel 2 }

crStatus OBJECT-TYPE
  SYNTAX INTEGER {
     lvlNull(0),
     lvlOk(1),
     lvlDegraded(2),
     lvlOff(3),
     lvlMaintenance(4)
  }
  ACCESS read-only
  STATUS mandatory
  DESCRIPTION
  "Livello di servizio del singolo cartello ( valori ammessi 1-ok,2-degrado,3-Off,4-manutenzione )  "
  ::={crEntryPanel 3 }



crTableDevices OBJECT-TYPE
  SYNTAX SEQUENCE OF crEntryDevice
  ACCESS read-only
  STATUS mandatory
  DESCRIPTION
  "Tabella dei device/display"
  INDEX   { crIndexDevices }
  ::={crEntryPanel 4 }


-- -----------------------------
--  Tabella dei device/display
-- -----------------------------


crEntryDevice OBJECT-TYPE
  SYNTAX crEntryDevice
  ACCESS read-only
  STATUS mandatory
  DESCRIPTION
  "Record con i parametri connessi ad uno specifico device/display"
  ::={crTableDevices 1 }


crEntryDevice ::=
  SEQUENCE {
  crIndexDevices   INTEGER,
  crIndex          INTEGER,
  crType           INTEGER,
  crStatus         INTEGER,
  crDescr          OCTET STRING
  }


crIndexDevices OBJECT-TYPE
    SYNTAX      INTEGER
    ACCESS      not-accessible
    STATUS      current
    DESCRIPTION
        "Indice del device."
    ::= { crEntryDevice 1 }

crIndex OBJECT-TYPE
  SYNTAX INTEGER
  ACCESS read-only
  STATUS mandatory
  DESCRIPTION
  "The number of device of a specified type ( ex Pitto1 = 0, Pitto2 = 1 )."
  ::={crEntryDevice 2 }


crType OBJECT-TYPE
  SYNTAX INTEGER {
     devAlfanumerico(44),
     devPittogramma(45),
     devCentralina(46),
     devFrecciaCroce(47)
  }
  ACCESS read-only
  STATUS mandatory
  DESCRIPTION
  "Type del dispositivo ( 44=alfa, 45=pitto, 46=centralina, 47=frecciaCroce )  "
  ::={crEntryDevice 3 }

crStatus OBJECT-TYPE
  SYNTAX INTEGER {
     lvlNull(0),
     lvlOk(1),
     lvlDegraded(2),
     lvlOff(3),
     lvlMaintenance(4)
  }
  ACCESS read-only
  STATUS mandatory
  DESCRIPTION
  "Livello di servizio del singolo device/displaty ( valori ammessi 1-ok,2-degrado,3-Off,4-manutenzione )  "
  ::={crEntryDevice 4 }

crDescr OBJECT-TYPE
  SYNTAX OCTET STRING
  ACCESS read-only
  STATUS mandatory
  DESCRIPTION
  "Testo descrittivo del dispositivo  "
  ::={crEntryDevice 5 }

crStatoVisualizzazione OBJECT-TYPE
  SYNTAX INTEGER
  ACCESS read-only
  STATUS mandatory
  DESCRIPTION
  "Indica lo stato della visualizzazione ( T=testo impostato, B=blank voluto, A=blank per accensione, P=blank per assenza polling )."
  ::={crEntryDevice 6 }

crStatoFlag OBJECT-TYPE
  SYNTAX INTEGER
  ACCESS read-only
  STATUS mandatory
  DESCRIPTION
  "Flag di stato del display definito nel comando RPO."
  ::={crEntryDevice 7 }

crMessaggioVisualizzato OBJECT-TYPE
  SYNTAX OCTET STRING
  ACCESS read-only
  STATUS mandatory
  DESCRIPTION
  "Messaggio completo visualizzato dal display  "
  ::={crEntryDevice 8 }

crFirmwareDisplay OBJECT-TYPE
  SYNTAX OCTET STRING
  ACCESS read-only
  STATUS mandatory
  DESCRIPTION
  "Revisione del firmware installato sul display  "
  ::={crEntryDevice 9 }



--
-- TRAPs pmv aesys
--

trapPmv OBJECT IDENTIFIER ::={test-aesys 36 }

-- --------------------------------------------------------
-- avvio/spegnimento sistema
-- --------------------------------------------------------

A0 NOTIFICATION-TYPE
--	STATUS current
        OBJECTS { crActive }
	DESCRIPTION "Restart del sistema pmv"
        ::= { trapPmv 1701 }

A1 NOTIFICATION-TYPE
	STATUS current
        OBJECTS { crActive }
	DESCRIPTION "Caduta del sistema pmv"
        ::= { trapPmv 1702 }

-- --------------------------------------------------------
-- soglie file system
-- --------------------------------------------------------

A2 NOTIFICATION-TYPE
	STATUS current
        OBJECTS { crDiskusage }
	DESCRIPTION "Superamento della prima soglia di occupazione del file-system"
        ::= { trapPmv 1703 }

A3 NOTIFICATION-TYPE
	STATUS current
        OBJECTS { crDiskusage }
	DESCRIPTION "Superamento della seconda soglia di occupazione del file-system
	             (Inviato ogni 5 minuti fino a quando persiste la condizione di errore)"
        ::= { trapPmv 1704 }

-- --------------------------------------------------------
-- variazioni livello servizio generale ( da valutare )
-- --------------------------------------------------------

A4 NOTIFICATION-TYPE
	STATUS current
        OBJECTS { crStatus }
	DESCRIPTION "Variazione di stato del PMV che diventa efficente "
        ::= { trapPmv 1705 }

A5 NOTIFICATION-TYPE
	STATUS current
        OBJECTS { crStatus }
	DESCRIPTION "Variazione di stato del PMV che va in degrado "
        ::= { trapPmv 1706 }

A6 NOTIFICATION-TYPE
	STATUS current
        OBJECTS { crStatus }
	DESCRIPTION "Variazione di stato del PMV che va in avaria "
        ::= { trapPmv 1707 }


-- --------------------------------------------------------
-- variazioni livello servizio cartello 0
-- --------------------------------------------------------

LS04 NOTIFICATION-TYPE
	STATUS current
        OBJECTS { crStatus }
	DESCRIPTION "Variazione di stato del Cartello che diventa efficente "
        ::= { trapPmv 1710 }

LS05 NOTIFICATION-TYPE
	STATUS current
        OBJECTS { crStatus }
	DESCRIPTION "Variazione di stato del Cartello che va in degrado "
        ::= { trapPmv 1711 }

LS06 NOTIFICATION-TYPE
	STATUS current
        OBJECTS { crStatus }
	DESCRIPTION "Variazione di stato del Cartello che va in avaria "
        ::= { trapPmv 1712 }



-- --------------------------------------------------------
-- variazioni livello servizio cartello 1
-- --------------------------------------------------------

LS14 NOTIFICATION-TYPE
	STATUS current
        OBJECTS { crStatus }
	DESCRIPTION "Variazione di stato del Cartello che diventa efficente "
        ::= { trapPmv 1713 }

LS15 NOTIFICATION-TYPE
	STATUS current
        OBJECTS { crStatus }
	DESCRIPTION "Variazione di stato del Cartello che va in degrado "
        ::= { trapPmv 1714 }

LS16 NOTIFICATION-TYPE
	STATUS current
        OBJECTS { crStatus }
	DESCRIPTION "Variazione di stato del Cartello che va in avaria "
        ::= { trapPmv 1715 }


	

-- --------------------------------------------------------
-- variazioni livello servizio cartello 2
-- --------------------------------------------------------

LS24 NOTIFICATION-TYPE
	STATUS current
        OBJECTS { crStatus }
	DESCRIPTION "Variazione di stato del Cartello che diventa efficente "
        ::= { trapPmv 1716 }

LS25 NOTIFICATION-TYPE
	STATUS current
        OBJECTS { crStatus }
	DESCRIPTION "Variazione di stato del Cartello che va in degrado "
        ::= { trapPmv 1717 }

LS26 NOTIFICATION-TYPE
	STATUS current
        OBJECTS { crStatus }
	DESCRIPTION "Variazione di stato del Cartello che va in avaria "
        ::= { trapPmv 1718 }


-- --------------------------------------------------------
-- variazioni livello servizio cartello 9
-- --------------------------------------------------------

LS94 NOTIFICATION-TYPE
	STATUS current
        OBJECTS { crStatus }
	DESCRIPTION "Variazione di stato del Cartello che diventa efficente "
        ::= { trapPmv 1737 }

LS95 NOTIFICATION-TYPE
	STATUS current
        OBJECTS { crStatus }
	DESCRIPTION "Variazione di stato del Cartello che va in degrado "
        ::= { trapPmv 1738 }

LS96 NOTIFICATION-TYPE
	STATUS current
        OBJECTS { crStatus }
	DESCRIPTION "Variazione di stato del Cartello che va in avaria "
        ::= { trapPmv 1739 }



END



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.