SNMP用VC开发

发布时间 : 星期五 文章SNMP用VC开发更新完毕开始阅读

2. Using vendor mibs example: mib文件定义:

busyPer OBJECT-TYPE SYNTAX INTEGER ACCESS read-only STATUS mandatory DESCRIPTION

\ period. Not the last 5 realtime seconds but the last 5 second period in the scheduler.\ ::= { lcpu 56 } avgBusy1 OBJECT-TYPE SYNTAX INTEGER ACCESS read-only STATUS mandatory DESCRIPTION

\ average of the CPU busy percentage.\ ::= { lcpu 57 } avgBusy5 OBJECT-TYPE SYNTAX INTEGER ACCESS read-only STATUS mandatory DESCRIPTION

\ average of the CPU busy percentage.\ ::= { lcpu 58 }

lcpu OBJECT IDENTIFIER ::= { local 1 } local OBJECT IDENTIFIER ::= { cisco 2 } cisco OBJECT IDENTIFIER ::= { enterprises 9 } 分析:

private属于4,所以开头应该是1.3.6.1.4.1.

avgBusy5 object instance is 1.3.6.1.4.1.9.2.1.58.0.

Technical Article: Expanding SNMP for industrial applications Jump to Articles from: GO

One of the numerous acronyms from the Internet world is SNMP - Simple Network Management Protocol. Although anything termed \suspect, the general concept of managed over unmanaged devices looks very attractive for industrial applications. Adding SNMP support can offer significant advantages. By George Thomas

Understand primarily that SNMP is an Internet protocol for managing devices on IP networks. People usually think of it in terms of managed Ethernet switches, but it can be added to any device that supports IP or TCP protocols. This includes printers, workstations, servers, modems... and industrial I/O devices.

When we say a device is managed, we mean the device supports the SNMP protocol besides its normal functions. This protocol,described in RFC 1157, was developed in the Eighties as a simple means of accessing devices remotely. Originally intended to manage routers, SNMP can be used to manage any device including programmable logic controllers and remote I/O blocks. The example that is usually given refers to its use in monitoring the temperature inside a router. If this can be done, then there are a host of industrial applications limited only by imagination.

One would think there is only one version of SNMP since the acronym is frequently quoted as if it were understood by all. Actually, there are three. The first is SNMPv1 which remains the most popular version. SNMPv2 builds upon the commands of version 1. SNMPv3 adds cryptography so addressing the biggest criticism of SNMP: the commands are sent in clear-text and therefore insecure.

Simply understanding SNMPv1 is enough to learn the concepts.

SNMP is an application layer protocol that sits above the TCP/IP stack. However, it does not use TCP at all but rather the UDP (datagram) protocol for communication which provides no acknowledgement that a transmission was successful. This was done to minimise the software requirements in the agent (the device being managed). The manager is the device requesting information from the agent and it is called a Network Management Station (NMS).

The interaction between a manager and an agent is similar to the

interaction between a master and a slave device. The manager can initiate a poll of the agent requesting information or directing an action. The agent,in turn,generates a response to the query from the manager. This is how a remote I/O protocol works. However, the manager can request that a trap be set by the agent. A trap is simply a report to be issued in the future which is triggered when a set of conditions are met, similar to an alarm. The trap is triggered upon an event and, once it occurs, the agent immediately reports the occurrence without a poll from the manager. This is no different from having a remote I/O device report on a change of state. The NMS receiving the trap can then take appropriate action such as notifying personnel of the event. In this situation, the NMS is acting as a server by gathering data from agents and providing information on the state of devices to clients.

Fig 1: SNMP Communication occurs between a manager and agent utilising UDP datagrams.

Let's consider a real-world example. We have a remote pumping station with a SCADA system attached to several devices. The SCADA system is powered from an uninterruptible power supply (UPS) that has an SNMP agent. An Ethernet fibre optic link provides communication between the remote pumping station and the main control room. An Ethernet switch, located in the pump house, connects the UPS and the SCADA system to the Ethernet link.

An SNMP manager application, running on a desktop workstation located in the main control room and functioning as a NMS, instructs the agent in the pump house UPS to set a trap that will be triggered if a loss of mains power occurs. If this condition were to arise, the agent would send a trap message back to the NMS which, in turn,pages the maintenance shop. This is a simple example of how SNMP can aid applications in our industry.

Fig 2: A manager polls agents in a similar fashion to a master protocol The beauty of SNMP is that it is indeed straightforward. There are only five commands with SNMPv1 and a total of nine for SNMPv2 and SNMPv3. The commands are:

SNMPv1 get get-next set

get-response trap

Additional to SNMPv2 and SNMPv3 get bulk notification inform report

To understand how the commands are applied, we need to introduce an integral component in the process:the managed objects that reside in the agent.

Managed objects

Each agent consists of a collection of managed objects that explain the capabilities and behaviour of the agent in an abstract form. This is no different from the method in which a DeviceNet device is described by a collection of objects. The objects supported by a DeviceNet limit switch differ from that of a DeviceNet pneumatic manifold block; however, all DeviceNet devices support some common objects.

This same situation applies to agents. All SNMP agents must support a common set of managed objects. This list of all managed objects is called a Management Information Base (MIB), but an agent must sup- port at a minimum MIB-2, that which is defined in RFC 1213 (RFC = report for comment, a network definition from a working group within the IT office automation world - Ed ).

You might ask what happened to MIB-1? In the ever-changing Internet world, MIB-2 superseded MIB-1. Before examining details of MIB-2, we need to understand the structure and naming convention of MIBs.

联系合同范文客服:xxxxx#qq.com(#替换为@)