mib文件构建,标量,一维表量,二维表量
程序员文章站
2022-07-14 21:47:58
...
mib文件的注释是“--”
mib文件名:ZINFO-DEV-MIB.txt
1. mib文件
mib开头和结尾必须如下:
ZINFO-DEV-MIB DEFINITIONS ::= BEGIN
END
2.mib的import:
IMPORTS
enterprises
FROM RFC1155-SMI
OBJECT-GROUP, MODULE-COMPLIANCE, NOTIFICATION-GROUP
FROM SNMPv2-CONF
Integer32, Unsigned32, OBJECT-TYPE, MODULE-IDENTITY, NOTIFICATION-TYPE
FROM SNMPv2-SMI
DisplayString
FROM SNMPv2-TC;
3.标量例程
ZINFO-DEV-MIB DEFINITIONS ::= BEGIN
-- imports
IMPORTS
enterprises
FROM RFC1155-SMI
OBJECT-GROUP, MODULE-COMPLIANCE, NOTIFICATION-GROUP
FROM SNMPv2-CONF
Integer32, Unsigned32, OBJECT-TYPE, MODULE-IDENTITY, NOTIFICATION-TYPE
FROM SNMPv2-SMI
DisplayString
FROM SNMPv2-TC;
-- info
info OBJECT IDENTIFIER ::= {enterprises 1314}
adminCard OBJECT IDENTIFIER ::= {info 10001}
adminCardState OBJECT-TYPE
SYNTAX Integer32 {
off(0),
on(1)
}
MAX-ACCESS read-only
STATUS current
DESCRIPTION "admin card get set message"
::= {adminCard 1}
END
4.一维表量例程:
ZINFO-DEV-MIB DEFINITIONS ::= BEGIN
-- imports
IMPORTS
enterprises
FROM RFC1155-SMI
OBJECT-GROUP, MODULE-COMPLIANCE, NOTIFICATION-GROUP
FROM SNMPv2-CONF
Integer32, Unsigned32, OBJECT-TYPE, MODULE-IDENTITY, NOTIFICATION-TYPE
FROM SNMPv2-SMI
DisplayString
FROM SNMPv2-TC;
-- info
info OBJECT IDENTIFIER ::= {enterprises 1314}
switchCardInfoTable OBJECT IDENTIFIER ::= {info 10002}
switchCardInfoTable OBJECT-TYPE
SYNTAX SEQUENCE OF switchCardInfoEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION "This is switch Card table."
::= {info 10002}
switchCardInfoEntry OBJECT-TYPE
SYNTAX switchCardInfoEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION "This is switch Card Info entry."
INDEX {switchCardInfoIndex}
::= {switchCardInfoTable 1}
switchCardInfoEntry ::= SEQUENCE{
switchCardInfoIndex Integer32,
switchCardState Integer32,
}
switchCardInfoIndex OBJECT-TYPE
SYNTAX Integer32
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION ""
::= {switchCardInfoEntry 1}
switchCardState OBJECT-TYPE
SYNTAX Integer32 {
off(0),
on(1)
}
MAX-ACCESS read-only
STATUS current
DESCRIPTION ""
::= {switchCardInfoEntry 2}
END
5.二维表量例程
ZINFO-DEV-MIB DEFINITIONS ::= BEGIN
-- imports
IMPORTS
enterprises
FROM RFC1155-SMI
OBJECT-GROUP, MODULE-COMPLIANCE, NOTIFICATION-GROUP
FROM SNMPv2-CONF
Integer32, Unsigned32, OBJECT-TYPE, MODULE-IDENTITY, NOTIFICATION-TYPE
FROM SNMPv2-SMI
DisplayString
FROM SNMPv2-TC;
-- info
info OBJECT IDENTIFIER ::= {enterprises 1314}
switchCardNetInfoTable OBJECT IDENTIFIER ::= {info 10003}
switchCardNetInfoTable OBJECT-TYPE
SYNTAX SEQUENCE OF switchCardNetInfoEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION "This is switch Card table."
::= {info 10003}
switchCardNetInfoEntry OBJECT-TYPE
SYNTAX switchCardNetInfoEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION "This is switch Card Info entry."
INDEX {switchCardXInfoIndex,switchCardNetInfoIndex}
::= {switchCardNetInfoTable 1}
switchCardNetInfoEntry ::= SEQUENCE{
switchCardXInfoIndex Integer32,
switchCardNetInfoIndex Integer32,
switchCardNetState Integer32
}
switchCardXInfoIndex OBJECT-TYPE
SYNTAX Integer32
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION ""
::= {switchCardNetInfoEntry 1}
switchCardNetInfoIndex OBJECT-TYPE
SYNTAX Integer32
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION ""
::= {switchCardNetInfoEntry 2}
switchCardNetState OBJECT-TYPE
SYNTAX Integer32 {
up(1),
down(0)
}
MAX-ACCESS read-only
STATUS current
DESCRIPTION ""
::= {switchCardNetInfoEntry 3}
END
Net-snmp安装开发流程:
https://blog.csdn.net/cao849861802/article/details/120780022
mib文件构建,标量,一维表量,二维表量:
https://blog.csdn.net/cao849861802/article/details/120781360
Mib2c构建.C和.H文件,标量,一维表量,二维表量,表量索引:
https://blog.csdn.net/cao849861802/article/details/120781424
修改mib2c生成的.c文件:
https://blog.csdn.net/cao849861802/article/details/120781464
为net-snmp添加新的节点.c,添加私有节点:
https://blog.csdn.net/cao849861802/article/details/120781500
上一篇: SQL 分组取最新的一条数据的方法
推荐阅读