Knowledge Base Article # Q200199

Summary

A guide to using SNMP in ATEASY via third-party software or the ATEasy WinSNMP driver

SNMP (Simple Network Management Protocol) is a networking protocol used to monitor and control network-attached devices such as adapters, routers, switches, workstations, and servers. To use SNMP to communicate with a device, the device must both support SNMP and have SNMP enabled. The primary functions that can be performed through SNMP are device identification, device property querying and device configuration. Since SNMP can be integrated with ATEasy, a technician using ATEasy can automate the testing of SNMP-enabled devices.

In this guide, we will discuss two ways to utilize SNMP within ATEasy:

Using 3rd party software

Using the WinSNMP API with the ATEasy SNMP.drv driver

Using 3rd party software

There are a few open-source SNMP Managers available to utilize for basic testing. This example will demonstrate using Net-SNMP. When installed, Net-SNMP adds command-line executables such as the SNMPGET, SNMPGETNEXT, and SNMPSET functions for OID querying, SNMPWALK for device location, and SNMPSTATUS and SNMPNETSTAT for device status information. Only a couple of these features will be used in the article for demonstration. The complete list of features is available on the Net-SNMP webpage.

The example below demonstrates calling the executable SNMPGet to query an OID for information and saving the results to a text file.

In the first WinExec command an OID, sysDescr.0, is requested from the local host and saved into "snmpgetresults.txt". The second WinExec command opens that file so the data can be viewed.

The SNMPGet procedure can be modified to use the other Net-SNMP features, such as SNMPNETSTAT which gives us the assignment of an agent's TCP and UDP ports.

Using the ATEasy v8.0 WinSNMP Driver

Another way to communicate with a target agent using SNMP protocol is to directly access the WinSNMP API provided with Microsoft Windows. The implementation is simplified through use of the WinSNMP ATEasy driver, which is available in ATEasy v8.0 and above. The driver also lists the procedure to install and configure the WinSNMP service required when using the Windows driver.

In the ATEasy implementation of WinSNMP, an SNMPGET call can request and retrieve the value of an Object Identifier in a single command, as shown here:

! Request the System Contact from the agentTestResult = SNMP Function Get("1.3.6.1.2.1.1.5.0")

With the ATEasy Driver included in the project, the preceding line of code acquires the System Contact octet string and assigns it back to the TestResult variable for use in ATEasy.

Similarly, the included function "SNMP Function Walk(...)" can be used to traverse a system and returns back all of the nodes between the start and stop OID specified.

!Return the data stored at all OIDs between 1.3.6.1.2.1 and 1.3.6.1.2.1.6.0TestResult = SNMP Function Walk("1.3.6.1.2.1", "1.3.6.1.2.1.1.6.0")

Summary

This demonstration of features just barely scratches the surface of the utility that SNMP provides. A complete listing of the WinSNMP ATEasy driver is available in ATEasy v8.0 and above. Hopefully, if your project is required to automate SNMP communication, this article has given you a good idea where to start.

As a note with NET-SNMP, you can edit the /usr/etc/snmp/snmp.conf file to allow you to add in custom mib files, and if using SNMPv3, you can define all the security/authentication parameters here, and you can add in custom mib files. This will make the net-snmp output easier to read and parse.