SNMP 基础

来源:互联网 发布:ubuntu selinux 编辑:程序博客网 时间:2024/06/05 23:48

Simple Network Management Protocol (SNMP) is a widely used protocol for monitoring the health and welfare of network equipment (eg. routers), computer equipment and even devices like UPSs. Net-SNMP is a suite of applications used to implement SNMP v1, SNMP v2c and SNMP v3 using both IPv4 and IPv6.

SNMP is an application-layer protocol that provides a message format for communication between SNMP managers and agents. SNMP provides a standardized framework and a common language used for the monitoring and management of devices in a network.

 

The SNMP framework has three parts:

 

An SNMP manager

 

An SNMP agent

 

A MIB

 

The SNMP manager is the system used to control and monitor the activities of network hosts using SNMP. The most common managing system is called a Network Management System (NMS). The term NMS can be applied to either a dedicated device used for network management, or the applications used on such a device. A variety of network management applications are available for use with SNMP. These features range from simple command-line applications to feature-rich graphical user interfaces (such as the CiscoWorks2000 line of products).

 

The SNMP agent is the software component within the managed device that maintains the data for the device and reports these data, as needed, to managing systems. The agent and MIB reside on the routing device (router, access server, or switch). To enable the SNMP agent on a Cisco routing device, you must define the relationship between the manager and the agent.

 

The Management Information Base (MIB) is a virtual information storage area for network management information, which consists of collections of managed objects. Within the MIB there are collections of related objects, defined in MIB modules. MIB modules are written in the SNMP MIB module language, as defined in STD 58, RFC 2578, RFC 2579, and RFC 2580 (see the "MIBs and RFCs" section for an explanation of RFC and STD documents). Note that individual MIB modules are also referred to as MIBs; for example, the Interfaces Group MIB (IF-MIB) is a MIB module withinthe MIB on your system.

 

The SNMP agent contains MIB variables whose values the SNMP manager can request or change through Get or Set operations. A manager can get a value from an agent or store a value into that agent. The agent gathers data from the MIB, the repository for information about device parameters and network data. The agent can also respond to manager requests to Get or Set data.

 

Figure 14 illustrates the communications relationship between the SNMP manager and agent. A manager can send the agent requests to get and set MIB values. The agent can respond to these requests. Independent of this interaction, the agent can send unsolicited notifications (traps or informs) to the manager to notify the manager of network conditions.

            Figure 14 Communication Between an SNMP Agent and Manager

 

 

MIBs and RFCs

 

MIB modules typically are defined in RFC documents submitted to the Internet Engineering Task Force (IETF), an international standards body. RFCs are written by individuals or groups for consideration by the Internet Society and the Internet community as a whole, usually with the intention of establishing a recommended Internet standard. Before being given RFC status, recommendations are published as Internet Draft (I-D) documents. RFCs that have become recommended standards are also labeled as standards (STD) documents. You can learn about the standards process and the activities of the IETF at the Internet Society website at http://www.isoc.org. You can read the full text of all RFCs, I-Ds, and STDs referenced in Cisco documentation at the IETF website at http://www.ietf.org.

 

The Cisco implementation of SNMP uses the definitions of MIB II variables described in RFC 1213 and definitions of SNMP traps described in RFC 1215.

 

Cisco provides its own private MIB extensions with every system. Cisco enterprise MIBs comply with the guidelines described in the relevant RFCs unless otherwise noted in the documentation. You can find the MIB module definition files and list of which MIBs are supported on each Cisco platform on the Cisco MIB website on Cisco.com.

 

For a list of new MIB-related functionality, see the "New MIB Features in Cisco IOS Release 12.2" section.

 

SNMP(Simple Network Management Protocal, 简单网络管理协议)在架构体系的监控子系统中将扮演重要角色。大体上,其基本原理是,在每一个被监控的主机或节点上 (如交换机)都运行了一个agent,用来收集这个节点的所有相关的信息,同时监听 snmp 的 port,也就是 UDP 161,并从这个端口接收来自监控主机的指令(查询和设置)。

        如果使用 RHEL4 的 net-snmp,那么被监控主机需要安装 net-snmp(包含了 snmpd 这个 agent),而监控端需要安装 net-snmp-utils。如果自行编译,需要 beecrypt(libbeecrypt)和 elf(libraryelf)的库。

        每一个 agent 维护一个树形的数据库,称为 MID(Management Information Base, 管理信息库),其每一个节点称为 Object Identifier(OID),这在使用 net-snmp-utils 的工具时会用到。这些节点就表示了这台主机系统的设备如网卡的接口描述(eth0 等)、物理地址(MAC)、接口类型等,也可能是系统的信息,或者是需要监控的进程等...       

       net-snmp-utils 的工具集的所有参数不能直接在其 man 手册中查到,可以查 man snmpcmd ,这个命令并不实际存在,只是说明的所有 utils 命令共同的参数。

SNMP MIBs base && some utils

      MIB(Management Information Base, 管理信息库)这个树形数据库是按照数字(numeric)来组织的,即每一个节点(OID)都是数字,因此有一个名字到数字的映射关系,例如 system , interfaces 这样的名字要映射到各个被控端的实际设备节点上,或反之需要知道实际的名字。所有这些映射关系的定义都在 MIB 文件中,即 /usr/share/snmp/mibs (根据实际的安装情况会有不同)。例如:

   sh$ grep 'system' /usr/share/snmp/mibs/SNMPv2-MIB.txt system OBJECT IDENTIFIER ::= { mib-2 1 } ......

   snmptranslate 这个命令可以用来查看映射关系:

  sh$ snmptranslate .1.3.6.1.2.1.1.3.0  SNMPv2-MIB::sysUpTime.0  sh$ snmptranslate -On SNMPv2-MIB::system.sysUpTime.0  .1.3.6.1.2.1.1.3.0

可以看到这个 SNMPv2-MIB 其实就是 /usr/share/snmp/mibs/SNMPv2-MIB.txt。

使用 snmpwalk 可以取得一个树的结果:

  sh$ snmpwalk -v2c -c public localhost system  SNMPv2-MIB::sysDescr.0 = STRING: Linux localhost.localdomain 2.6.14.2 #1 SMP Thu Jan 11 15:39:36 EST 2007 i686  SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10  SNMPv2-MIB::sysUpTime.0 = Timeticks: (687617) 1:54:36.17  SNMPv2-MIB::sysContact.0 = STRING: zhoupeng@zovatech.com  SNMPv2-MIB::sysName.0 = STRING: localhost.localdomain  SNMPv2-MIB::sysLocation.0 = STRING: Unknown (edit /etc/snmp/snmpd.conf)  SNMPv2-MIB::sysORLastChange.0 = Timeticks: (1) 0:00:00.01  SNMPv2-MIB::sysORID.1 = OID: IF-MIB::ifMIB.............
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 直播间有回音怎么办 XOX声卡有回音怎么办 电脑声卡有回音怎么办 戴尔笔记本没有声音怎么办 戴尔笔记本电脑没有声音怎么办 window10视频有回音怎么办 电脑麦克风有回音怎么办 win10话筒声音小怎么办 手机直播有回音怎么办 手机直播有回声怎么办 耳朵突然有回音怎么办 憋气耳膜不鼓怎么办 tt语音有回音怎么办? 无线话筒有回音怎么办 话筒发出刺耳声怎么办 刺激战场有回音怎么办 电脑音乐没有声音怎么办 额头小头发多怎么办 开瑜伽馆怎么办营业执照 急用100元钱怎么办 茶壶嘴底部漏水怎么办 茶壶嘴倒水回流怎么办 篮球气嘴漏气怎么办 网红气球漏气怎么办 哺乳期积乳囊肿怎么办 玩滑板怕摔怎么办 在农村结婚化妆怎么办 年检保单丢了怎么办 Excel排序不想要怎么办 科2考不过怎么办 红米手机变卡了怎么办 公司伙食有问题怎么办 拉小提琴不看谱怎么办 匡威白鞋子泛黄怎么办 婚礼主持突然打嗝怎么办 第一次上台演讲紧张怎么办 员工工作不积极怎么办 临时牌照怎么办进京证 第一次上台跳舞紧张怎么办 不倒翁沙袋吸盘不稳怎么办? 功夫贷逾期一天怎么办