Page 3 - Contents; Preface; vii; Overview; iii
Contents Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii 1 Overview 1.1 SNMP Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1–1 1.2 Request Handling . . . . . . . . ....
Page 4 - Support Routines; iv
4 Using the SNMP Utilities 4.1 Using the MIB Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4–1 4.1.1 MIB Browser Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4–1 4.1.2 MIB Browser Flags . . . . . . . . . . . . . . . . . . . ...
Page 5 - viii
cmp_oid_prefix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5–48 clone_oid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5–49 free_oid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...
Page 7 - Intended Audience; This manual contains the following chapters:
Preface The Compaq TCP/IP Services for OpenVMS product is the Compaqimplementation of the TCP/IP networking protocol suite and internet servicesfor OpenVMS Alpha and OpenVMS VAX systems. A layered software product, TCP/IP Services provides a comprehensive suiteof functions and applications that supp...
Page 8 - Related Documents; Table 1 TCP/IP Services Documentation; Manual; This reference card contains inforomation about commonly
Related Documents Table 1 lists the documents available with this version of TCP/IP Services. Table 1 TCP/IP Services Documentation Manual Contents DIGITAL TCP/IP Services forOpenVMS Concepts and Planning This manual provides conceptual information about networkingand the TCP/IP protocol including a...
Page 9 - Reader’s Comments; Internet; How to Order Additional Documentation; Compaq TCP/IP Services for OpenVMS Alpha; ix
Table 1 (Cont.) TCP/IP Services Documentation Manual Contents Compaq TCP/IP Services for OpenVMSSockets API and System ServicesProgramming This manual describes how to use the Sockets API and OpenVMSsystem services to develop network applications. Compaq TCP/IP Services for OpenVMSSNMP Programming a...
Page 10 - bold text; italic text
The following conventions are used in this manual. In addition, please note thatall IP addresses are fictitious. Ctrl/x A sequence such as Ctrl/x indicates that you must hold downthe key labeled Ctrl while you press another key or a pointingdevice button. PF1 x A sequence such as PF1 x indicates tha...
Page 11 - Monospace text; numbers
Monospace text Monospace type indicates code examples and interactive screendisplays. This typeface indicates UNIX system output or user input,commands, options, files, directories, utilities, hosts, and users. In the C programming language, this typeface identifies thefollowing elements: keywords, ...
Page 13 - Overview; The files useful in developing your own subagent (Section 1.4); SNMP Architecture; Figure 1–1 illustrates the SNMP architecture.
1 Overview The Simple Network Management Protocol (SNMP) is the de facto industrystandard for managing TCP/IP networks. The protocol defines the role of anetwork management station (NMS) and the SNMP agent. SNMP allows remoteusers on an NMS to monitor and manage network entities such as hosts, route...
Page 14 - Figure 1–1 SNMP Architecture; The SNMP environment consists of the following elements:
Overview1.1 SNMP Architecture Figure 1–1 SNMP Architecture Master Agent SNMP/ASN.1 Library eSNMP API AgentX (TCP/IP V5.1) Subagent 1 Subagent 2 Subagent n TCP/IP Kernel OpenVMS VM-0704A-AI The SNMP environment consists of the following elements: • The master agent, a process that runs on the host an...
Page 15 - Figure 1–2 eSNMP Data Flow; The client component is not provided with TCP/IP Services.
Overview 1.2 Request Handling Figure 1–2 eSNMP Data Flow VM-0705A-AI Client Trap client Master Agent Subagent 1 Subagent 2 Subagent 1 Client Master Agent Subagent n NMS1 NMS2 Legend: Host 1 Host 2 Network 161 161 705 Flow of trap notification Flow of get/set request Flow of "are_you_there" m...
Page 16 - File; MIB II subagent image.
Overview1.2 Request Handling The network management station sends an SNMP request to the masteragent running on the host, using port 161. An SNMP request is made usingone of the following commands: • Get • GetNext • GetBulk • Set Note TCP/IP Services does not support the standard SNMP Inform command...
Page 17 - Command procedure; Writing an eSNMP Subagent
Overview 1.3 TCP/IP Services Components for SNMP Table 1–1 (Cont.) SNMP Component Files File Location Function TCPIP$SNMP_TRAPRCV.EXE SYS$SYSTEM Utility for receiving trapmessages. TCPIP$ESNMP_SHR.EXE SYS$SHARE Image file containing eSNMPapplication programminginterface (API) routines. TCPIP$SNMP_ST...
Page 18 - Table 1–2 Files for Building a Subagent; Interpreter for MIB converter.; awk; shell script that takes a MIB
Overview1.4 Writing an eSNMP Subagent Table 1–2 Files for Building a Subagent File Description ESNMP.H Header file used to create a subagent. Located inTCPIP$ESNMP. GAWK.EXE Interpreter for MIB converter. MIB-CONVERTER.AWK A UNIX based awk shell script that takes a MIB definition in ASN.1 notation a...
Page 19 - VARBIND
Overview 1.5 The eSNMP API Interface routines handle the basic subagent operations, such as: • Subagent initialization and termination • Registration • Polling of the master agent • Trap sending • UNIX system time conversion • Adding and removing subagent capabilities registered with the master agen...
Page 21 - For More Information
Overview 1.7 SNMP Versions If you have problems running images linked against an older version ofUCX$ESNMP_SHR.EXE, verify that the version in SYS$SHARE is thelatest by entering the following DCL command: $ DIRECTORY/DATE SYS$SHARE:*$ESNMP_SHR.EXE The creation dates of the files with the prefix TCPI...
Page 23 - MIBs Provided with TCP/IP Services; Overview of the Host Resources MIB; Defining Host Resources MIB Implemented Objects; Table 2–1 Host Resources MIB Objects; Object Name; hrSystemUptime; MIBs Provided with TCP/IP Services 2–1
2 MIBs Provided with TCP/IP Services This chapter describes how MIBs are implemented on OpenVMS. The MIBsprovided with TCP/IP Services are: • The Host Resources MIB, which manages operating system objects(Section 2.1) • MIB II, which manages TCP/IP kernel objects (Section 2.2) 2.1 Overview of the Ho...
Page 25 - SNMP; set; MIBs Provided with TCP/IP Services 2–3
MIBs Provided with TCP/IP Services 2.1 Overview of the Host Resources MIB Table 2–1 (Cont.) Host Resources MIB Objects Object Name RFC Description OpenVMS Description hrNetworkIfIndex The value of the ifIndex thatcorresponds to this networkdevice. The value of the index in the interfacetable in the ...
Page 26 - Note; Code; Any other OpenVMS status.; –4 MIBs Provided with TCP/IP Services
MIBs Provided with TCP/IP Services2.1 Overview of the Host Resources MIB hrFSLastFullBackupDatehrFSLastPartialBackupDatehrStorageSizehrSWRunStatushrSystemDatehrSystemInitialLoadDevicehrSystemInitialLoadParameters Note For objects that are not implemented, the Host Resources MIB returns a NoSuchObjec...
Page 27 - Overview of MIB II; MIBs Provided with TCP/IP Services 2–5
MIBs Provided with TCP/IP Services 2.1 Overview of the Host Resources MIB TCPIP$SNMP_REQUEST.EXE responds with no output and returns directlyto the DCL prompt. After an NFS mount, the following information is returned in response to a Get request. The data items implemented for OpenVMS (refer to RFC...
Page 28 - group; Restrictions to MIB II Implementation; –6 MIBs Provided with TCP/IP Services
MIBs Provided with TCP/IP Services2.2 Overview of MIB II 2.2.1 MIB II Implemented Groups A group is a subdivision of a MIB that defines a subtree. SNMP as implementedby TCP/IP Services supports the following groups: • system (1) • interfaces (2) • Internet Protocol (4) • ICMP (5) • TCP (6) • UDP (7)...
Page 29 - request on the; MIBs Provided with TCP/IP Services 2–7
MIBs Provided with TCP/IP Services 2.2 Overview of MIB II When both the TCPIP$OS_MIBS and TCPIP$HR_MIB subagents arerunning, a get request on the sysORTable is as follows. Except where noted, the OIDs conform to RFC 1907. 1.3.6.1.2.1.1.9.1.2.1 = 1.3.6.1.4.1.36.15.3.3.1.11.3.6.1.2.1.1.9.1.2.2 = 1.3.6...
Page 31 - Creating a Subagent Using the eSNMP API; Including the routines and building the subagent (Section 3.4); Creating a MIB Specification; Defining the structure of a particular MIB; Creating a Subagent Using the eSNMP API 3–1
3 Creating a Subagent Using the eSNMP API This chapter describes how to use the eSNMP API to create a MIB subagent thatmanages entities or applications. Topics included in this chapter are: • Creating a MIB specification (Section 3.1) • The structure of management information (Section 3.2) • Creatin...
Page 32 - Assigning Object Identification Codes; Each OID has two parts:; Subidentifier 1 values range from 0 to 2, inclusive.; –2 Creating a Subagent Using the eSNMP API
Creating a Subagent Using the eSNMP API3.2 The Structure of Management Information 3.2.1 Assigning Object Identification Codes Each object in a MIB is associated with an identifier of the ASN.1 type, calledan object identifier (OID). OIDs are unique integers that follow a hierarchicalnaming conventi...
Page 33 - Figure 3–1 MIB II in SMI Tree Structure; Creating a Subagent Using the eSNMP API 3–3
Creating a Subagent Using the eSNMP API 3.2 The Structure of Management Information Figure 3–1 MIB II in SMI Tree Structure VM-0721A-AI iso (1) org (3) dod (6) internet (1) directory (1) mgmt (2) mib2 (1) system (1) interfaces (2) at (3) ip (4) icmp (5) tcp (6) udp (7) egp (8) transmission (10) snmp...
Page 34 - –4 Creating a Subagent Using the eSNMP API
Creating a Subagent Using the eSNMP API3.2 The Structure of Management Information For example, the chess MIB provided with the sample code in the[TCPIP$EXAMPLES.SNMP] directory has an element with the name ‘‘chess.’’The OID for the element chess is 1.3.6.1.4.1.36.2.15.2.99, which is derived fromits...
Page 35 - Creating a MIB Source File; script, which runs on; Processing the Input File with the MIB Compiler; snmpi; and; mosy; The syntax for the MIBCOMP command is as follows:; Creating a Subagent Using the eSNMP API 3–5
Creating a Subagent Using the eSNMP API 3.2 The Structure of Management Information Normally, it is the nonleaf nodes that are registered as a subtree with the masteragent. However, leaf nodes, or even specific instances, can be registered as asubtree. The master agent delivers requests to the subag...
Page 36 - subtree; –6 Creating a Subagent Using the eSNMP API
Creating a Subagent Using the eSNMP API3.3 Creating a MIB Source File The parameters and qualifiers for the MIBCOMP command are as follows: Parameter or Qualifier Definition MIB-source-file A comma-separated list of MIB definition files. Thestandard extension is .MY, but you can specify any validOpe...
Page 37 - Creating a Subagent Using the eSNMP API 3–7
Creating a Subagent Using the eSNMP API 3.3 Creating a MIB Source File enum: complete 1 enum: underway 2 enum: delete 3 moveTable 1.3.6.1.4.1.36.2.15.2.99.5 moveEntry 1.3.6.1.4.1.36.2.15.2.99.5.1 indexes: gameIndex moveIndex moveIndex 1.3.6.1.4.1.36.2.15.2.99.5.1.1INTEGER read-write moveByWhite 1.3....
Page 38 - Declaration Section; routine to; Index Definitions Section; type; –8 Creating a Subagent Using the eSNMP API
Creating a Subagent Using the eSNMP API3.3 Creating a MIB Source File 1. Declaration Section The first section of the subtree_TBL.H file is a declaration of the subtreestructure. The subtree is automatically initialized by code in the subtree_TBL.Cfile. A pointer to this structure is passed to the e...
Page 39 - OID; Method Routine Prototypes Section; Get; operations. If the group contains any writable variables,; Set; An array of integers representing the OIDs for each MIB variable; Array of Integers Section; Creating a Subagent Using the eSNMP API 3–9
Creating a Subagent Using the eSNMP API 3.3 Creating a MIB Source File typedef struct _chess_type { OID ches; int chessMaxGames; int chessNumGames; char chessProductID_mark;char chessMaxGames_mark;char chessNumGames_mark; } chess_type; Although MIB group structures are provided for your use, you are...
Page 40 - Array of OBJECT Structures Section; –10 Creating a Subagent Using the eSNMP API
Creating a Subagent Using the eSNMP API3.3 Creating a MIB Source File 2. Array of OBJECT Structures Section The second section of the subtree_TBL.C file is an array of OBJECT structures.Each MIB variable within the subtree has one OBJECT. The chess exampleproduces the following: static OBJECT object...
Page 41 - Initialized Subtree Structure Section; Description; definitions found in; . These are provided as a convenience and are; Including the Routines and Building the Subagent; To produce executable subagent code, follow these steps:; Creating a Subagent Using the eSNMP API 3–11
Creating a Subagent Using the eSNMP API 3.3 Creating a MIB Source File 3. Initialized Subtree Structure Section The third section of the subtree_TBL.C file is the SUBTREE structure itself. Apointer to this structure is passed to the eSNMP library routine esnmp_register to register the subtree. It is...
Page 42 - Including Extension Subagents in the Startup and Shutdown; File Name
Creating a Subagent Using the eSNMP API3.4 Including the Routines and Building the Subagent Depending on the version of the Compaq C compiler you are using, you mightsee warnings that you can ignore. Portions of these warnings are as follows: %CC-I-SIGNEDKNOWN In this declaration, DEC C recognizes t...
Page 43 - Edit the example lines to:; Creating a Subagent Using the eSNMP API 3–13
Creating a Subagent Using the eSNMP API 3.5 Including Extension Subagents in the Startup and Shutdown Procedures File Name Edit Required TCPIP$EXTENSION_MIB_SHUTDOWN.COM Edit the example lines to: • Include symbols for the detached processes thatare running custom images. Use the same processnames s...
Page 45 - Using the SNMP Utilities; Using the MIB Browser; Table 4–1 snmp_request Command Parameters; Parameter; agent; Using the SNMP Utilities 4–1
4 Using the SNMP Utilities TCP/IP Services includes the following programs, which are useful for testingapplications and for analyzing SNMP problems: • TCPIP$SNMP_REQUEST (MIB browser) (Section 4.1) • TCPIP$SNMP_TRPSND (trap sender) (Section 4.2) • TCPIP$SNMP_TRPRCV (trap receiver) (Section 4.2) The...
Page 46 - PDU type to send. Can be one of the following SNMP requests:; variable; Data type of the value. This parameter can be specified for; value; –2 Using the SNMP Utilities
Using the SNMP Utilities4.1 Using the MIB Browser Table 4–1 (Cont.) snmp_request Command Parameters Parameter Function "community" The community string to be used in the query. This parameter is casesensitive. Typically, agents are configured to permit read access tothe community string "...
Page 47 - Table 4–2 Flags for the snmp_request Command; Flag; You cannot use the; Using the SNMP Utilities 4–3
Using the SNMP Utilities 4.1 Using the MIB Browser Table 4–2 Flags for the snmp_request Command Flag Description -d Specifies hexadecimal dump mode. Before displaying a return value, displaysa hexadecimal dump of SNMP packets sent and received. For example: $ snmp_request host1 "public" getn...
Page 49 - GetNext; Table 4–3 Data Types for the snmp_request and snmp_trapsnd Commands; Data Type; Using the SNMP Utilities 4–5
Using the SNMP Utilities 4.1 Using the MIB Browser Table 4–2 (Cont.) Flags for the snmp_request Command Flag Description -s sleep_interval Specifies the number of seconds between iterations of sending a request(for the -r flag) and listening for a reply (for the -i ) flag. The default is 1 second. T...
Page 50 - location; Examples; ifDescr; –6 Using the SNMP Utilities
Using the SNMP Utilities4.1 Using the MIB Browser Note Except for -l (Counter64), the data types are case sensitive. To preserve uppercase for display strings and NULL, enclose the value in doublequotation marks. For example, ‘‘– D ’’ or ‘‘– N ’’. On OpenVMS Alpha systems, you must specify the value...
Page 51 - Loopback Port; Using the SNMP Utilities 4–7
Using the SNMP Utilities 4.1 Using the MIB Browser $ snmp_request marley.dec.com "public" get 1.3.6.1.2.1.2.2.1.2.1 -_$ 1.3.6.1.2.1.25.1.1.0 1.3.6.1.2.1.2.2.1.2.1 = LO IP Interface: LO0, OpenVMS Adapter: <none>, Loopback Port 1.3.6.1.2.1.25.1.1.0 = 6024942 = 0 d 16:44:9 3. The followin...
Page 52 - Using the Trap Sender and Trap Receiver Programs; –8 Using the SNMP Utilities
Using the SNMP Utilities4.1 Using the MIB Browser 6. The following example uses the same command as in example 5, but itspecifies the -t flag instead of the -l flag. Only OIDs with the prefix matching the input OID are returned. Note that as with other getnext request examples, the value for the inp...
Page 53 - snmpTrapOID; Using the SNMP Utilities 4–9
Using the SNMP Utilities 4.2 Using the Trap Sender and Trap Receiver Programs By default, these programs use UDP port 162. However, you can specify anotherport with the -p flag or set up an SNMP-trap service that specifies the port you want to use. Note, however, that the use of UDP port 162 is code...
Page 54 - Table 4–4 Parameters for the snmp_trapsnd Command; enterprise; Table 4–5 describes the; Table 4–5 Flags for the snmp_trapsnd Command
Using the SNMP Utilities4.2 Using the Trap Sender and Trap Receiver Programs Table 4–4 Parameters for the snmp_trapsnd Command Parameter Description enterprise For SNMP Version 1, specifies the enterprise object identifier (OID) on whosebehalf the trap is being sent. For example, 1.3.6.1.4.1.1. If y...
Page 55 - or; localhost; public; mynode; special; Using the SNMP Utilities 4–11
Using the SNMP Utilities 4.2 Using the Trap Sender and Trap Receiver Programs Table 4–5 (Cont.) Flags for the snmp_trapsnd Command Flag Description -h host Specifies the host name or IP address (in ASN.1 dot notation format) of thedestination host to receive the trap message. The default is localhos...
Page 56 - Entering Commands for the Trap Receiver Program; To run the trap receiver program, do the following:; Table 4–6 snmp_traprcv Command Flags; Displays a hexadecimal and formatted dump of the received packet.; –12 Using the SNMP Utilities
Using the SNMP Utilities4.2 Using the Trap Sender and Trap Receiver Programs enterprise - 1.2.3agent address - 6.20.208.53trap type - Enterprise-specific (6)enterprise-specific value - (33)timeticks - 100 4.2.2 Entering Commands for the Trap Receiver Program The trap receiver program lets you listen...
Page 57 - Using the SNMP Utilities 4–13
Using the SNMP Utilities 4.2 Using the Trap Sender and Trap Receiver Programs account that has SYSPRV privilege. Note that the port number must be greaterthan zero. 4.2.2.3 Trap Receiver Examples 1. The following example requests trap information on a system that does nothave traps configured and do...
Page 59 - eSNMP API Routines; Interface Routines; Table 5–1 Interface Routines; Routine; sysORTable; eSNMP API Routines 5–1
5 eSNMP API Routines This chapter provides reference information about the following types ofapplication programming interface (API) routines in the eSNMP developer ’s kit: • Interface routines (Section 5.1) • Method routines (Section 5.2) • Support routines (Section 5.3) 5.1 Interface Routines The ...
Page 60 - socket; –2 eSNMP API Routines
eSNMP API Routinesesnmp_init esnmp_init Initializes the Extensible SNMP (eSNMP) subagent and initiates communication with the master agent. Format int esnmp_init (int *socket, char *subagent_identifier ) ; Arguments socket The address of the integer that receives the socket descriptor used by eSNMP....
Page 61 - libesnmp; timeout; OIDs; eSNMP API Routines 5–3
eSNMP API Routines esnmp_register esnmp_register Requests local registration of a single MIB subtree. This indicates to the masteragent that the subagent instantiates MIB variables within the registered MIBsubtree. Format int esnmp_register ( subtree *subtree, int timeout,int priority ) ; Arguments ...
Page 62 - –4 eSNMP API Routines
eSNMP API Routinesesnmp_register A subtree is identified by the base MIB name and the corresponding OID number of the node that is the parent of all MIB variables contained in the subtree. Forexample: The MIB II tcp subtree has an OID of 1.3.6.1.2.1.6 . All elements subordinate to this have the same...
Page 63 - eSNMP API Routines 5–5
eSNMP API Routines esnmp_register status = esnmp_register( &ipRouteEntry_subtree, RESPONSE_TIMEOUT,REGISTRATION_PRIORITY ); if (status != ESNMP_LIB_OK) { printf ("Could not queue the ’ipRouteEntry’ \n");printf ("subtree for registration\n"); } eSNMP API Routines 5–5
Page 64 - The; Example; –6 eSNMP API Routines
eSNMP API Routinesesnmp_unregister esnmp_unregister Cancels registration of a MIB subtree previously registered with the masteragent. Format int esnmp_unregister ( SUBTREE *subtree ) ; Arguments subtree A pointer to a subtree structure corresponding to the subtree to be handled.The code emitted by t...
Page 65 - routine offers extensions to the; Format; reg; Field Name; priority; eSNMP API Routines 5–7
eSNMP API Routines esnmp_register2 esnmp_register2 Requests registration of a single MIB subtree. This indicates to the master agentthat the subagent instantiates MIB variables within the registered MIB subtree.The esnmp_register2 routine offers extensions to the esnmp_register routine. Format int e...
Page 66 - options; –8 eSNMP API Routines
eSNMP API Routinesesnmp_register2 Field Name Description range_upper_bound An integer value that, with a nonzero range_subidfield, specifies a range instead of one of the MIBsubtree’s OID subidentifiers. The range_upper_boundfield provides the upper bound of the range and therange_subid field provid...
Page 67 - eSNMP API Routines 5–9
eSNMP API Routines esnmp_register2 When restarting the eSNMP protocol by calling esnmp_init , all MIB subtree registrations are cleared. All MIB subtrees must be reregistered. A MIB subtree is identified by the base MIB variable name and its correspondingOID. This tuple represents the parent of all ...
Page 68 - initialize the ESNMP_REG structure; –10 eSNMP API Routines
eSNMP API Routinesesnmp_register2 Example #include <esnmp.h>#define RESPONSE_TIMEOUT 0 /* use the default time set in esnmp_init message */ #define REGISTRATION_PRIORITY 10 /* priority at which the MIB subtree will register */ #define RANGE_SUBID 7 /* the identifier position in oid->element...
Page 69 - A pointer to the ESNMP_REG structure that was used when the; eSNMP API Routines 5–11
eSNMP API Routines esnmp_unregister2 esnmp_unregister2 Cancels registration of a MIB subtree previously established with the masteragent. Use this routine only when the MIB subtree was registered using the esnmp_register2 routine. Format int esnmp_unregister2 ( ESNMP_REG *reg ) ; Arguments reg A poi...
Page 70 - –12 eSNMP API Routines
eSNMP API Routinesesnmp_capabilities esnmp_capabilities Adds a subagent’s capabilities to the master agent’s sysORTable . The sysORTable is a conceptual table that contains an agent’s object resources, and is described inRFC 1907. Format void esnmp_capabilities ( OID *agent_cap_id, char *agent_cap_d...
Page 71 - Removes a subagent’s capabilities from the master agent’s; sysORID; object in the; for the; eSNMP API Routines 5–13
eSNMP API Routines esnmp_uncapabilities esnmp_uncapabilities Removes a subagent’s capabilities from the master agent’s sysORTable . Format void esnmp_uncapabilities ( OID *agent_cap_id ) ; Arguments agent_cap_id A pointer to an object identifier that represents an authoritative agent capabilitieside...
Page 72 - OPEN; –14 eSNMP API Routines
eSNMP API Routinesesnmp_poll esnmp_poll Processes a pending message that was sent by the master agent. Format int esnmp_poll ( ) Description This routine is called after the select( ) call has indicated data is ready on the eSNMP socket. (This socket was returned from the call to the esnmp_init rout...
Page 73 - Return Values; The request was sent.; eSNMP API Routines 5–15
eSNMP API Routines esnmp_are_you_there esnmp_are_you_there Requests the master agent to report immediately that it is up and functioning. Format int esnmp_are_you_there ( ) ; Description The esnmp_are_you_there routine does not block waiting for a response. The routine is intended to cause the maste...
Page 74 - vb; –16 eSNMP API Routines
eSNMP API Routinesesnmp_trap esnmp_trap Sends a trap message to the master agent. Format int esnmp_trap ( int *generic_trap, int specific_trap,char *enterprise,varbind *vb ) 2 ; Arguments generic_trap A generic trap code. Set this argument value to 0 (zero) for SNMPv2 traps. specific_trap A specific...
Page 75 - eSNMP API Routines 5–17
eSNMP API Routines esnmp_term esnmp_term Sends a close message to the master agent and shuts down the subagent. Format void esnmp_term (void) ; Description Subagents must call this routine when terminating so that the master agent can update its MIB registry quickly and so that resources used by eSN...
Page 76 - timestamp; –18 eSNMP API Routines
eSNMP API Routinesesnmp_sysuptime esnmp_sysuptime Converts UNIX system time obtained from gettimeofday into a value with the same time base as sysUpTime . Format unsigned int esnmp_sysuptime ( struct timeval *timestamp ) ; Argument timestamp A pointer to struct timeval , which contains a value obtai...
Page 77 - eSNMP API Routines 5–19
eSNMP API Routines 5.2 Method Routines 5.2 Method Routines SNMP requests may contain many encoded MIB variables. The libsnmp code executing in a subagent matches each VariableBinding with an object table entry. The object table’s method routine is then called. Therefore, a methodroutine is called to...
Page 78 - method; action; only. This value indicates; GetBulk; varbind; instance2oid; –20 eSNMP API Routines
eSNMP API Routines*_get Routine *_get Routine The *_get routine is a method routine for the specified MIB item, which is typically a MIB group (for example, system in MIB II) or a table entry (for example, ifEntry in MIB II). Format int mib-group_get ( METHOD *method ) ; Arguments method A pointer t...
Page 79 - object; oid2instance; eSNMP API Routines 5–21
eSNMP API Routines *_get Routine Field Name Description object A pointer to the object table entry forthe MIB variable being referenced. Themethod->object->object_index field is thisobject’s unique index within the object table(useful when one method routine services manyobjects).The method-&g...
Page 80 - system; in; –22 eSNMP API Routines
eSNMP API Routines*_set Routine *_set Routine The *_set method routine for a specified MIB item, which is typically a MIB group (for example, system in MIB II) or a table entry (for example, ifEntry in MIB II). Format int mib-group_set ( METHOD *method ) ; Arguments method A pointer to a METHOD stru...
Page 81 - row; eSNMP API Routines 5–23
eSNMP API Routines *_set Routine Field Name Description row A pointer to a ROW_CONTEXT structure(defined in the ESNMP.H header file). All Set requests to the method routine that refer to thesame group and that have the same instancenumber will be presented with the same rowstructure. The method rout...
Page 82 - –24 eSNMP API Routines
eSNMP API Routines*_set Routine Return Values ESNMP_MTHD_noError The routine completed successfully. ESNMP_MTHD_notWritable The requested object cannot be set or was not implemented. ESNMP_MTHD_wrongType The data type for the requested value is thewrong type. ESNMP_MTHD_wrongLength The requested val...
Page 83 - eSNMP API Routines 5–25
eSNMP API Routines *_set Routine If any row reports failure, all rows that were successfully committed are toldto undo the phase. This is accomplished by calling a single method routinefor each row (the same one that was called for the commit phase), with amethod->action equal to ESNMP_ACT_UNDO. ...
Page 84 - Method Routine Applications Programming; –26 eSNMP API Routines
eSNMP API Routines*_set Routine • ESNMP_ACT_UNDO For each conceptual row that was successfully committed, the same methodroutine is called with method->action equal to ESNMP_ACT_UNDO. TheROW_CONTEXT structures that have not yet been called for the COMMITphase are not called for the UNDO phase; th...
Page 85 - instance2OID; These routines make a copy of the data you specify. The; function; eSNMP API Routines 5–27
eSNMP API Routines *_set Routine • Load the response OID back into the method routine’s VARBIND structure.Set the method->varbind field with the OID of the actual MIB variableinstance you are returning. This is usually accomplished by loading anarray of integers with the instance OID you wish to ...
Page 86 - –28 eSNMP API Routines
eSNMP API Routines*_set Routine The displaystring is different only in that the character array can be interpreted as ASCII text, but the octetstring can be anything. If theoctetstring contains bits or a bit string, the OCT structure contains thefollowing: A length equal to the number of bytes neede...
Page 87 - timeticks; eSNMP API Routines 5–29
eSNMP API Routines *_set Routine • ESNMP_TYPE_Integer32ESNMP_TYPE_Counter32ESNMP_TYPE_<Gauge32 (varbind->value.ul field) The 32-bit counter and 32-bit gauge data types are stored in the VARBINDstructure as an unsigned integer. Use the o_integer function to insert an unsigned value into the VAR...
Page 89 - OBJECT; IpAddress; eSNMP API Routines 5–31
eSNMP API Routines o_integer o_integer Loads an integer value into the VARBIND structure with the appropriate type. This function does not allocate the VARBIND structure. Format int o_integer ( VARBIND *vb,OBJECT *obj,unsigned long value ); Arguments vb A pointer to the VARBIND structure that is sup...
Page 90 - –32 eSNMP API Routines
eSNMP API Routineso_integer Example #include <esnmp.h>#include "ip_tbl.h" <-- for ipNetToMediaEntry_type definition VARBIND *vb = method->varbind; OBJECT *object = method->object; ipNetToMediaEntry_type *data;:: assume buffer and structure member assignments occur here:switch(...
Page 91 - malloc; command to allocate your; obj; The value to be inserted into the VARBIND structure.; The routine completed successfully.; eSNMP API Routines 5–33
eSNMP API Routines o_octet o_octet Loads an octet value into the VARBIND structure with the appropriate type. Thisfunction does not allocate the VARBIND structure. Format int o_octet ( VARBIND *vb, OBJECT *obj,unsigned long value ); Arguments vb A pointer to the VARBIND structure that is supposed to...
Page 92 - oid; –34 eSNMP API Routines
eSNMP API Routineso_oid o_oid Loads an OID value into the VARBIND structure with the appropriate type. This function does not allocate the VARBIND structure. Format int o_oid ( VARBIND *vb, OBJECT *obj,OID *oid ); Arguments vb A pointer to the VARBIND structure that is supposed to receive the data. ...
Page 93 - ptr; eSNMP API Routines 5–35
eSNMP API Routines o_string o_string Loads a string value into the VARBIND structure with the appropriate type. This function does not allocate the VARBIND structure. Format int o_string ( VARBIND *vb, OBJECT *obj,unsigned character *ptr,int len ); Arguments vb A pointer to the VARBIND structure tha...
Page 94 - –36 eSNMP API Routines
eSNMP API Routineso_string Example #include <esnmp.h>#include "ip_tbl.h" <-- for ipNetToMediaEntry_type definition VARBIND *vb = method->varbind; OBJECT *object = method->object; ipNetToMediaEntry_type *data;:: assume buffer and structure member assignments occur here:switch(a...
Page 95 - Loads a counter64 value into the VARBIND structure.; See the example for the; No error was generated.; eSNMP API Routines 5–37
eSNMP API Routines o_counter64 o_counter64 Loads a counter64 value into the VARBIND structure. Format int o_counter64 ( VARBIND *vb,OBJECT *obj,uint64 value ); (for Alpha)uint64_vax value ; (for VAX)) Arguments vb A pointer to the VARBIND structure that is supposed to receive the data. obj A pointer...
Page 96 - str2oid; –38 eSNMP API Routines
eSNMP API Routinesstr2oid str2oid Converts a null-terminated string OID in dot notation to an OID structure. The str2oid routine does not allocate an OID structure. Format oid *str2oid ( oid *oid, char *s ); Arguments oid The value to be inserted as data into the VARBIND structure. For more informat...
Page 97 - sprintoid; Converts an; An; can have up to 128 elements. A full-sized; can require a large buffer.; eSNMP API Routines 5–39
eSNMP API Routines sprintoid sprintoid Converts an OID into a null-terminated string. Format char *sprintoid ( char *buffer, oid *oid ); Description An OID can have up to 128 elements. A full-sized OID can require a large buffer. Return Values The return value points to its first argument. Example #...
Page 98 - new; len; instance; –40 eSNMP API Routines
eSNMP API Routinesinstance2oid instance2oid Copies the object’s base OID and appends a copy of the instance array to make a complete OID for a value. This routine does not allocate an OID structure. Itonly allocates the array containing the elements. Format oid instance2oid ( oid *new, object *obj,u...
Page 99 - eSNMP API Routines 5–41
eSNMP API Routines instance2oid Example #include <esnmp.h>VARBIND *vb; <-- filled in OBJECT *object; <-- filled in unsigned int instance[6]; -- Construct the outgoing OID in a GETNEXT -- -- Instance is N.1.A.A.A.A where A’s are IP address --instance[0] = data->ipNetToMediaIfIndex;inst...
Page 100 - –42 eSNMP API Routines
eSNMP API Routinesoid2instance oid2instance Extracts the instance values from an OID structure and copies them to the specified array of integers. The routine then returns the number of elements inthe array. Format int oid2instance ( oid *oid, object *obj,unsigned int *instance,int *max_len ); Argum...
Page 101 - eSNMP API Routines 5–43
eSNMP API Routines oid2instance Example #include <esnmp.h>OID *incoming = &method->varbind->name; OBJECT *object = method->object; int instLength; unsigned int instance[6]; -- in a GET operation ---- Expected Instance is N.1.A.A.A.A where A’s are IP address --instLength = oid2inst...
Page 102 - inst2ip; –44 eSNMP API Routines
eSNMP API Routinesinst2ip inst2ip Returns an IP address derived from an OID instance. Format int inst2ip ( unsigned int *instance, int *length,unsigned int *ipaddr,int *exact,int *carry ); Arguments instance A pointer to an array of unsigned int containing the instance numbers returned by the oid2in...
Page 103 - eSNMP API Routines 5–45
eSNMP API Routines inst2ip Description Use the EXACT mode for evaluating an instance for Get and Set operations. For GetNext and GetBulk operations, use the NEXT mode. When using NEXT mode, this routine assumes that the search for data will be performed using greaterthan or equal to matches. Return ...
Page 104 - n is a single value integer.; routine, passing it a 1 for the carry; –46 eSNMP API Routines
eSNMP API Routinesinst2ip The search key consists of a number and two ipaddr values. These arerepresented in the instance part of the OID as n.A.A.A.A.B.B.B.B, where: • n is a single value integer. • The A.A.A.A portion makes up one IP address. • The B.B.B.B portion makes up a second IP address. If ...
Page 105 - eSNMP API Routines 5–47
eSNMP API Routines cmp_oid cmp_oid Compares two OID structures. Format int cmp_oid ( oid *q, oid *p ); Description This routine does an element-by-element comparison, from the most significant element (element 0) to the least significant element. If all other elements areequal, the OID with the leas...
Page 106 - OID q; –48 eSNMP API Routines
eSNMP API Routinescmp_oid_prefix cmp_oid_prefix Compares an OID against a prefix. Format int cmp_oid_prefix ( oid *q, oid *prefix ); Description A prefix could be the OID on an object in the object table. The elements beyond the prefix are the instance information. This routine does an element-by-el...
Page 107 - A pointer to the OID structure that is to receive the copy.; A pointer to the OID structure where the data is to be obtained.; eSNMP API Routines 5–49
eSNMP API Routines clone_oid clone_oid Makes a copy of the OID. This routine does not allocate an OID structure. Format oid clone_oid ( oid *new, oid *oid ); Arguments new A pointer to the OID structure that is to receive the copy. oid A pointer to the OID structure where the data is to be obtained....
Page 108 - field and the NELEM structure.; –50 eSNMP API Routines
eSNMP API Routinesfree_oid free_oid Frees the OID structure’s buffer. This routine does not deallocate the OIDstructure itself; it deallocates the elements buffer attached to the structure. Format void free_oid ( oid *oid ); Description This routine frees the buffer pointed to by the OID->element...
Page 109 - Duplicates a buffer in a dynamically allocated space.; str; A pointer to the buffer to be duplicated.; The number of bytes to be copied.; Null; eSNMP API Routines 5–51
eSNMP API Routines clone_buf clone_buf Duplicates a buffer in a dynamically allocated space. Format char clone_buf ( char *str, int *len ); Arguments str A pointer to the buffer to be duplicated. len The number of bytes to be copied. Description One extra byte is always allocated at the end and is f...
Page 110 - mem2oct; –52 eSNMP API Routines
eSNMP API Routinesmem2oct mem2oct Converts a string (a buffer and length) to an oct structure with the new buffer ’s address and length. Format oct *mem2oct ( oct *new, char *buffer,int *len ); Arguments new A pointer to the oct structure receiving the data. buffer Pointer to the buffer to be conver...
Page 111 - eSNMP API Routines 5–53
eSNMP API Routines cmp_oct cmp_oct Compares two octet strings. Format int cmp_oct ( oct *oct1, oct *oct2 ); Arguments oct1 Pointer to the first octet string. oct2 Pointer to the second octet string. Description The two octet strings are compared byte-by-byte to determine the length of the shortest o...
Page 112 - –54 eSNMP API Routines
eSNMP API Routinesclone_oct clone_oct Makes a copy of the data in an oct structure. This routine does not allocate an oct structure; it allocates the buffer pointed to by the oct structure. Format oct clone_oct ( oct *new, oct *old ); Arguments new A pointer to the oct structure receiving the data. ...
Page 113 - eSNMP API Routines 5–55
eSNMP API Routines free_oct free_oct Frees the buffer attached to an oct structure. This routine does not deallocate the oct structure; it deallocates the buffer to which the oct structure points. Format void free_oct ( oct *oct ); Description This routine frees the dynamically allocated buffer to w...
Page 114 - This routine performs a; –56 eSNMP API Routines
eSNMP API Routinesfree_varbind_data free_varbind_data Frees the dynamically allocated fields in the VARBIND structure. However, thisroutine does not deallocate the VARBIND structure itself; it deallocates the nameand data buffers to which the VARBIND structure points. Format void free_varbind_data (...
Page 115 - stat; Level; ERROR; null; eSNMP API Routines 5–57
eSNMP API Routines set_debug_level set_debug_level Sets the logging level, which dictates what log messages are generated. Theprogram or module calls the routine during program initialization in response torun-time options. Format void set_debug_level ( int stat, unsigned integer null ); Arguments s...
Page 116 - –58 eSNMP API Routines
eSNMP API Routinesis_debug_level is_debug_level Tests the logging level to see whether the specified logging level is set. You cantest the logging levels as follows: Level Meaning ERROR Used when a bad error occurs, requiring restart. WARNING Used when a packet cannot be handled; this also impliesER...
Page 117 - printf; level is one of the following:; eSNMP API Routines 5–59
eSNMP API Routines ESNMP_LOG ESNMP_LOG This is an error declaration C macro defined in the ESNMP.H header file. It gathers the information that it can obtain and sends it to the log. Format ESNMP_LOG ( level, format, ... ); Description The esnmp_log routine is called using the ESNMP_LOG macro, which...
Page 118 - TRACE; sent to the specified file.; –60 eSNMP API Routines
eSNMP API Routines_ _print_varbind _ _print_varbind Displays the VARBIND and its contents. This routine is used for debuggingpurposes. To use this routine, you must set the debug level to TRACE . Output is sent to the specified file. Format _ _print_varbind ( VARBIND *vb, int indent ); Arguments vb ...
Page 119 - progname; eSNMP API Routines 5–61
eSNMP API Routines set_select_limit set_select_limit Sets the eSNMP select error limit. For more information, see Section 6.1. Format set_select_limit ( char *progname ); Arguments progname The subagent name. This argument is valid with DPI versions only. WithAgentX, the argument is NULL because sub...
Page 120 - prog; The program name as taken from; –62 eSNMP API Routines
eSNMP API Routines_ _set_progname _ _set_progname Specifies the program name that will be displayed in log messages. This routineshould be called from the main during program initialization. It needs to becalled only once. Format _ _set_progname ( char *prog ); Arguments prog The program name as tak...
Page 121 - routine has been called. You can; eSNMP API Routines 5–63
eSNMP API Routines _ _restore_progname _ _restore_progname Restores the program name from the second application of the set. This routineshould be called only after the _ _set_progname routine has been called. You can use this to restore the most recent program name only. Format _ _restore_progname ...
Page 122 - The full file specification for the subagent.; –64 eSNMP API Routines
eSNMP API Routines_ _parse_progname _ _parse_progname Parses the full file specification to extract only the file name and file extension. Format _ _parse_progname ( file-specification ); Arguments file-specification The full file specification for the subagent. Example #include "esnmp.h"sta...
Page 123 - eSNMP API Routines 5–65
eSNMP API Routines esnmp_cleanup esnmp_cleanup Closes open sockets that are used by the subagent for communicating with themaster agent. Format esnmp_cleanup ( ); Example #include "esnmp.h"int rc = ESNMP_LIB_OK;rc = esnmp_cleanup(); Return Values ESNMP_LIB_NOTOK There was no socket. ESNMP_LI...
Page 125 - Troubleshooting eSNMP Problems; This chapter describes:; Modifying the Subagent Error Limit; call repeatedly returns a -1 error value. (Note that standard SNMP; Modifying the Subagent Timeout; Troubleshooting eSNMP Problems 6–1
6 Troubleshooting eSNMP Problems The eSNMP modules provided with TCP/IP Services include troubleshootingfeatures that are useful in controlling the way your subagent works. This chapter describes: • How to modify the subagent error limit (Section 6.1) • How to modify the default subagent timeout val...
Page 126 - Output redirected from SYS$ERROR is logged to the following files:; –2 Troubleshooting eSNMP Problems
Troubleshooting eSNMP Problems6.2 Modifying the Subagent Timeout The TCPIP$ESNMP_DEFAULT_TIMEOUT value is from 0 to 60 seconds. (Youshould use 0 only for testing purposes, such as simulating problems on a heavilyloaded host or network.) If the value you specify contains nonnumeric digits or isoutsid...
Page 127 - WARNING (logs warning and error messages); Troubleshooting eSNMP Problems 6–3
Troubleshooting eSNMP Problems 6.3 Log Files TCP/IP Services does not support writing log files to locations other than theSYS$SYSDEVICE:[TCPIP$SNMP] directory. The log files contain startup and event information and additional messages,depending on the logging level specified for an agent. The SNMP...
Page 129 - Index; Index–1
Index A AgentX protocol, 1–2API functionality, 1–6ASN.1 files, 3–5 C C compiler, 3–1Chess example tree structure, 3–4 clone_buf support routine, 5–51 clone_oct support routine, 5–54 clone_oid support routine, 5–49 cmp_oct support routine, 5–53 cmp_oid support routine, 5–47 cmp_oid_prefix support rou...
Page 130 - Index–2
M Management information base (MIB), 1–1Master agent, 1–1 mem2oct support routine, 5–52 method routines routine reference, 5–19 to 5–24 MIB browser, 4–1 command examples, 4–6command flags, 4–2command parameters, 4–1data types, 4–5using, 4–1 MIBCOMP command example, 3–6command syntax, 3–5 MIB compile...
Page 131 - Index–3
Trap sender (cont’d) command parameters, 4–9running, 4–9 Troubleshooting features, 6–1 U UNIX utilities, 3–7 W Writing subagents compiling, 3–5creating source files, 3–5including in startup and shutdown, 3–12linking and building, 3–11object tables, 3–7using ASN.1, 3–5using UNIX utilities, 3–7 Index–...