Manual - SNMP Developers Guide
Manual - SNMP Developers Guide
United States
© Copyright 2002 Hewlett-Packard Company.
Legal Notices
Hewlett-Packard makes no warranty of any kind with regard to this
manual, including, but not limited to, the implied warranties of
merchantability and fitness for a particular purpose. Hewlett-Packard
shall not be held liable for errors contained herein or direct, indirect,
special, incidental or consequential damages in connection with the
furnishing, performance, or use of this material.
Warranty. A copy of the specific warranty terms applicable to your
Hewlett- Packard product and replacement parts can be obtained from
your local Sales and Service Office.
Restricted Rights Legend. All rights are reserved. No part of this
document may be photocopied, reproduced, or translated to another
language without the prior written consent of Hewlett-Packard
Company. The information contained in this document is subject to
change without notice.
Use, duplication or disclosure by the U.S. Government is subject to
restrictions as set forth in subparagraph (c) (1) (ii) of the Rights in
Technical Data and Computer Software clause at DFARS 252.227-7013
for DOD agencies, and subparagraphs (c) (1) and (c) (2) of the
Commercial Computer Software Restricted Rights clause at FAR
52.227-19 for other agencies.
HEWLETT-PACKARD COMPANY
3404 E. Harmony Road
Fort Collins, CO 80528 U.S.A.
Use of this manual and flexible disk(s), tape cartridge(s), or CD-ROM(s)
supplied for this pack is restricted to this product only. Additional copies
of the programs may be made for security and back-up purposes only.
Resale of the programs in their present form or with alterations, is
expressly prohibited.
Copyright Notices. ©Copyright 1983-2002 Hewlett-Packard Company,
all rights reserved.
Reproduction, adaptation, or translation of this document without prior
written permission is prohibited, except as allowed under the copyright
laws.
2
Contains software from AirMedia, Inc.
© Copyright 1996 AirMedia, Inc.
Trademark Notices
Java™ is a U.S. trademark of Sun Microsystems, Inc.
Microsoft® is a U.S. registered trademark of Microsoft Corporation.
Windows NT® is a U.S. registered trademark of Microsoft Corporation.
Windows® 2000 is a U.S. registered trademark of Microsoft Corporation.
Windows® and MS Windows® are U.S. registered trademarks of
Microsoft Corporation.
Netscape™ and Netscape Navigator™ are U.S. trademarks of Netscape
Communications Corporation.
Oracle® is a registered U.S. trademark of Oracle Corporation, Redwood
City, California.
Oracle7™ is a trademark of Oracle Corporation, Redwood City,
California.
OSF/Motif® and Open Software Foundation® are trademarks of Open
Software Foundation in the U.S. and other countries.
Pentium® is a U.S. registered trademark of Intel Corporation.
UNIX® is a registered trademark of The Open Group.
3
4
Contents
1. Introduction to the NNM Software Developer’s Kit
The HP OpenView NNM Software Developer’s Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
The OVSNMP API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
The WinSNMP and Microsoft MGMT API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
The SNMP API Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Integration APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2. An Overview of SNMP
The SNMP Model of Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Managers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Agents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Manager and Agent Interaction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
SNMP Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
SNMPv1 and SNMPv2C Protocols. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
The Management Information Base . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Object Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Extended MIBs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Data Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
SNMP Proxies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
For More Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5
Contents
4. The NNM Event Database API
The NNM Event Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
The NNM Event Database API Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Memory Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Data Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
6
Contents
Writing Backup Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Integration via ovwMapClose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Integrating via Services (Background Processes) . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
7
Contents
8
Tables
Table 2-1. SNMP Request Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Table 2-2. SNMPv2C Request Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Table 2-3. Summary of the SNMPv1 and SNMPv2 SMI Definitions . . . . . . . . . . . . 32
Table 2-4. ASN.1 Data Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Table 2-5. Outside Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Table 3-1. Protocol Operations Supported by the OVSNMP API . . . . . . . . . . . . . . . 46
Table 3-2. Protocol Error Status Supported by the OVSNMP API . . . . . . . . . . . . . . 47
Table 3-3. SNMP Communications API Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Table 3-4. OVsnmpAPI Memory Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Table 3-5. OVSNMP Header Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Table 3-6. SNMP API Key Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Table 3-7. OVsnmpSession Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Table 3-8. CallBack Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Table 3-9. CallBack Command Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Table 3-10. Elements of the OVsnmpPdu Data Structure . . . . . . . . . . . . . . . . . . . . . 74
Table 3-11. Elements of the OVsnmpVarBind Data Structure . . . . . . . . . . . . . . . . . 77
Table 3-12. OVsnmpVarBind Union Members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Table 4-1. NNM Event Database API Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Table 5-1. SNMP Configuration API Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Table 5-2. SNMP Configuration API Data Structures . . . . . . . . . . . . . . . . . . . . . . . . 94
Table 5-3. OVsnmpConfEntry Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Table 5-4. OVsnmpConfWcList Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Table 5-5. OVsnmpConfDest Data Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Table 5-6. OVsnmpConfCntl Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Table 6-1. Functions in the OVuTL API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Table 7-1. Functions in the OVsPMD API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Table 7-2. Purpose of Each Line in a Local Registration File . . . . . . . . . . . . . . . . . 117
Table 7-3. First Line of the LRF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Table 7-4. Second Line of the LRF& . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
9
Tables
10
Figures
Figure 1-1. SNMP API Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Figure 2-1. Sequence of Actions in a Hypothetical SNMP Session . . . . . . . . . . . . . . 27
Figure 2-2. Conceptual View of Communication Sequence with Traps . . . . . . . . . . 28
Figure 2-3. The Top of the MIB Naming Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Figure 2-4. The Role of a Proxy in SNMP Communication . . . . . . . . . . . . . . . . . . . . 37
Figure 3-1. OVSNMP Bilingual Stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Figure 3-2. OVsnmpPDU Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Figure 5-1. OVsnmpConfWcList Structure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Figure 5-2. OVsnmpConfDest Data Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Figure 6-1. Windows Event Viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Figure 7-1. Process Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Figure 7-2. Backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Figure 7-3. Decision Tree for Script Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Figure 7-4. Decision Tree for ovwMapClose Event Integration . . . . . . . . . . . . . . . 129
Figure 7-5. Decision Tree for Background Process Integration. . . . . . . . . . . . . . . . 130
Figure 7-6. Backup Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Figure 7-7. API integration with Backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
Figure 7-8. Backup via Background Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
11
Figures
12
Conventions
The following typographical conventions are used in this manual.
Italic For book or manual titles, and for Refer to the OVW Developer’s Guide.
manpage names.
Computer Text and items on the computer The Root map window ...
screen.
The system replies: Press Enter
Computer Text that you must enter. At the prompt, type: ovstatus.
Bold
Keycap Keyboard keys. Press Return.
[Button] Buttons on the user interface. Click [NET]. Click on the [Apply]
button.
13
14
Contact Information
Technical Support Technical support information can be found on the HP OpenView World
Wide Web site at:
http://openview.hp.com/
________________________________
• Windows®: install_dir\ReleaseNotes\nnm_doc_reply.txt
• UNIX: /opt/OV/ReleaseNotes/nnm_doc_reply.txt
Fill out one form per manual and email it to: ovdoc@fc.hp.com
If you encounter serious errors in the documentation that impair your
ability to use NNM, please contact the HP Response Center or your
support representative so that your feedback can be entered into
CHARTS (the HP Change Request Tracking System).
________________________________
15
16
1 Introduction to the NNM
Software Developer’s Kit
Chapter 1 17
Introduction to the NNM Software Developer’s Kit
18 Chapter 1
Introduction to the NNM Software Developer’s Kit
The HP OpenView NNM Software Developer’s Kit
• SNMP management
• OpenView Windows
• OpenView tracing and logging
• OpenView process control
This guide discusses the APIs for SNMP management (chapters 2, 3, and
4), tracing and logging (chapter 5), and process control (chapter 6). APIs
related to OpenView Windows are discussed in the HP OpenView
Windows Developer’s Guide.
Chapter 1 19
Introduction to the NNM Software Developer’s Kit
The HP OpenView NNM Software Developer’s Kit
20 Chapter 1
Introduction to the NNM Software Developer’s Kit
The HP OpenView NNM Software Developer’s Kit
Figure 1-1 illustrates the primary components and data flows of the
OVSNMP API, and their relationships to each other and to system
services.
netmon ITO
ovactiond
Alarm Browser
Annotation
server
OVEVENT
ovtrapd ANNO Drill Down
ECS ecsmgr
Port pmd I/O
162 Perl script
http server
ovevents
SNMP V1/V2 Traps
Chapter 1 21
Introduction to the NNM Software Developer’s Kit
The HP OpenView NNM Software Developer’s Kit
Integration APIs
Chapters 5 and 6 cover the activities and utilities you use to integrate
your application into the HP OpenView SNMP platform on Network
Node Manager. Integration requires you to make some straightforward
modifications to your code, as well as create a few special files and
scripts.
There are two key areas for attention in integration:
NOTE You must create a Local Registration File (LRF) for any agents you
create. This is covered under process management in Chapter 6.
22 Chapter 1
2 An Overview of SNMP
Chapter 2 23
An Overview of SNMP
— object identifiers
— extended MIBs
— data representation
24 Chapter 2
An Overview of SNMP
The SNMP Model of Communication
Managers
A manager is a process (or node) that is an active participant in
network management. It solicits and interprets data about network
devices and network traffic, and typically interacts with a user to achieve
the user's intentions. Therefore, a manager can also trigger changes in
an agent (see the next section) by changing the value of a variable on the
agent node. Managers are frequently implemented as network
management applications.
Agents
From the perspective of network management, an agent is usually a
passive entity. It responds to the requests of managers, supplying and
changing the values of local variables as needed. An agent can become an
active entity by emitting unsolicited messages (called notifications or
traps) to alert managers of noteworthy local events (such as a system
reboot).
Chapter 2 25
An Overview of SNMP
The SNMP Model of Communication
SNMP Messages
Requests and responses are transferred in Protocol Data Units, or
PDUs. A PDU is the formal name for a message that is sent or received
in the course of SNMP communication.
Connectionless Operation
SNMP uses a connectionless transport service for communication
between the SNMP manager and agent. The HP OpenView SNMP API
introduces a session-oriented model from the application perspective.
However, this implementation serves only to bind the application to the
OVSNMP API for a given destination. A connectionless transport is still
used internally.
26 Chapter 2
An Overview of SNMP
The SNMP Model of Communication
Manager Agent
Chapter 2 27
An Overview of SNMP
The SNMP Model of Communication
Notifications
In the model presented previously, the manager requests information
from the agent and the agent then responds. However, it is also possible
for an agent to issue spontaneous (unsolicited) messages. Such a
message is known as a notification. In SNMPv1, notifications are
referred to as traps. In SNMPv2, a notification may be either a trap or
an inform message.
The diagram shown in Figure 2-2 illustrates the communication
sequence involved with traps.
Manager Agent
28 Chapter 2
An Overview of SNMP
The SNMP Model of Communication
SNMP Operations
The SNMPv1 specification defines the following basic operations:
Table 2-1 SNMP Request Types
Set Request Writes new data to one or more of the objects managed by an
agent.
Get Request Requests the value of one or more of the objects managed by an
agent.
Get Next Request Requests the Object Identifier(s) and value(s) of the next
object(s) managed by an agent.
Chapter 2 29
An Overview of SNMP
The SNMP Model of Communication
The SNMPv2C protocol provides some new protocol operations over the
original SNMP protocol. These include the following:
Table 2-2 SNMPv2C Request Types
30 Chapter 2
An Overview of SNMP
The Management Information Base
Chapter 2 31
An Overview of SNMP
The Management Information Base
SNMPv1 SMI Forms the basis for all existing SNMPv1-based MIBs. Defined in RFC
1155: Structure and Identification of Management Information for
TCP/IP-based Internets Amended in RFC 1212: Concise MIB
Definitions
SNMPv2 SMI Defined as a superset of the SNMPv1 SMI. Some SNMPv1 data types
have been renamed:
32 Chapter 2
An Overview of SNMP
The Management Information Base
Object Identifiers
For the purposes of an SNMP developer, an object identifier (OID) is a
data type that precisely identifies a MIB-II object definition. An OID
(often referred to as the registration ID) consists of a sequence of
non-negative integers that describe the only path through the
object-naming hierarchy to the object. The naming hierarchy is
commonly called the naming tree.
Chapter 2 33
An Overview of SNMP
The Management Information Base
root
OIDs in Practice
The convention for writing object identifiers is called dot notation. An
OID in dot notation consists of the integers of the OID in sequence, with
a period (dot) between them. Thus the prefix for the OIDs in the MIB-II
is 1.3.6.1.2.1.
Below is an example OID from the MIB-II. The full written name of the
path is shown beneath the corresponding numerical identifiers in the
OID:
1.3.6.1.2.1.6.7
iso.org.dod.internet.mgmt.mib.tcp.tcpAttemptFails
NOTE The derivation of these examples is taken from the RFCs noted earlier in
this chapter and in “For More Information” at the end of this chapter.
34 Chapter 2
An Overview of SNMP
The Management Information Base
Extended MIBs
Many agents support extended MIBs, which define objects that are not
included in standard MIBs, such as MIB-II and enterprise-specific MIBs.
Your application can query an object from an extended MIB exactly as it
would query a MIB-II object. Users should use the proper registration
authorities when defining MIB extensions.
Data Representation
Data is exchanged between SNMP processes using the Basic Encoding
Rules (BER) defined for the Abstract Syntax Notation (ASN.1).
ASN.1 is a rich data description language, and gaining a full
understanding of it is a formidable task. Fortunately, as an SNMP
developer, you do not deal directly with ASN.1 or the Basic Encoding
Rules. The HP OpenView SNMP API takes care of the details of ASN.1
encoding and decoding.
SNMP uses a few simple ASN.1 data types. Table 2-4, ASN.1 Data Types,
lists the base data types that you work with in SNMP communication.
The details of how you access them appear in the online reference pages.
Table 2-4 ASN.1 Data Types
Type Description
OCTET STRING A simple type taking zero or more octets, each octet being an ordered
sequence of eight bits. The value of any octet in the string is
unrestricted.
Chapter 2 35
An Overview of SNMP
The Management Information Base
Type Description
Unsigned32 A non-negative 32-bit integer. Values can range from 0 to 232 ^1.
This data type is indistinguishable from Gauge32 when encoded
using ASN.1 BER.
36 Chapter 2
An Overview of SNMP
The Management Information Base
SNMP Proxies
The HP SNMP implementation provides special support for applications
that communicate with a destination agent using an SNMP proxy. Such
an application can address a message directly to the destination (foreign)
agent; the SNMP API will determine which host is the proxy and send
the message accordingly. Figure 2-4 illustrates this concept.
Chapter 2 37
An Overview of SNMP
For More Information
Document Description
RFC 1155: Structure and Identification of K. McCloghrie and M. T. Rose, (May 1990).
Management Information for TCP/IP-based Contains MIB object definitions.
Internets (Obsoletes RFC 1065)
RFC 1213: Management Information Base K. McCloghrie and M. T. Rose, eds., (March
Network Management of TCP/IP based 1991). Defines MIB-II. (Obsoletes RFC
internets: MIB-II 1158; most current edition as of the
printing of this guide.)
RFC 1215: Convention for Defining Traps for M. T. Rose, ed. (March 1991).
Use with the SNMP
38 Chapter 2
An Overview of SNMP
For More Information
Document Description
RFC 1903: Textual Conventions for Version 2 SNMPv2 WG, J.Case, K. McCloghrie, M.T.
of the Simple Network Management Protocol Rose, S. Waldbusser, (January 1996). MIB
(SNMPv2) Definition language for refined data types.
(Draft Standard. Obsoletes RFC 1443)
RFC 1904: Conformance Statements for SNMPv2 WG, J.Case, K. McCloghrie, M.T.
Version 2 of the Simple Network Management Rose, S. Waldbusser, (January 1996). MIB
Protocol (SNMPv2) Definition language for Conformance and
Capability definitions. (Draft Standard.
Obsoletes RFC 1444)
RFC 1905: Protocol Operations for Version 2 SNMPv2 WG, J.Case, K. McCloghrie, M.T.
of the Simple Network Management Protocol Rose, S. Waldbusser, (January 1996).
(SNMPv2) Defines SNMPv2 protocol. (Draft
Standard. Obsoletes RFC 1448)
RFC 1906: Transport Mappings for Version 2 SNMPv2 WG, J.Case, K. McCloghrie, M.T.
of the Simple Network Management Protocol Rose, S. Waldbusser, (January 1996).
(SNMPv2) Defines SNMPv2 transport mappings for
IP, IPX, DDP. (Draft Standard. Obsoletes
RFC 1449)
RFC 1907: Management Information Base for SNMPv2 WG, J.Case, K. McCloghrie, M.T.
Version 2 of the Simple Network Management Rose, S. Waldbusser, (January 1996).
Protocol (SNMPv2) Defines MIB objects that are mandatory
for SNMP agents that support SNMPv2.
(Draft Standard. Obsoletes RFC 1450)
RFC 1908: Coexistence between Version 1 and SNMPv2 WG, J.Case, K. McCloghrie, M.T.
Version 2 of the Internet-standard Network Rose, S. Waldbusser, (January 1996).
Management Framework Coexistence guidelines for SNMPv1 and
SNMPv2. (Draft Standard. Obsoletes RFC
1452)
Chapter 2 39
An Overview of SNMP
For More Information
40 Chapter 2
3 The OVSNMP Communications
API
Chapter 3 41
The OVSNMP Communications API
42 Chapter 3
The OVSNMP Communications API
SNMPv1 and SNMPv2C Protocol Support
Chapter 3 43
The OVSNMP Communications API
SNMPv1 and SNMPv2C Protocol Support
Management Application
OR
OR
controlled by
SNMPv1 Style API SNMPv2 Style API OVSNMP_V2
API session flag
v1 mode v1 bilingual v2C
mode mode mode controlled by
protocol version
(when the
OVSNMP_V2
SNMPv1
protocol API flag is set)
SNMPv1 SNMPv2C
protocol protocol
44 Chapter 3
The OVSNMP Communications API
SNMPv1 and SNMPv2C Protocol Support
You can use the OVSNMP API in its original interface style or in the new
interface style, which is called OVSNMP_V2API. If you select the new
interface style, your application can take advantage of both explicit
SNMPv2C protocol support and bilingual SNMPv1/SNMPv2C protocol
support. Your application, however, must also handle the different types
of errors that can be returned through the SNMPv2-style interface.
You may explicitly request that your application use either the SNMPv1
or SNMPv2C protocol. By default, if you use the SNMPv2-style interface,
the SNMP stack will use the bilingual communication mode.
The bilingual communication mode allows access to SNMP operations
that might not initially appear to be valid for a given remote system. For
example, you could use GetBulk Requests for a remote node that
supports only the SNMPv1 protocol. When using bilingual
communication mode, the SNMP run-time stack dynamically translates
requests into SNMP operations that are valid for the particular type of
remote system involved in the communication. For example, if a remote
system supports only the SNMPv1 protocol, a GetBulkRequest is
translated into a GetNext request.
The OVSNMP API performs the following protocol translations when
communicating with SNMPv1 agents through the SNMPv2-style
interface:
Chapter 3 45
The OVSNMP Communications API
SNMPv1 and SNMPv2C Protocol Support
v2-style API
v1-style
SNMP Operation
API
Bilingual SNMPv1 SNMPv2C
GET_REQ_MSG x x x x
GETNEXT_REQ_MSG x x x x
GETBULK_REQ_MSG x xa x
SET_REQ_MSG x x x x
RESPONSE_MSG x x x x
V1TRAP_REQ_MSG x x
V2TRAP_REQ_MSG x x
INFORM_REQ_MSG x x
a. When using the SNMPv2-style API with the SNMPv1 protocol version, each
GetBulk request is mapped to a single GetNext request, regardless of the
maximum number of repetitions specified.
46 Chapter 3
The OVSNMP Communications API
SNMPv1 and SNMPv2C Protocol Support
Table 3-2, Protocol Error Status Supported by the OVSNMP API, shows
the errors that can be returned when using each of the OVSNMP API
interface modes. The original SNMPv1-style interface supports only the
error codes listed under “v1-style Interface.” SNMPv1 error codes are not
translated to SNMPv2C code. The SNMPv2C codes are more specific
than SNMPv1 codes, so there is no one-to-one translation between the
two.
Applications using the bilingual protocol mode must be able to deal with
error codes that do not appear as SNMPv1 error codes, even if the
messages originate from an SNMPv1 remote system. The bilingual mode
is designed to hide the details of the lower level protocol, and to allow
developers to write applications that work equally well when
communicating with SNMPv1 and SNMPv2C-compatible remote
systems.
When using the SNMPv2-style API interface, the set of possible errors
returned is the same, regardless of the actual SNMP protocol used to
communicate with the remote system. See Table 3-2, “Protocol Error
Status Supported by the OVSNMP API.”
Table 3-2 Protocol Error Status Supported by the OVSNMP API
v2-style Interface
v1 style
SNMP Response Errors
Interface v1 v2
Bilingual
native native
SNMP_ERR_NOERROR x x x x
SNMP_ERR_TOOBIG x x x x
SNMP_ERR_NOSUCHNAME x x x x
SNMP_ERR_BADVALUE x x x x
SNMP_ERR_GENERR x x x x
SNMP_ERR_NOACCESS x x
SNMP_ERR_WRONGTYPE x x
SNMP_ERR_WRONGLENGTH x x
SNMP_ERR_WRONGENCODING x x
SNMP_ERR_WRONGVALUE x x
Chapter 3 47
The OVSNMP Communications API
SNMPv1 and SNMPv2C Protocol Support
v2-style Interface
v1 style
SNMP Response Errors
Interface v1 v2
Bilingual
native native
SNMP_ERR_NOCREATION x x
SNMP_ERR_INCONSISTENTVALUE x x
SNMP_ERR_RESOURCEUNAVAILABLE x x
SNMP_ERR_COMMITFAILED x x
SNMP_ERR_UNDOFAILED x x
SNMP_ERR_AUTHORIZATIONERROR x x
SNMP_ERR_NOTWRITABLE x x
SNMP_ERR_INCONSISTENTNAME x x
Varbind Exceptions x x
48 Chapter 3
The OVSNMP Communications API
SNMPv1 and SNMPv2C Protocol Support
• SNMP_VERSION_1
• SNMP_VERSION_2C
• SNMP_USE_DEFAULT_VERSION (bilingual)
Chapter 3 49
The OVSNMP Communications API
OVSNMP Over UDP/IP and IPX
50 Chapter 3
The OVSNMP Communications API
OVSNMP Over UDP/IP and IPX
Chapter 3 51
The OVSNMP Communications API
OVSNMP Over UDP/IP and IPX
52 Chapter 3
The OVSNMP Communications API
Blocking and Nonblocking Programming Models
Retransmission Support
OVSNMP uses either the User Datagram Protocol (UDP) or Internet
Packet Exchange (IPX)1 at the transport layer. These connectionless
protocols provide a simple but unreliable transport. A message can get
lost in transmission and never arrive at its destination. Therefore,
services such as SNMP may require some messages to be retransmitted.
If your application uses blocking requests, the SNMP library handles
retransmission based on the timeout and retry values established when
the session is first opened.
If your application uses nonblocking requests, the SNMP API provides
three ways to manage retransmission:
Chapter 3 53
The OVSNMP Communications API
Blocking and Nonblocking Programming Models
Select-based Retransmission
Event-driven, select-based applications make nonblocking requests. As
shown in the sample code fragment below, these applications create an
OVsnmpSession by using OVsnmpOpen, then manage retransmissions by
calling select() and the OVsnmpGetRetryInfo and OVsnmpDoRetry
functions (which are described later in this chapter).
session=OVsnmpOpen(targetName,...applCb,applCbData);
pdu=OVsnmpCreatePdu(...);OVsnmpAddNullVarbind(...);
reqId=OVsnmpSend(session,pdu);
...other application specific code...
while (1){
nfds=OVsnmpGetRetryInfo(&readfds, &tval);
rc=select(nfds,readfds,NULL,NULL,&tval);
if (rc>0)OVsnmpRead(&readfds);
OVsnmpDoRetry();
}
/*
*Note:OVsnmpRead and OVsnmpDoRetry invoke the OVSNMP applCb
*for SNMP responses, notifications and timeout conditions
*/
54 Chapter 3
The OVSNMP Communications API
Blocking and Nonblocking Programming Models
Chapter 3 55
The OVSNMP Communications API
The SNMP Communications API Functions
56 Chapter 3
The OVSNMP Communications API
The SNMP Communications API Functions
Chapter 3 57
The OVSNMP Communications API
The SNMP Communications API Functions
58 Chapter 3
The OVSNMP Communications API
The SNMP Communications API Functions
Chapter 3 59
The OVSNMP Communications API
The SNMP Communications API Functions
60 Chapter 3
The OVSNMP Communications API
The SNMP Communications API Functions
Memory Management
The HP OVSNMP Communications API uses two rules of thumb for
memory management:
Chapter 3 61
The OVSNMP Communications API
The SNMP Communications API Functions
Sometimes you may supply data to fill in a structure that the SNMP
library has allocated. For example, you might assign a Notification OID
or Enterprise OID to an SNMP Trap PDU. Such data must always be
dynamically allocated. Otherwise, a failure occurs when the library
attempts to deallocate statically allocated memory.
Make sure that whenever memory is allocated — whether by the SNMP
library or by your application — it is later deallocated. Neglecting this
can result in a “memory leak” which gradually consumes resources until
a failure occurs.
Four functions are provided for you to allocate and deallocate ancillary
data assigned to OVSNMP data structures. The are: OVsnmpMalloc(),
OVsnmpCalloc(), OVsnmpRealloc() and OVsnmpFree(). These functions
behave the same as, and are implemented using, the underlying
operating system malloc(), calloc(), realloc() and free()
functions, respectively. The purpose of the OVSNMP API versions of
these functions is to provide common memory allocation and
deallocation, particularly on the WindowsNT/2000 operating system
where the DEBUG (msvcrtd.dll) and non-DEBUG (msvcrt.dll)
versions of the C-runtime library are not compatible with each other. The
functions are also provide on UNIX systems for cross-platform
portability.
Table 3-4, OVsnmpAPI Memory Management, summarizes the types of
data structures allocated or deallocated by the OVSNMP API functions.
Refer to the specific function description for details.
Table 3-4 OVsnmpAPI Memory Management
62 Chapter 3
The OVSNMP Communications API
The SNMP Communications API Functions
Chapter 3 63
The OVSNMP Communications API
The SNMP Communication API Data Structures
Header Files
The header file defines many data structures that are part of the
OVSNMP API. All header files are stored under a common directory
represented by the $OV_HEADER environment variable. See the reference
page ov.envvars for details on the $OV_HEADER environment variable.
The OVsnmp header files are shown in Table 3-5, “OVSNMP Header
Files.”
64 Chapter 3
The OVSNMP Communications API
The SNMP Communication API Data Structures
$OV_HEADER/OV/OVsnmpAsn1.h ASN.1 type definitions for the API. These are the
ASN.1 types that are supported by the OVSNMP
library.
Chapter 3 65
The OVSNMP Communications API
The SNMP Communication API Data Structures
• All PDUs passed to the API by the application must be created by the
API; that is, the PDUs must either be returned by one of the
following:
— OVsnmpCreatePDU()
— OVsnmpCopyPDU()
— OVsnmpFixPDU()
— OVsnmpBlockingSend()
— OVsnmpRecv()
or passed to the nonblocking mode OVsnmpCallback() function.
• Error values derived from a PDU’s error_status field must be
mapped to the OVSNMP API error code space before being passed to
OVsnmpErrString(). This mapping is performed by the newly
provided SNMP_STD2OV_ERR macro. Examples of how this macro is
used can be found in $OV_MAIN_PATH/prg_samples/ovsnmp_app.
66 Chapter 3
The OVSNMP Communications API
The SNMP Communication API Data Structures
Data Structures
The key data structures you will use with the OVSNMP API are
described in Table 3-6.
Table 3-6 SNMP API Key Data Structures
OVsnmpVal A union that can contain the value portion of an SNMP variable
binding. Part of the OVsnmpVarBind structure. Created by
OVsnmpAddVarBind(); freed by OVsnmpFreePdu().
The two data structures you will use most often are the OVsnmpSession
structure and the OVsnmpPdu structure (including its substructures).
Chapter 3 67
The OVSNMP Communications API
The SNMP Communication API Data Structures
sock_fd int The socket file descriptor for the session. Used to
establish the read mask for calls to select().
68 Chapter 3
The OVSNMP Communications API
The SNMP Communication API Data Structures
Chapter 3 69
The OVSNMP Communications API
The SNMP Communication API Data Structures
Parameter Description
The entries in Table 3-9 define the valid values for the callback
command parameter.
70 Chapter 3
The OVSNMP Communications API
The SNMP Communication API Data Structures
(1) Occurs only if the SNMP_V2API bit in the session_flags field is not set for the specified
session parameter.
(2) Occurs only if the SNMP_V2API bit in the session_flags field is set for the specified
session parameter.
Chapter 3 71
The OVSNMP Communications API
The SNMP Communication API Data Structures
(3) Occurs only if the specified session was created using OVsnmpEventOpen(),
OVsnmpEventXOpen(), OVsnmpTrapOpen(), or OVsnmpXTrapOpen().
(4) Occurs only if the OVSNMP_CLOSE_CALLBACK bit in the session_flags field is set for the
specified session parameter.
NOTE For SNMPv2 traps and informs, the OVsnmpPdu structure conveys the
logical format of the notification. The notification identifier,
timestamp and optional enterprise identifier are represented in
fields of the OVsnmpPdu structure. The variables list contains only the
“data varbinds” for the notification. When the V2 trap or inform pdu
structure is encoded into or decoded from the SNMP message, these
three attributes are inserted into or extracted from the SNMP message
variable-binding list.
72 Chapter 3
The OVSNMP Communications API
The SNMP Communication API Data Structures
The fields of the OVsnmpPdu structure are shown in order in Figure 3-2.
Note that this PDU has two variables. Table 3-10 describes each of the
elements in the OVsnmpPdu data structure.
OVsnmpPdu
address
command
request_id
error_status
error_index OVsnmpVarBind OVsnmpVarBind
*community *next_variable *nex_variable NULL
community_len *oid *oid
*variables oid_length oid_length
Specific *notify_oid type type
toV2 Traps
& Informs notify_oid_length val val
generic_type *integer *integer
Specific
toV1 Traps specific_type *string *string
union
union
Chapter 3 73
The OVSNMP Communications API
The SNMP Communication API Data Structures
74 Chapter 3
The OVSNMP Communications API
The SNMP Communication API Data Structures
Chapter 3 75
The OVSNMP Communications API
The SNMP Communication API Data Structures
The following fields are specific to SNMPv2 Trap and Inform Requests, and are invalid for
all other PDUs.
76 Chapter 3
The OVSNMP Communications API
The SNMP Communication API Data Structures
Chapter 3 77
The OVSNMP Communications API
The SNMP Communication API Data Structures
The OVsnmpVal data structure is a union of the possible data types for
the variable. The OVsnmpVal data can be any of the Union Members
listed in Table 3-12.
Table 3-12 OVsnmpVarBind Union Members
integer INTEGER
object ID Object ID
78 Chapter 3
4 The NNM Event Database API
Chapter 4 79
The NNM Event Database API
This chapter describes the functions and data structures in the HP NNM
Event Database API. It includes descriptions of the following:
80 Chapter 4
The NNM Event Database API
The NNM Event Database
• Event Log File Group contains all the raw events received by pmd and
all the events generated by the Event Correlation engine with the
following exception. Events configured as IGNORE in trapd.conf
are not logged in the event database.
OVEventDbOpenLogForReading(), OVEventDbReadNextEvent(),
and OVEventDbGetOVsnmpPdu() can access data from this file group.
• NDBM Offset File Group is a series of four New Database Manager
databases (NDBM) which are maintained in “lock-step” with the
Event Log File Group. That is, whenever an event record is written
to an Event Log File, a corresponding NDBM event offset record is
written to the corresponding NDBM Offset File. There is no API to
directly access this file group.
• Stream Log File Group is a series of four binary files that record the
association of an event with an ECS event stream.
OVEventDbOpenStreamForReading(), OVEventDbReadNextEvent(),
and OVEventDbGetOVsnmpPdu() can access data from this file group.
• Correlation Log File Group is a series of four binary files that record
the association of two events within an ECS event stream. The
correlation log contains records of this relationship. Often, an event
is the parent of several child events. In this case, the log contains a
corresponding number or records, each with the same parent event
in the association but with different child events.
OVEventDbOpenCorrLogForReading(),
OVEventDbFindCorrelatedEvents(),
OVEventDbGetCorrelationTree(), and other related API functions
can access data from this file group (see the OVEventdb API list
below).
Chapter 4 81
The NNM Event Database API
The NNM Event Database
There are two ways to get correlated events for a given event.
82 Chapter 4
The NNM Event Database API
The NNM Event Database API Functions
Function Description
FREEING RESOURCES
Chapter 4 83
The NNM Event Database API
The NNM Event Database API Functions
Function Description
84 Chapter 4
The NNM Event Database API
The NNM Event Database API Functions
Function Description
Chapter 4 85
The NNM Event Database API
Memory Management
Memory Management
If an OVEventDb API returns a handle, the calling application must free
the memory associated with the handle.
If the API has an output pointer, the calling application must free the
memory associated with the output pointer.
Data Structure
Data structure handles in OVEventDb API are opaque to the
application. You must use related API to manipulate them:
typedef void *OVeventDbHandle;
typedef void *OVeventHandle;
typedef void *OVeventListHandle;
typedef void *OVcorrEntryHandle;
typedef void *OVcorrEntryListHandle;
86 Chapter 4
5 The OVSNMP Configuration
API
Chapter 5 87
The OVSNMP Configuration API
88 Chapter 5
The OVSNMP Configuration API
The OVSNMP Configuration Database
Chapter 5 89
The OVSNMP Configuration API
The OVSNMP Configuration API Functions
DATABASE ACCESS
RESOLUTION
EDITING
90 Chapter 5
The OVSNMP Configuration API
The OVSNMP Configuration API Functions
Chapter 5 91
The OVSNMP Configuration API
The OVSNMP Configuration API Functions
ADMINISTRATION
MISCELLANEOUS
92 Chapter 5
The OVSNMP Configuration API
The OVSNMP Configuration API Functions
Chapter 5 93
The OVSNMP Configuration API
Data Structures for the OVSNMP Configuration API
Header Files
The header file defines many data structures that are part of the
OVSNMP configuration API. The only header file required to use the
OVSNMP configuration API functions is
$OV_HEADER/OV/OVsnmpConf.h1. See Table 3-5 for a list of all header
files included in the OVSNMP API.
Data Structures
Table 5-2 describes the key data structures that are used with the
OVSNMP Configuration API.
Table 5-2 SNMP Configuration API Data Structures
94 Chapter 5
The OVSNMP Configuration API
Data Structures for the OVSNMP Configuration API
char * name The name of the destination for which the configuration
parameters apply. This may be an IP hostname, an IP
address, an IP address wildcard, or a non-SNMP entity that
is proxied for.
char * community The SNMP community name, which is used by the OVSNMP
API when issuing SNMP Get and GetNext requests to the
destination. This community name is also used for SNMP
Set requests if the setCommunity field is not specified.
Chapter 5 95
The OVSNMP Configuration API
Data Structures for the OVSNMP Configuration API
char * proxy The identity of a proxy for the destination. This may be an
IP hostname or an IP address. If the destination is accessed
directly, this field contains the value of
SNMP_CONF_DONT_PROXY_STRING.
int timeout The amount of time, in tenths of a second, the OVSNMP API
will initially wait for an SNMP response before attempting
to retransmit the SNMP request to the destination.
u_short remotePort The UDP port number on the destination or proxy node (as
appropriate) where the SNMP agent on that node expects to
receive SNMP requests for the destination. The standard
SNMP port is 161. This field is generally used only for
specialized proxy agents which do not listen to the standard
SNMP port.
96 Chapter 5
The OVSNMP Configuration API
Data Structures for the OVSNMP Configuration API
OVsnmpConfWcList OVsnmpConfWcList
* next * next NULL
* confEntry * confEntry
OVsnmpConfEntry OVsnmpConfEntry
*name *name
*community *community
*setCommunity *setCommunity
*proxy *proxy
timeout timeout
retry retry
pollInterval pollInterval
remotePort remotePort
Chapter 5 97
The OVSNMP Configuration API
Data Structures for the OVSNMP Configuration API
OVsnmpConfDest
*confEntry
isProxied OVsnmpConfEntry
*name
ipAddr
*community
ipAddrAge
*setCommunity
agent name
*proxy
agentAddr
timeout
retry
pollInterval
remotePort
98 Chapter 5
The OVSNMP Configuration API
Data Structures for the OVSNMP Configuration API
struct sockaddr* agentAddr Pointer to the address of the SNMP agent for this
destination. Supported address families are
AF-INET and AF-IPX. By default, only AF_INET
(udp/ip) destinations are returned.
The SNMP_CONF_RESOLVE.ANYADDR flag must be
specified as input to OVsnmpConfResolveDest()
in order for both IP and IPX destinations to be
returned. This is done for compatibility of existing
IP-only applications.
time_t ipAddrAge The date and time when the ipAddr field was last
queried from the IP address name server. This
value is obtained from time().
Chapter 5 99
The OVSNMP Configuration API
Data Structures for the OVSNMP Configuration API
int ipAddrAge The age limit, in seconds, for IP address stored in the
SNMP configuration run-time cache. This value is used
by OVsnmpConfResolveDest() to determine when a
cached IP address must be updated by consulting the
system’s IP address name server.
cacheFlags_t cacheFlags The level of run-time cache enabled for the SNMP
configuration database. By default, resolved
configuration parameters and the IP address of
previously referenced destinations are cached. This
improves the performance of applications when the
same destination is subsequently referenced.
Cache Flags
The cache flag in the OVsnmpConfCntl structure may be set to one of the
following:
• SNMP_CONF_CACHE_NONE
Run-time caching of SNMP configuration parameters and IP
addresses is disabled. The information is recomputed each time a
destination is referenced.
100 Chapter 5
The OVSNMP Configuration API
Data Structures for the OVSNMP Configuration API
• SNMP_CONF_CACHE_NOADDR
SNMP configuration parameters for previously referenced
destinations are maintained in the SNMP configuration run-time
cache. However, the IP address of those destinations is not
maintained in the cache. The IP address is determined each time the
destination is referenced by consulting the IP address name server.
• SNMP_CONF_CACHE_ALL
Both SNMP configuration parameters and the IP address of
previously referenced destinations are maintained in the SNMP
configuration run-time cache.
Compatibility Flags
The compatibility flag in the OVsnmpConfCntl structure may be set to
one of the following:
• SNMP_CONF_SHADOW_NONE
The configuration file for release 3.2 backward compatibility is not
maintained. This mode of operation should only be used if all
OVSNMP API-based applications installed and running on the
system have been linked with a later release of the OVSNMP API.
• SNMP_CONF_SHADOW_32ONLY
Only the subset of entries in the SNMP configuration database,
which are configured to use the default SNMP port for
communications, are maintained in the backward compatibility file.
This will optimize performance of Release 3.2-based applications.
However, if the xnmsnmpconf -import command is subsequently
used with the resulting shadow file, some information in the SNMP
configuration database will be lost.
• SNMP_CONF_SHADOW_ALL
All entries in the SNMP configuration database are maintained in
the Release 3.2-compatible configuration file. This mode of operation
ensures absolute consistency between the SNMP configuration
database and the compatibility configuration file. However, this
mode may cause unnecessary performance degradation of Release
3.2-based applications if there are many proxy entries which use a
non-default SNMP port configured in the SNMP configuration
database.
Chapter 5 101
The OVSNMP Configuration API
Data Structures for the OVSNMP Configuration API
102 Chapter 5
6 Integrating with Logging and
Tracing
Chapter 6 103
Integrating with Logging and Tracing
104 Chapter 6
Integrating with Logging and Tracing
Overview of Logging and Tracing
Chapter 6 105
Integrating with Logging and Tracing
Overview of Logging and Tracing
106 Chapter 6
Integrating with Logging and Tracing
The OVuTL Application Programming Interface
Function Description
OVuTLInit() Initializes the name of the calling software and the hostname for the
logging and tracing output. You must call OVuTLInit() once only,
before any calls to OVuLog() or OVuTrace().
For more information about the OVuTL API, see the OVuTL (3) reference
page in this manual. It contains important details, examples of how to
use this API, and examples of how to get output.
Chapter 6 107
Integrating with Logging and Tracing
The OVuTL Application Programming Interface
108 Chapter 6
7 Integrating with Process
Management
Chapter 7 109
Integrating with Process Management
NOTE The Local Registration File (LRF) is an important file for your process.
This chapter discusses only the first and second line of that file, since
these lines pertain to process management. Any additional lines in this
file are not relevant to Network Node Manager.
110 Chapter 7
Integrating with Process Management
Process Management for HP OpenView Applications
Chapter 7 111
Integrating with Process Management
Process Management for HP OpenView Applications
Administrative Commands:
ovaddobj
LRF command
ovstart, ovstop, ovpause,
ovresume,ovstatus
Requests
Responses ovsuf
ovsnmpd
Tracing &
Logging
Subsystem
Figure 7-1 illustrates how the ovspmd process operates. Note that the
diagram shows three kinds of processes:
Well-behaved Processes
A well-behaved process uses the OVsPMD API — the
topic of the next section — to communicate with
ovspmd. It sends ovspmd status information regarding
successful and unsuccessful initialization, normal and
abnormal termination, and pause and resume
information if configured to do so. ovspmd considers a
“well-behaved” process to have initialized successfully
only when it explicitly reports that it has. A
“well-behaved” process also exits when it receives the
command OVS_CMD_EXIT from ovspmd. If the process
fails to respond, the exit command is escalated to
112 Chapter 7
Integrating with Process Management
Process Management for HP OpenView Applications
1. If you are writing a new program, you will probably want to use the
OVsPMD API and create a well-behaved process. This is by far the
best choice.
Chapter 7 113
Integrating with Process Management
Process Management for HP OpenView Applications
2. If you have an existing process that does not go into the background,
you can decide to not modify it, and declare it a non-well-behaved
process. This may be expedient, but it is less than ideal. It would be
better to take a little time to incorporate simple calls to the OVsPMD
API and create a well-behaved process.
3. If you have an existing process that does go into the background, you
can decide to not modify it, and declare it a daemon process. This too
may be expedient, but results in a poorly integrated process.
4. If you want your process to receive pause and resume notification,
your process must be well-behaved.
To decide what to do, you may want to understand something about the
OVsPMD API, the topic of the next section.
114 Chapter 7
Integrating with Process Management
The OVsPMD Application Programming Interface
Function Description
See the reference page for OVsPMD_API (3) for additional details. In
general, use these rules to create a well-behaved process:
Chapter 7 115
Integrating with Process Management
The OVsPMD Application Programming Interface
116 Chapter 7
Integrating with Process Management
The Local Registration File
— its name
— where its executable code is located
— how to start it.
• The LRF also declares information about the objects the process
manages. (These declarations appear in any additional lines after
the first two in the LRF)
As a developer, it is your responsibility to provide an LRF with your
process. The LRF makes it possible for the HP OpenView platform to
manage your process. The LRF must contain the first two lines of
information, which describe the process.
Line Description
Chapter 7 117
Integrating with Process Management
The Local Registration File
General Syntax
Each line in an LRF contains two or more fields. Each field is terminated
by a colon, including the last field. Some fields are optional; it is
recommended that you still include the colon terminator for the missing
fields.
The number symbol (#) indicates the beginning of a comment, which
continues to the end of the line. White space (spaces, tab characters, and
newlines) is not permitted within any field, nor are any multibyte
characters. In the first two lines of the LRF, only printable ASCII
characters are allowed (values between decimal 32 and 126). The colon
(:), comma (,), backslash (\), and number sign (#) can only appear as
terminator characters, as noted above and in later syntax descriptions.
NOTE You must put a backslash in front of the colon that specifies the drive
specification on the Windows operating systems. This prevents the colon
in the path from being interpreted as a field terminator.
Field 1: Name
Specifies the name of the process being registered. You are responsible
for ensuring the uniqueness of the process name.
For example, you could append your company’s name:
IPMgr_A.017.0_MegaCorp_International
118 Chapter 7
Integrating with Process Management
The Local Registration File
The name must be the same name used in the session parameter to the
mp_bind() function call, and is the name used when invoking ovstart,
ovstop, ovstatus, and ovisrunning.
Field 2: Path
Specifies the location of the process executable code. Specify the full
(absolute) pathname. If you have set up universal path names, you can
specify the partial pathname relative to the path install_dir\BIN or
$OV_BIN. Note that if a directory is not specified for the executable,
install_dir\BIN or $OV_BIN is assumed.
NOTE You must put a backslash in front of the colon that specifies the drive
specification on Windows operating systems. This prevents the colon in
the path from being interpreted as a field terminator. For example,
IPMgr_A.017.0_MegaCorp_International:C\:install_dir\bin\netmon:
Chapter 7 119
Integrating with Process Management
The Local Registration File
There are seven fields in the second line of the LRF. Each field is
terminated by a colon (:). The following Table 7-4 describes each field in
turn. Following the table is a complete description of each field.
Table 7-4 Second Line of the LRF&
120 Chapter 7
Integrating with Process Management
The Local Registration File
Field 2: Dependencies
This is a list of process names, separated by commas, that must already
be running before your process can be started. ovspmd uses this
information to determine the order in which to start processes. Use the
names as they appear in the “Name” field of the pertinent LRFs.
Field 3: Arguments
The arguments specified in this field are passed to the process as it starts
up, just as if a user had passed them from the command line. Commas or
blanks can be used to separate multiple arguments in this field. For
example, suppose the arguments field had this entry—
“-i,-b,amazon:”. This would be equivalent to “-i -b amazon” on the
command line.
Field 4: Behavior
This field specifies how the process will interact with ovspmd. Processes
can be “well-behaved,” “non-well-behaved,” or “daemons,” as described
earlier. Possible values for this field: OVs_WELL_BEHAVED,
OVs_NON_WELL_BEHAVED, and OVs_DAEMON.
Field 5: Timeout
For “well-behaved” processes, this field is used to manage evident startup
failures. There are two cases:
Chapter 7 121
Integrating with Process Management
The Local Registration File
This field is also used as the PAUSE timeout. It specifies the amount of
time a process has to respond to an OVS_CMD_PAUSE. If the process does
not respond in time, the pause operation fails.
For “well-behaved” processes with Field 6 set to PAUSE, the timeout field
is also used to manage a failure to respond to an OVs_CMD_PAUSE. A
failure to respond within the timeout is processed as a PAUSE NACK.
Field 6: Pause
For “well-behaved” processes, this field is used to register for pause and
resume messages. Possible values for this field include: PAUSE and
NOPAUSE. The default is NOPAUSE: specifying NOPAUSE or leaving the
field blank prevents ovspmd from sending pause and resume messages to
your process.
A process that is dependent on one or more NNM processes must
accurately specify these dependencies in its LRF to ensure that it is
paused before and resumed after all processes on which it is dependent.
For more information about backup refer to “Integration with NNM
Automated Backup” on page 123.
122 Chapter 7
Integrating with Process Management
Integration with NNM Automated Backup
NOTE Integration with backup is not required. However, while NNM is paused,
ovw and other OV processes block on any received OVw and OVwDb API
calls. Applications and services (background processes) that do not
integrate with automated backup, but that do interact with
HP OpenView APIs and processes cannot communicate with NNM while
the HP OpenView processes are paused. For this reason, you need to
understand and possibly respond to the backup model even though you
do not intend to participate in backups.
Chapter 7 123
Integrating with Process Management
Integration with NNM Automated Backup
124 Chapter 7
Integrating with Process Management
Integration with NNM Automated Backup
Data Copy
Stage
initiate
backup
Data Archive
Stage
Operational pause
Phase copy data to
processes permanent
archive
copy
operational data
to staging area
Data Restore
Stage
Analytical resume
Phase processes copy data
from
permanent
archive
copy
analytical data
to staging area
Chapter 7 125
Integrating with Process Management
Integration with NNM Automated Backup
After the operational phase has completed, the analytical phase is run.
The purpose of this phase is to create a snapshot of any HP OpenView
data that needs to be backed up, but does not need to be synchronized
with the operational data. During the analytical phase NNM provides
scripts to create a snapshot of the following data:
Archiving Data
The automated backup utilities do not provide tools for archiving the
data after it is placed into the staging directory. Each site needs to
provide tools to archive the data from the staging area to backup media.
Restoring Data
The restore utility, ovrestore.ovpl, requires that
126 Chapter 7
Integrating with Process Management
Integration with NNM Automated Backup
Evaluating An Application
To make it easy to integrate with automated backup this section provides
the information to help you determine which means of integrating are
relevant to your application. Then, you can focus on those sections of the
documentation which provide the integration information needed by
your application, while skipping the other sections.
For each decision tree, answer the question in the diamonds based on
what you know about the internals of your application.
When you reach the end of each decision tree you will know if that form
of integration is relevant to your application. The sections referenced at
the end points of the decision trees are the parts of the documentation
which provide additional information about how to integrate. Note that
the three means of integrating are not mutually exclusive. For a
particular application one, two, or all three may be appropriate.
Chapter 7 127
Integrating with Process Management
Integration with NNM Automated Backup
Script Integration
Script integration is done by adding scripts to the backup script
directories. It is a way for an application to get its data backed up along
with the NNM data.
Script integration consists of providing a backup script and a recovery
script for the application’s data. The script may be integrated into the
operational or analytical directory, depending on the relationship of the
application’s data to the NNM operational data. If this applies to your
application, refer to “Writing Backup Scripts” on page 131.
YES
128 Chapter 7
Integrating with Process Management
Integration with NNM Automated Backup
triggering the callback is a pause rather than an actual map close. If this
applies to your application, refer to “Integration via ovwMapClose” on
page 133.
YES
Chapter 7 129
Integrating with Process Management
Integration with NNM Automated Backup
YES
NO
Does that background
Does the background process
process have dependencies
access the application’s data
on other NNM background NO
store?
processes?
YES YES
130 Chapter 7
Integrating with Process Management
Integration with NNM Automated Backup
ovbackup.ovpl
runs: Data Copy Stage
operational copy
Data Restore Stage
Phase
scripts operational
data to staging
area
initiate administrator
restore runs restore
resume script
post-resume system restore
scripts operational
data
Analytical
copy
restore
Phase
Chapter 7 131
Integrating with Process Management
Integration with NNM Automated Backup
132 Chapter 7
Integrating with Process Management
Integration with NNM Automated Backup
Chapter 7 133
Integrating with Process Management
Integration with NNM Automated Backup
copy
analytical data restore
to staging area analytical
data
134 Chapter 7
Integrating with Process Management
Integration with NNM Automated Backup
initiate
backup
copy
operational data
to staging area
copy
analytical data
to staging area
Chapter 7 135
Integrating with Process Management
Integration with NNM Automated Backup
After NNM completes the dependent phase of its backup process, ovspmd
sends notification (OVS_CMD_RESUME) to registered services. Your service
should acknowledge the resume message using
OVsResponse(OVS_RSP_RESUME_ACK "text").
If your service cannot resume operations, use
OVsResponse(OVS_RSP_RESUME_NACK "text")
Care should be taken when choosing a timeout value for your process. If
the timeout duration is too short, your process may cause the ovpause
command to fail (and therefore cause ovbackup.ovpl to fail). If it is too
long, the system could take too long to report a valid error with your
process. Some of the ovw processes will have been paused already, and
the user will be unable to interact with these subsystems. Remember
that the timeout value is specified in seconds. Also keep in mind that
some users may have slow machines.
136 Chapter 7
Index
A D
agent, 25 data structures, 64, 67, 94
agents memory management, 62
daemon, 113, 121 data types
non-well-behaved, 121 ASN.1, 35
well-behaved, 112 dot notation, 34
API architecture, 21
applications E
SNMPv2 style, 66 enterprise-specific MIB, 35
ASN.1, 35, 73, 76 environment variables
data representation, 35 OV_HEADER, 64
data types, 35 error codes, 46
error values
B macro for mapping, 66
background, sending your process into, 116 Event Log File Group, 81
bilingual communication mode, 45 extended MIB, 35
BITS, 35
blocking mode, 27, 53 F
file descriptor for a session, 68
C flags, 100, 101
cache flags, in OVsnmpConfCntl, 100 foreign device
callback definition, 26
function, 70
parameters, 70 G
ccitt(0), 33 Gauge, 35
communications APIs Gauge32, 35
for communications, 56 Get Bulk Request, 30
for manual retransmission, 56 Get Next Request, 29
for message setup/management, 56 Get Request, 29
for session management, 56 Get Response, 29
in SNMP library, 56
communications model H
agent process, 25 header files, 64, 94
manager process, 25
SNMP, 25 I
compatibility flags, in OVsnmpConfCntl, 101
compiling and linking, 64 include files, 64, 94
configuration API, 89 inform message, 28
data structures, 94 Inform Request, 30
header files, 94 installing the SDK, 19
INTEGER, 35
connectionless operation, 26 Integer32, 35
conventions integration
typographical, 13 with logging, 105
correlated events with process management, 111
receiving, 51
with tracing, 105
Correlation Log File Group, 81
Counter, 35 interface behavior, 45
Counter32, 35 IPAddress, 35
Counter64, 35 IPX protocol, 50
iso(1), 33
137
Index
J O
joint-iso-ccitt(2), 33 OBJECT IDENTIFIER, 35
object identifier, 33, 34
L OCTET STRING, 35
OID, 33, 34
linking, with library, 64 OID, dot notation, 34
location transparency and proxies, 37 OV_HEADER, 64
logging ovaddobj, and SUF, 111
and OVuTL API, 105 OVEventDb API, 81
description of, 105 OVEventDbClose, 83
severity levels, 105 OVEventDbCorrEntryListGetNext, 84
LRF, 111 OVEventDbCorrEntryListGetNumElements
agent name and location, 118 , 84
and ovstart, ovstop, ovstatus, and OVEventDbEventIdtoUuid, 85
mp_bind(), 119 OVEventDbEventListGetNext, 82, 84
and Process Management, 117 OVEventDbFindCorrelatedEvents, 82, 83
contents of, 117 OVEventDbFreeCorrEntry, 83
general syntax, 118 OVEventDbFreeCorrEntryList, 84
OVEventDbFreeEvent, 83
line 1 syntax, 118 OVEventDbFreeEventList, 84
line 2 syntax, 120 OVEventDbGetChildEvent, 84
mandatory, 22 OVEventDbGetChildId, 84
OVEventDbGetCorrelationTree, 82, 83
M OVEventDbGetCorrEventStatus, 84
Management Information Base, 31 OVEventDbGetNumChildren, 84
manager, 25 OVEventDbGetOVsnmpPdu, 84
manual retransmission communications OVEventDbGetParentId, 84
APIs, 56 OVEventDbGetTreeLevel, 84
memory management, 61 OVEventDbIsEventCorrelated, 83
message setup/management OVEventDbOpenCorrLogforReading, 83
communications APIs, 56 OVEventDbOpenLogforReading, 83
MIB OVEventDbOpenStreamforReading, 83
enterprise-specific, 35 OVEventDbReadNextCorrEntry, 83
OVEventDbReadNextEvent, 83
extended, 35 OVEventDbUuidToEventId, 85
MIB-II, 31 OVsDone(), 115
MIB-II object definition OVsInit(), 115
OID, 33 OVsInitComplete(), 115
OVSNMP API, 19
N enhanced error codes, 47
naming tree, 33 IPX support, 50
ccitt(0), 33 memory management, 61
iso(1), 33 multitransport interface, 50
joint-iso-ccitt(2), 33 on Windows, 55
NDBM Offset File Group, 81 protocol support, 43, 48
nettl, 105 protocol translations, 45
NetworkAddress, 35 OVSNMP API, architecture, 21
non-blocking mode, 27, 53 OVSNMP configuration API, 89
notifications, 25, 28 functions, 90
NT. See Windows OVsnmpAddNullVarBind, 56
OVsnmpAddTypedVarBind, 56
OVsnmpBlockingSend, 56
138
Index
OVsnmpCallback, 56 OVuint64CmpUInt32, 56
OVsnmpCancel, 56 OVuint64Divide, 56
OVsnmpClose, 56 OVuint64DivideUInt32, 56
OVsnmpConfCntl structure OVuint64FromStr, 56
cache flags, 100 OVuint64Multiply, 56
compatibility flags, 101 OVuint64MultiplyUInt32, 56
description of, 100 OVuint64Shift, 56
OVsnmpConfDest structure, 98 OVuint64Subtract, 56
OVsnmpConfEntry structure, 95 OVuint64SubtractUInt32, 56
OVsnmpConfWcList structure, 96 OVuint64ToStr, 56
OVsnmpCopyPdu, 56 OVuLog(), 107
OVsnmpCreatePdu, 56 OVuTL API
OVsnmpErrString, 56 functions of, 107
OVsnmpEventOpen, 56 tracing and logging, 105
OVsnmpFixPdu, 56 OVuTrace(), 107
OVsnmpFreePdu, 56
OVsnmpGetRetryInfo, 56 P
OVsnmpOpen, 50, 56 PDU
OVsnmpPdu, 72, 76, 96, 98 description of, 26
OVsnmpPdu structure, 52, 67, 72, 76
OVsnmpRead, 56 trap, 73, 76
OVsnmpRecv, 56, 70 process management, 111
OVsnmpSend, 56 ovspmd, 111
OVsnmpSession structure, 54, 68 OVsPMD API, 115
OVsnmpTrapOpen, 56 ovstart, 111
OVsnmpVal, 67, 78 ovstatus, 111
OVsnmpVarBind, 67 ovstop, 111
OVsnmpVarBind structure, 73, 76 protocol support, 43
OVsnmpWEventOpen, 56 protocols
OVsnmpWOpen, 56 SNMP, 29
OVsnmpXCancel, 56 proxy
OVsnmpXClose, 56 and location transparency, 37
OVsnmpXEventOpen, 56 description of, 26
OVsnmpXOpen, 56
OVsnmpXSend, 56
OVsnmpXTrapOpen, 56 R
ovspmd references to other documents, 38
diagram, 111 retransmission communications APIs, 56
process management daemon, 111 retransmissions, 53, 55
OVsPMD API RFC list, 38
functions in, 115
rules for use, 115 S
OVsReceive(), 115 select(), 116
ovstart, 111 select(2), 68
ovstatus, 111 session management communications APIs,
ovstop, 111 56
ovtrapd session, sequence of communication, 27
on UNIX, 28 Set Request, 29
on Windows, 28 SMI, 31
OVuint64Add, 56 SNMPv1, 31
OVuint64AddUInt32, 56 SNMP
OVuint64Assign, 56 operations, 29
OVuint64Cmp, 56
139
Index
SNMP Configuration API WinSNMP API, 20
data structures, 94
functions in, 90 X
header files, 94 X11 event loop, 55
SNMP library, communications API
functions in, 56
SNMP session
sequence of actions, 27
SNMP_STD2OV_ERR, 56
SNMPv1
operations, 29
SNMPv1 protocol, 29, 43
SNMPv2
operations, 30
SNMPv2 Trap Request, 30
SNMPv2C protocol, 29, 43
Software Development Kit, 19
startup file (SUF), 111
Stream Log File Group, 81
Structure of Management Information, 31
structures, 94, 100
OVsnmpConfDest, 98
OVsnmpConfEntry, 95
OVsnmpConfWcList, 96
OVsnmpPdu, 52, 72, 76
OVsnmpSession, 68
OVsnmpVarBind, 73, 76
T
Timeticks, 35
tracing
and OVuTL API, 105
description of, 105
trap PDU, 73, 76
Trap Request, 29
trapd, 28
traps, 25, 28, 73, 76
communication sequence, 28
U
UDP, 26, 50
User Datagram Protocol/Internet Protocol,
27
W
Win32 message loop, 55
Windows
IPX support, 50
ported application support, 50
traps, 28
140