SNMP MIB库

-- mib文件的开头指定文件名,并且使用BEGIN开始,文件的最后用END结束
-- IMPORTS就相当与c语言中的include,包含需要使用的一些数据类型
-- 通过FROM指定引用的来源
MOXA-CN2600-MIB DEFINITIONS ::= BEGIN
    IMPORTS
        enterprises,
        IpAddress,
        OBJECT-TYPE            FROM SNMPv2-SMI
        DateAndTime,
        TEXTUAL-CONVENTION,
        MacAddress,
        DisplayString         FROM SNMPv2-TC;

-- 不同的公司在enterprises节点下注册注册自己的id,moxa的节点是8691
-- 使用OBJECT IDENTIFIER指定OID
    moxa                 OBJECT IDENTIFIER ::= { enterprises 8691 }    -- 1.3.6.1.4.1.8691
-- 指定nport串口服务器是在moxa节点下的分支,id是2
-- oid:  1.3.6.1.4.1.8691.2
    nport OBJECT IDENTIFIER ::= { moxa 2 }            -- 1.3.6.1.4.1.8691.2
-- 产品型号cn2600,是在nport串口服务器分支下,节点是11
-- oid:  1.3.6.1.4.1.8691.2.11
    cn2600   MODULE-IDENTITY
        LAST-UPDATED "201003040000Z"
        ORGANIZATION "Moxa Inc."
        CONTACT-INFO
                "Email: support@moxa.com
                 Tel  : +886 2 89191230 ext.300"
                 
        DESCRIPTION
                "The MIB module for Moxa Terminal Server CN2600 series specific information."            
    
        ::= { nport 11 }    -- 1.3.6.1.4.1.8691.2.11
    
-- -------------------------------------------------------------
-- groups in the MOXA-CN2600-2AC MIB
-- -------------------------------------------------------------

swMgmt        OBJECT IDENTIFIER ::= { cn2600 1 }            -- 1.3.6.1.4.1.8691.2.11.1    

-- -------------------------------------------------------------
-- Textual Conventions
-- -------------------------------------------------------------

PortList ::= TEXTUAL-CONVENTION
    STATUS            current
    DESCRIPTION        
        "Each octet within this value specifies a set of eight
        ports, with the first octet specifying ports 1 through
        8, the second octet specifying ports 9 through 16, etc.
        Within each octet, the most significant bit represents
        the lowest numbered port, and the least significant bit
        represents the highest numbered port.  Thus, each port
        of the bridge is represented by a single bit within the
        value of this object.  If that bit has a value of '1'
        then that port is included in the set of ports; the port
        is not included if its bit has a value of '0'."
    SYNTAX      OCTET STRING
    
-- -------------------------------------------------------------
-- swMgmt group
-- -------------------------------------------------------------

-- -------------------------------------------------------------
-- Overview
-- -------------------------------------------------------------

    overview OBJECT IDENTIFIER ::= { swMgmt 1 }        -- 1.3.6.1.4.1.8691.2.11.1.1
-- 模块名称
-- 类型:DisplayString,类似字符串
-- 访问权限:只读
-- 状态:当前
-- id: overview 1
-- 1.3.6.1.4.1.8691.2.11.1.1.1
    modelName OBJECT-TYPE
        SYNTAX DisplayString
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
            "The model name of the CN2600."
        ::= { overview 1 }                            -- 1.3.6.1.4.1.8691.2.11.1.1.1
-- 数据类型:整型
    serialNumber OBJECT-TYPE
        SYNTAX INTEGER
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
            "The serial number of the CN2600. Every Terminal Server CN2600
            series is assigned a unique serial
            number before it is shipped."
        ::= { overview 2 }
    
    firmwareVersion OBJECT-TYPE
        SYNTAX DisplayString
        MAX-ACCESS read-only                
        STATUS current
        DESCRIPTION
            "The version of the firmware currently running on the CN2600."
        ::= { overview 3 }
-- 类型:ip地址
    viewLan1IpAddress OBJECT-TYPE
        SYNTAX IpAddress
        MAX-ACCESS read-only               
        STATUS current
        DESCRIPTION
            "The IP address of the CN2600's LAN1 interface."
        ::= { overview 4 }
-- 类型:mac地址
    viewLan1MacAddress OBJECT-TYPE
        SYNTAX MacAddress
        MAX-ACCESS read-only               
        STATUS current
        DESCRIPTION
            "The MAC address of the CN2600's LAN1 interface."
        ::= { overview 5 }

-- 省略其中的一些。。。。。

-- 可以指定整型的范围之后0,1两个值,类似枚举
-- 前面的"power-off","power-on"用于描述
    power1Status  OBJECT-TYPE
        SYNTAX INTEGER {
            power-off(0),
            power-on(1)
        }
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
            "The on/off status of power 1"
        ::= { overview 11 }

    power2Status  OBJECT-TYPE
        SYNTAX INTEGER {
            power-off(0),
            power-on(1)
        }
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
            "The on/off status of power 2 for 2AC model"
        ::= { overview 12 }

-- -------------------------------------------------------------
-- Basic settings
-- -------------------------------------------------------------

    basicSetting OBJECT IDENTIFIER ::= { swMgmt 2}            -- 1.3.6.1.4.1.8691.2.11.1.2

-- -------------------------------------------------------------
-- Basic settings -> Server settings
-- -------------------------------------------------------------
    
    serverSetting OBJECT IDENTIFIER ::= { basicSetting 1 }    -- 1.3.6.1.4.1.8691.2.11.1.2.1
    
    serverName OBJECT-TYPE
        SYNTAX DisplayString
        MAX-ACCESS read-write                
        STATUS current
        DESCRIPTION
            "A text string used to identify the CN2600."
        ::= { serverSetting 1 }
       
    serverLocation OBJECT-TYPE
        SYNTAX DisplayString
        MAX-ACCESS read-write                
        STATUS current
        DESCRIPTION
            "A text string used to identify the location of the CN2600. This
            option is useful for specifying the location or
            application of different CN2600."
        ::= { serverSetting 2 }
        
-- -------------------------------------------------------------
-- Basic settings -> Time settings
-- -------------------------------------------------------------
    
    timeSetting OBJECT IDENTIFIER ::= { basicSetting 2 }    -- 1.3.6.1.4.1.8691.2.11.1.2.2
-- 时间设置,可以进行读写    
    timeZone OBJECT-TYPE
        SYNTAX INTEGER
        MAX-ACCESS read-write                
        STATUS current
        DESCRIPTION
            "The time-zone index of the CN2600."
        ::= { timeSetting 1 }
    
    localTime OBJECT-TYPE
        SYNTAX DateAndTime
        MAX-ACCESS read-write               
        STATUS current
        DESCRIPTION
            "The system time in seconds since 1970/1/1."
        ::= { timeSetting 2 }

-- -------------------------------------------------------------
-- Serial port settings
-- -------------------------------------------------------------

    portSetting OBJECT IDENTIFIER ::= { swMgmt 4 }            -- 1.3.6.1.4.1.8691.2.11.1.2.4
    
-- -------------------------------------------------------------
-- Serial port settings -> Operation Modes settings
-- -------------------------------------------------------------

    opModeSetting OBJECT IDENTIFIER ::= { portSetting 1 }    -- 1.3.6.1.4.1.8691.2.11.1.2.4.1
    
-- --------------------------------------------------------------------------------------
-- Serial port settings -> Operation Modes settings -> Operation Modes
-- --------------------------------------------------------------------------------------

    opMode OBJECT IDENTIFIER ::= { opModeSetting 1 }        -- 1.3.6.1.4.1.8691.2.11.1.2.4.1.1
-- 表类型的定义    
-- 使用SEQUENCE OF定义一种新的类型OpModePortEntry
-- 有点像C语言中结构体的定义
-- opModePortTable是表名,开头必须小写,并且结尾必须包含"Table"
-- 1.3.6.1.4.1.8691.2.11.1.2.4.1.1.1
    opModePortTable OBJECT-TYPE
        SYNTAX SEQUENCE OF OpModePortEntry
        MAX-ACCESS not-accessible               
        STATUS current
        DESCRIPTION
            "The serial ports' operation mode table."
        ::= { opMode 1 }
-- 表中一行的名称:opModePortEntry,每行数据的数据类型是一样的
-- 类型是:OpModePortEntry
-- 1.3.6.1.4.1.8691.2.11.1.2.4.1.1.1.1
-- 表中第一个必须是INDEX,作为索引,并且是不可访问的。
    opModePortEntry OBJECT-TYPE
        SYNTAX OpModePortEntry
        MAX-ACCESS not-accessible               
        STATUS current
        DESCRIPTION
            "The serial port's operation mode entry."
        INDEX { portIndex }
        ::= { opModePortTable 1 }

-- 表中数据类型 ,类似结构体定义,并且第一个是INDEX
-- 一行中,每一列的数据类型定义如下
-- INDEX如果前面定义了,就说使用前面一个表的索引,那么这里也可以省略
    OpModePortEntry ::=
        SEQUENCE {
            portIndex
                INTEGER,
            portApplication
                INTEGER,
            portMode
                INTEGER
        }
-- 对索引的定义,权限不可访问,里面没有数据,所以访问也没有意义
-- 1.3.6.1.4.1.8691.2.11.1.2.4.1.1.1.1.1
-- 在一行opModePortEntry中,第一个元素
    portIndex OBJECT-TYPE
        SYNTAX INTEGER
        MAX-ACCESS read-only                
        STATUS current
        DESCRIPTION
            "The serial port index."
        ::= { opModePortEntry 1 }

-- 表中一行中第二个元素的定义
-- 1.3.6.1.4.1.8691.2.11.1.2.4.1.1.1.1.2
    portApplication OBJECT-TYPE
        SYNTAX INTEGER {
            disable(0),
            device-Control(4),
            socket(11),
            redundant-Com(5),
            drdas(9),
            terminal(2),
            reverse-Terminal(3),               
            dial-InOut(1)
        }
        MAX-ACCESS read-write                
        STATUS current
        DESCRIPTION
            "The application of the serial port.
            Note that changing this setting may also change the
            operation mode."
        ::= { opModePortEntry 2 }
    
-- 1.3.6.1.4.1.8691.2.11.1.2.4.1.1.1.1.3
    portMode OBJECT-TYPE
        SYNTAX INTEGER {  
            real-Com(2),
            slip(4),
            slipd(5),
            ppp(6),
            disable(7),
            telnetd(8),
            dynamic(9),
            tcp-Server(10),
            tcp-Client(13),
            udp(14),
            pppd(15),
            term-ASC(16),
            term-BIN(17),
            rfc-2217(20),
            redundant-Com(22),
            drdas-Real-Com(23),
            drdas-Tcp-Server(24),
        }
        MAX-ACCESS read-write                
        STATUS current
        DESCRIPTION
            "The operation mode of the serial port. Note that
            changing this setting may also change the application."
        ::= { opModePortEntry 3 }
        
END

 

posted @ 2015-08-19 23:58  SuperTao1024  阅读(5375)  评论(1编辑  收藏  举报