收藏 分销(赏)

Agent--中文译文.doc

上传人:仙人****88 文档编号:9311931 上传时间:2025-03-21 格式:DOC 页数:40 大小:275.82KB 下载积分:10 金币
下载 相关 举报
Agent--中文译文.doc_第1页
第1页 / 共40页
Agent--中文译文.doc_第2页
第2页 / 共40页


点击查看更多>>
资源描述
Contents 0 Agent++ 总体说明: (1)Snmp++     Snmp++是为网络管理应用程序开发者提供的具有SNMP服务的一套C++类的集合。它具有基于面向对象模型建立的SNMP应用程序接口,在最小化的范围内使用已经存在的SNMP库,保证了程序的高效和可移植性。对于使用TCP/IP协议的Internet来说,Snmp++封装了底层的Socket操作,提供了简单的API供开发者使用。 (2)Agent++     Agent++是在Snmp++的基础上,扩展了Snmp++中的概念,它是用来开发SNMP代理的一套C++类的集合。它继承了Snmp++的优点,封装了绝大部分的SNMP的标准操作,并且利用面向对象的特性,使开发者能够通过派生的子类,重载其中的虚函数,根据应用程序的需要灵活控制程序。 在Agent++类库,定义和实现了在SMI和MIB中的文本语法规定,如:Group,Table,TableEntry,Index等。主要的类与文本语法规定的对应关系如表1所示。 SNMP 协议与 Agent ++类 的表示的对应关系 SNMP 协议 Agent ++类 网关代理 Mib 用户MIB MibGroup Table MibTable TableEntry MibTableEntry Instance Mibleaf Snmp 会话 Snmpx PDU Pdux 变量绑定 VB Vbx 对象标志符(OID) Oidx 按照功能划分,Agent++软件开发包由4个模块组成,如图3所示。通 信 模 块 消 息 处 理 模 块 操 作 定 位 模 块 MIB 管 理 模 块 消息接收处理 消息接收处理 图3 Agent ++ 功能模块图 通信模块负责接收和发送SNMP消息,它在指定端口(通常是161)接收到来的请求消息,并发送响应消息;在指定端口(通常是162)接收和发送陷阱、信息通知消息。同时,它还要给消息处理模块提供接收到消息、发送消息的工具函数。在Agent++中,属于通信模块的类主要有Snmpx、RequestList、Request等。 消息处理模块负责解析输入的请求消息,进行安全验证。它对通信模块传来的SNMP消息进行解析,判断解析结果是否合法,同时,也要把解析出来的社团名(community)与规定的社团名进行比较验证。如果解析结果合法且社团名验证通过,才能进行下一步操作。在Agent++中,属于消息处理模块的类主要有Request等。 操作定位模块负责根据消息处理模块解析的结果,在MIB库中查找管理对象。它按照消息中包含的管理对象的对象标志符(OID),查找需要访问的管理对象。在Agent++中,属于操作定位模块的类有Request、Mib、MibGroup、MibTable等。 MIB管理模块负责SNMP操作的具体实现。它按照操作类型(读或写),首先判断能否对管理对象进行操作,然后访问MIB库,按照要求读取数据或更新数据。在Agent++中,属于MIB管理模块的类有Request、MibTable、MibTableRow、Mibleaf等。     通信模块消息处理模块和操作定位模块对所有的MIB(包括私有的MIB)都是相同的,开发具体设备的代理时可以直接利用这些模块。MIB管理模块只提供了基本的操作,还需要根据具体的MIB文件,重新定制MIB管理模块。 1.Introduction 介绍 Various Simple Network Management Protocol (SNMP) Application Programmers Interfaces (APIs) exist which allow the creation of network management applications. SNMP++ is such an API but in contrast to many others it offers the advantages of object oriented programming. An object oriented approach to SNMP network programming provides many benefits including ease of use, safety, portability and extensibility. The SNNP++ source code (C++) is freely available from the Hewlett Packard Company WWW server[+] as long as their copyright notice is preserved. SNMP++ is designed to support the development of SNMP manager entities in the first place. AGENT++ extends the basic concepts of SNMP++ to support the development of SNMP agents and SNMP entities playing a dual role. Agent++ 扩展了 SNMP++ 的基本概念,支持 SNMP AGENT++ 和 SNMP 的双面角色。 If you are looking for an introduction to SNMP and SNMP MIBs, I recommend [Perkins97]. 1.Objectives of AGENT++ Ease of Use AGENT++ has been designed to make the development of simple network management protocol agents simple. Using the AGENT++ API the programmer does not need to be concerned with details about SNMP protocol engine and dispatch table. The programmer can focus on implementing method routines and management instrumentation. The OO approach encapsulates and hides many internals like management of incoming SNMP requests, looking up mappings in the dispatch table, calling the appropriate method routines, sending responses and traps. Details concerning the simple network protocol itself are encapsulated by SNMP++ (see the SNMP++ specification for details). Rapidity of Implementation The AGENT++ API undertakes nearly any task of a SNMP agent implementation that can be generalised. Therefore the implementation of SNMP agents with AGENT++ saves a lot of time and money. The OO approach of AGENT++ supports the generalisation of the key tasks of a SNMP agent efficiently without making the API difficult to use. Extensibility Extensions to the AGENT++ API can be done in many ways. This includes supporting new versions of SNMP (e.g. version 3) and their administrative framework, base classes for additional types of managed objects, and adding new features. Through C++ class derivation, users of AGENT++ can inherit what they like and override what they wish to overload: · A key concept of AGENT++ is the sub-classing of managed object base classes by the user. The user overrides virtual member functions of these base classes when she or he needs a specialisation to the default behaviour of the respective class member function. Portability//方便性 AGENT++ offers a maximum of portability due to the use of pure C++ without any operating system specific calls. So its only portability limitation is SNMP++ which is available for many Unix derivates and Microsoft Windows. Nevertheless if you want to implement a multi-threaded SNMP agent AGENT++ is limited to POSIX threads compatible UNIX operating systems, e.g. Solaris, Digital Unix, and Linux. The public interface of the AGENT++ API remains the same across any platform. A programmer who codes to AGENT++ does not have to make changes to move it to another platform. Extensibility 扩展性 Extensions to the AGENT++ API can be done in many ways. This includes supporting new versions of SNMP (e.g. version 3) and their administrative framework, base classes for additional types of managed objects, and adding new features. Through C++ class derivation, users of AGENT++ can inherit what they like and override what they wish to overload: · A key concept of AGENT++ is the sub-classing of managed object base classes by the user. The user overrides virtual member functions of these base classes when she or he needs a specialisation to the default behaviour of the respective class member function. · Agent++ 一个重要的概念就是由用户管理的子类积累。 An Introductory Example To get an idea of what benefits AGENT++ offers to a SNMP agent programmer, here is an example that shows the implementation of an agent for a coffee-percolator. For now, a single scalar managed object which represents the temperature of the coffee in the coffee-pot will do. Additional managed objects e.g. those that demonstrate how SNMP tables can be implemented with AGENT++ will follow later on. 简单标量管理对象。 2.Explanation of Introductory Example 一个介绍性的例子。 The main procedure of an AGENT++ SNMP agent (shown in figure 1) can be divided into three sections: 1. Setting up the SNMP protocol engine 设置SNMP 协议驱动 First of all an extended version of the SNMP++ Snmp class ( Snmpx) is used to create a SNMP session that will be used for incoming SNMP requests. The example uses the standard SNMP port 161 to listen on, although any (available) UDP port can be chosen. If the session has been created successfully the session object snmp has to be registered to the static class RequestList which queues and manages SNMP requests. SNMPX 类 用来产生一个 SNMP 线程,使用标准的 SNMP 口 161 监听,snmp 线程注册到 RequestList 类中,RequestList 能够管理 SNMP 的请求。 2. Create and register the MIB objects 产生和注册MIB 对象。 The mib object is created which represents the conceptual database containing the management information of the agent (Management Information Base). MIB 对象代表了 Agent 的管理信息。 Then all objects that should be supported by the agent MIB are added. Each such object contains one or more instances of managed objects related to a subtree of the management information tree. The classes systemGroup, snmpGroup, and trapDestGroup are provided by AGENT++, which include the managed objects of the MIB II system and snmp group, as well as managed objects needed for trap destination registration. systemGroup, snmpGroup, and trapDestGroup 类 包含了 MIB II 系统和snmp 组 的管理信息。也包含了 trap 目的的注册信息。 3. Loop forever for incoming SNMP requests 循环等待到来的 snmp 请求。 The receive method of the RequestList object is used to wait for incoming SNMP request. The method takes as argument the maximum time to wait for a request in seconds. Note: If the agent uses multi-threading the RequestList can contain more than one request. A SNMP request is processed through the process_request method which propagates each sub-request to the appropriate MIB object. RequestList 对象用来等待到来的 snmp 请求。使用process_request 方法来处理子需求。 How a simple managed object like coffeeTemperature can be implemented using the AGENT++ API is shown by figures 2 and 3. The class coffeeTemperature is derived from MibLeaf which is itself derived from MibEntry. MibLeaf is the base class for all instances of managed objects that are leafs of the management information tree, also called scalar managed objects. The constructor of coffeeTemperature calls the constructor of its base class MibLeaf with three arguments: coffeeTemperature 是一个简单的管理类,源于 MibLeaf 类,而MibLeaf 类又源自 MibEntry。MibLeaf 是所有管理控制类的基类,是管理信息树的叶子,也称作标量控制对象。 coffeeTemperature 的构造 调用了MibLeaf的构造,在以下3点需要说明: · the object identifier of the managed object instance the MIB object is representing. · 实例化MIB对象,表示 · the access rights to be used (coffeeTemperature is read only) · 使用的入口权限(coffeeTemperature 是只读) the syntax in form of a from SnmpSyntax derived object that represents an object oriented view of Structure of Management Information (SMI) Abstract Syntax Notation (ASN.1) data types which are used by SNMP (see figure 4 or the SNMP++ specification for sub-classes of SnmpSyntax). 源自SnmpSyntax 类的对象的语法组成,代表了面向对象的ASN.1规范的 SMI 管理信息,由 SNMP 使用。 Because coffeeTemperature has not a constant value, we need to redefine the virtual member function get_request inherited from MibLeaf to get the actual temperature of the coffee from the management instrumentation. To translate between the different management information representations used by the management instrumentation (temperature measured in Fahrenheit) and the SNMP MIB definition (Celsius) the method get_coffee_temperature is used. 因为 coffeeTemperature 没有常量,我们需要重新定义从MibLeaf 继承而来的get_request 函数,以便从管理机制中得到实际的coffee的温度。 The coffeeTemperature::get_request method first gets the actual temperature and stores it in value which is a pointer to the SnmpSyntax object that has been given as third parameter to the MibLeaf constructor. Then MibLeaf::get_request is called to actually answer the SNMP request using the value of value. That’S all! Everything else is done by AGENT++. coffeeTemperature::get_request 方法第一次得到实际的温度把它存到了value ,这是一个指向SnmpSyntax 对象的指针,构造的时候采用了MibLeaf 的第三个参数。然后MibLeaf::get_request 被调用,使用value 值来应答SNMP 的请求, 其它事情都由 AGENT++处理了。 · Figure 1: An example for a main routine of a SNMP agent to manage a coffee-percolator. Figure 2: Class definition for the managed object representing the coffee temperature 图2 :代表 coffee temperature 类定义 Figure 3: Class implementation of the managed object representing the coffee temperature 图3:代表 coffee temperature 类的执行 3.AGENT++ Features · Power and Flexibility AGENT++ (in conjunction with SNMP++) provides a power and flexibility which would otherwise be difficult to implement and manage. A programmer using the AGENT++ API can concentrate his affords on the management instrumentation and method routines. He or she needs nothing to know about a SNMP protocol engine or dispatch table. Even the tricky task to manage dynamic SNMP tables that follow the SMIv2 row status textual convention is undertaken by AGENT++. · Multi-Threaded Request Processing (New!) A MIB object method routines and thus its management instrumentation can run in an extra thread (pseudo) parallel executed to the agent main process. So time intensive calculations or information retrievals do not block the agent. This could increase the availability and reliability of the agent. Version 1.x of AGENT++ supported multi-processing. The use of multi-processing has had the following disadvantages: o Multi-processing needs a significant larger amount of system resources (i.e., memory and CPU) than multi-threading. o Processes need to communicate with each other. For this purpose System V Inter Process Communication (IPC) has been used by AGENT++ 1.x. A lot of coding had to be done to get this communication working, nevertheless the IPC could not completely hidden. As a result, the user interface was not as simple as it could have been. Consequently, AGENT++v2.0 user interface, as well as its code, is much easier to understand. o Multi-threading offers a (pseudo) parallel working management instrumentation access to the memory of the whole agent and its MIB. A child process has only a copy of the agents memory at the child's birth time, so it cannot recognise intermediate updates to the agent MIB. What is new: Agent++ Version 2.0 and greater supports the execution of the management instrumentation[+] as multiple threads. Each SNMP request can be separately executed as a thread. For each instance of a MIB object (MibLeaf or MibTable) there can be only a single thread executing one of its method routines at the same time. Thus, you do not have to worry about synchronising memory reads/writes within your instrumentation methods. 新内容:Agent++ 2.0版本 支持管理控制作为多线程。每个snmp请求都可以分做 单线程。对每一个mib 对象(MibLeaf or MibTable)来说,在同一时间仅仅有一个单线程执行它的一个方法,因此,不需要担心执行方法的读写同步问题。 As multi-processing is no longer supported, the methods MibEntry::update, MibEntry::result, Mib::busy, and Mib:process_updates known from version 1.0x have been removed. · MIB II System and SNMP Group For the programmer convenience an implementation of the MIB II’S system and snmp group is provided with AGENT++. 提供了MIB II’S 系统和snmp group。 · Proxy Support for Arbitrary Management Information Subtrees An arbitrary subtree of another agent’S management information tree can be included in an agent’S MIB simply be give the other agent’S management transport address and the subtree’S object identifier when defining such an proxy MIB object. As long as the proxy subtrees are disjunctive any combination of such proxy MIB objects can be used at the same time with local MIB objects. · Support for Persistent MIB Objects Scalar and table managed objects can be saved to disk and reloaded from it. This enables a user to easily save management information persistently. · Support for SNMPv1 and SNMPv2c SNMP++ supports SNMPv1 and SNMPv2c thus AGENT++ likewise supports both versions. A support for SNMPv3 and its user and view based administrative model will follow in the near future. · Detailed Logging // 详细的日志 AGENT++ has a detailed logging mechanism supporting five log classes (error, warning, info, debug, event) with each supporting up to 16 levels. This makes debugging of your agent very easy and gives you full control about what is happening when your agent is running. 4.An Introduction to SNMP++ SNMP++ is a set of C++ classes which provide SNMP services to a network management application developer. An overview over these C++ classes gives figure 4. For further documentation about SNMP++ please read the corresponding specification which is freely available[+] from the Hewlett Packard company. AGENT++ comes with a set of subclasses for some classes of SNMP++ which are shown in figure 4. Those subclasses provide extended functionality to their SNMP++ base classes, so their class names contain an appended ``x''. Significant extensions and improvements have been made to Snmp by Snmpx, to Vb by Vbx, and to Oid by Oidx. AGENT++ 提供了一系列的snmp++的子类集,这些子类集由 snmp++ 扩展而来,因此类名后包含了x。 Figure 4: Object Modelling Technique (OMT) view of the SNMP++ Framework
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传

当前位置:首页 > 教育专区 > 小学其他

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2025 宁波自信网络信息技术有限公司  版权所有

客服电话:4009-655-100  投诉/维权电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服