2013-05-29 201 views
7

我有一個MIB,我開始工作,但smilint抱怨缺少一致性組。如何將此一致性組添加到我的文件?SNMP MIB SMIv2一致性組問題

BLEH-PRODUCT-MIB DEFINITIONS ::= BEGIN 

-- Objects in this MIB are implemented in the local SNMP agent. 

    IMPORTS 
      MODULE-IDENTITY, OBJECT-TYPE, Integer32, enterprises 
        FROM SNMPv2-SMI; 

    blehProductMIB MODULE-IDENTITY 
    LAST-UPDATED "201305290000Z" 
    ORGANIZATION "Bleh Corporation" 
    CONTACT-INFO "   Joe Shmoe 
        Postal: Bleh Corporation 
           23 Telnet Road 
           Ottawa, ON, K1K 1K1 
           Canada 

        Tel:  +1 555 555 5555 x5555 
        Fax:  +1 555 555 5556 
        E-mail: [email protected]" 
    DESCRIPTION "MIB module describing Product objects." 
    REVISION "201305290000Z" 
    DESCRIPTION "Initial" 
    ::= { bleh 911 } 

    bleh    OBJECT IDENTIFIER ::= { enterprises 54321 } 

    productStatus OBJECT-TYPE 
      SYNTAX  OCTET STRING (SIZE (0..65535)) 
      MAX-ACCESS read-only 
      STATUS  current 
      DESCRIPTION "The status of the Product system 
         Details are shown as text" 
      ::= { blehProductMIB 1 } 


    binaryProductStatus OBJECT-TYPE 
      SYNTAX  Integer32 (0..1) 
      MAX-ACCESS read-only 
      STATUS  current 
      DESCRIPTION "The status of the Product system 
         Zero is unhealthy and One is healthy" 
      ::= { blehProductMIB 2 } 
END 

smilint輸出:

$ smilint ./BLEH-PRODUCT-MIB 
./BLEH-PRODUCT-MIB:28: warning: node `productStatus' must be contained in at least one conformance group 
./BLEH-PRODUCT-MIB:37: warning: node `binaryProductStatus' must be contained in at least one conformance group 

回答

7

它只是意味着你的MIB文檔中定義對象類型的實體之前,應該定義對象的實體組。

採取RFC 1907年爲例,

http://tools.ietf.org/html/rfc1907

snmpGroup OBJECT-GROUP 
    OBJECTS { snmpInPkts, 
       snmpInBadVersions, 
       snmpInASNParseErrs, 
       snmpSilentDrops, 
       snmpProxyDrops, 
       snmpEnableAuthenTraps } 
    STATUS current 
    DESCRIPTION 
      "A collection of objects providing basic instrumentation and 
      control of an SNMPv2 entity." 
    ::= { snmpMIBGroups 8 } 

首先定義,然後

snmpInPkts OBJECT-TYPE 
    SYNTAX  Counter32 
    MAX-ACCESS read-only 
    STATUS  current 
    DESCRIPTION 
      "The total number of messages delivered to the SNMP entity 
      from the transport service." 
    ::= { snmp 1 } 

關於爲什麼羣體是重要的,你可以閱讀RFC 2580

http://tools.ietf.org/html/rfc2580

由於您要定義組,因此建議添加關聯的MODULE-COMPLIANCE。

+0

好的,但是oid呢?我應該怎樣設置它?另外我該如何避免對象組參考警告?我需要一個MODULE COMPLIANCE部分嗎? –

+0

沒有關於OID選擇的嚴格規定,但您可以遵循行業最佳實踐(例如,http://tools.cisco.com/Support/SNMP/do/BrowseMIB.do?local=en&step=2&submitClicked中的思科風格=真mibName = CISCO-IETF-DOT11-QOS-MIB#依賴性)。由於您要定義組,因此建議添加關聯的MODULE-COMPLIANCE。 –

+0

您能否將MODULE-COMPLIANCE部分添加到您的答案中,以便我可以接受它? –