2011-02-03 16 views
5

Sto scrivendo un gestore SNMP e un agente SNMP simulato da un MIB (per testare un manager). Ho una tabella simile al seguente che il gestore dovrebbe essere in grado di aggiungere/eliminare righe. Qual è il modo abituale per farlo usando RowStatus? RowStatus è impostato per primo? È possibile includere altri OID nella PDU?Come usare RowStatus?

Il mio caso di utilizzo iniziale è che la tabella è vuota all'avvio. Quindi, se io mando un PDU SET come questo:

createStuffEntry.1.1.1 = 1 
createStuffEntry.2.1.1 = 1 
createStuffEntry.3.1.1 = 99 
createStuffEntry.4.1.1 = "Dustbunnies" 
createStuffEntry.5.1.1 = 5 

Nel caso che il lavoro per la definizione di seguito? Cosa dovrebbe succedere se cRowStatus viene omesso?

createStuffTable OBJECT-TYPE 
    SYNTAX SEQUENCE OF CreateStuffEntry 
    ACCESS not-accessible 
    STATUS mandatory 
    DESCRIPTION 
      "A table for creating stuff." 
    ::= { parentGroup 1 } 

createStuffEntry OBJECT-TYPE 
    SYNTAX CreateStuffEntry 
    ACCESS not-accessible 
    STATUS mandatory 
    DESCRIPTION 
      "An entry for building a stuff to create." 
    INDEX { cPlanID, cID } 
    ::= { createStuffTable 1 } 

CreateStuffEntry ::= 
    SEQUENCE { 
     cPlanID 
      INTEGER, 
     cID 
      INTEGER, 
     cTemplateID 
      INTEGER, 
     cStuffName 
      DisplayString, 
     cRowStatus 
      RowStatus 
    } 

cPlanID OBJECT-TYPE 
    SYNTAX INTEGER 
    ACCESS read-write 
    STATUS mandatory 
    DESCRIPTION 
      "The plan ID (cpPlanID)" 
    ::= { createStuffEntry 1 } 

cID OBJECT-TYPE 
    SYNTAX INTEGER 
    ACCESS read-write 
    STATUS mandatory 
    DESCRIPTION 
      "The table entry index." 
    ::= { createStuffEntry 2 } 

cTemplateID OBJECT-TYPE 
    SYNTAX INTEGER 
    ACCESS read-write 
    STATUS mandatory 
    DESCRIPTION 
      "The ID of the stuff template to create this stuff from." 
    ::= { createStuffEntry 3 } 

cStuffName OBJECT-TYPE 
    SYNTAX DisplayString 
    ACCESS read-write 
    STATUS mandatory 
    DESCRIPTION 
      "The stuff name." 
    ::= { createStuffEntry 4 } 


cRowStatus OBJECT-TYPE 
    SYNTAX RowStatus 
    ACCESS read-write 
    STATUS current 
    DESCRIPTION 
     "This OID uses six main statuses: 
     active(1)   is in use and available in stuffTable 
     notinService(2) it is present but not yet created 
     notReady(3)  it is present but missing info 
     createAndGo(4) create stuff in stuffTable. Row will be 
          added to this table if necessary. 
     createAndWait(5) add stuff row to this table 
     destroy(6)  will remove the stuff row 

     This OID is used to add/remove rows for stuff creation. 
     It can also be used to determine if a stuff has been 
     created successfully." 
    ::= { createStuffEntry 5 } 

Nota questa è una v1 MIB SMI utilizzando RowStatus come un tipo definito, simile a quello descritto here. Quindi la creazione di una lettura è implicita, piuttosto che qui dichiarata.

risposta

3

La convenzione testuale RowStatus offre in effetti un buon margine di manovra all'agente nel modo in cui viene implementato. Così, un gestore deve supportare entrambi i modi e l'agente deve supportare un solo (ma potrebbe sostenere due):

  1. PDU consecutiva:
    1. Impostare la variabile di stato riga "createAndWait"
    2. impostare tutte le colonne che si desidera configurare (in una PDU o molti)
    3. impostare la variabile di stato di riga a "attivo"
  2. impostare la variabile di stato di riga a "createAndGo" e comprendono tutte ** ** le variabili tu nee d per impostare in una singola PDU

Sfortunatamente, un manager deve essere intelligente e sapere come parlare con gli agenti che supportano l'uno o l'altro. La convinzione generale è che i manager sono più grandi e hanno più spazio per codificare le problematiche rispetto agli agenti semplici. Tuttavia, molti piccoli dispositivi supportano solo il n.

+0

Nel numero 2 l'agente si aspetta che la variabile di stato della riga sia la prima caricata nella PDU? Dovrebbe importare? –

+2

Non dovrebbe ** importare, ma l'unica cosa che ho imparato nel corso degli anni è che le persone scrivono codice che non segue le regole e fa aspettative che non dovrebbero. Quindi ... lo metterei per primo perché alcuni agenti probabilmente se lo aspettano. –

+1

Ho avuto a che fare con agenti SNMP di Nortel che non potevano distinguere tra oggetti scalari e colonnari e agenti Cisco che potevano abbattere uno switch ATM aziendale. SNMP è piuttosto semplice ed è sorprendente il modo in cui pochi implementatori leggono effettivamente gli RFC. –