This paper will guide you through the basics of setting up a Cortex unit to perform SNMP SET commands on an SNMP-enabled device. For this example, we are using a TCP/IP-enabled PDU from CyberPower to control one of its eight AC outlets. This setup could be used to power cycle (reboot) a router or other network equipment that has stopped responding to Ping requests for example.
The steps given here demonstrate a basic procedure that can be replicated with a variety of SNMP-enabled devices, with only minor changes.
To be able to configure and use a Cortex to control an SNMP-enabled device, six basic parameters are required, which are:
- IP address of the SNMP-enabled device
- Read & Write Community names of the SNMP-enabled device
- OID of the I/O’s to control
- I/O’s control values
- Value type of the control values
- SNMP Version
The next pages give explanations on how to obtain these parameters, and how to set them up in a Cortex.
The test setup requires the following:
- A Davicom Cortex unit (can be provided later)
- An SNMP-enabled device (CyberPower model PDU41001 in this example)
- The MIB file of the SNMP-enabled device (available from the manufacturer, and sometimes downloadable from within the equipment itself)
- A computer running a MIB browser (free version of iReasoning in this example)
Connect the Cortex, the PDU (or other SNMP-enabled device), and the computer to a local network, and set their IP parameters so that they can all communicate with each other.
Using the computer’s web browser, connect to the PDU and look at its SNMP settings. An example is given below.
Under the SNMP settings, enable the SNMP, set the Read Only Community name to public, and set the Read/Write Community name to private. These same two community names are often the ones used by default in SNMP equipment, but other ones might be used. Always check to make sure what they are. This device is now ready.
Before performing SNMP commands on a piece of equipment, several things are required and must be known, like the OID number of the I/O’s to be controlled, and the different values needed to control these I/O’s. This information can be found in the MIB file.
For ease of understanding, we are using a live setup in this text, but it is possible to navigate through a MIB file without being connected to the SNMP-enabled device itself.
Launch iReasoning, go to its menu, click on the Advanced button, and fill-in the properties as shown in the image below (use the IP address of your SNMP-enabled device, not the address shown in the image).
Still in iReasoning, at the top, in the Address box, enter the IP address of your SNM-enabled device.
Click on File, then Open MIBs, and browse to the location of the device MIB file. Once loaded, it will look like this.
Browsing a MIB file allows you to see which I/O’s from the equipment are available for control. The MIB may also include information about other products or models, so it may be necessary to look for the desired device in the list. For example, the MIB listing shown below includes several products, like a UPS, a switch, a PDU, and a sensor. Always make sure to use the most recent MIB file that matches your device’s model or type.
We are interested in the PDU, which shows up in the list as ePDU.
Expand the device’s tree and all the available I/O categories will become visible.
Since we want to control an outlet, we look for just such a group name in the tree. The group highlighted in the screenshot below is the one that we are looking for.
Double-click on ePDUOutletControlOutletCommand and a list like the one below will show-up. The list shows all 8 outlets that are available for control. Click on the first line, which corresponds to Outlet #1.
Look at the top of iReasoning in the OID box: the numerical sequence that shows up is the actual OID of the Outlet #1 Control of the PDU, under which the outlet can be turned on or off by sending proper values. Take note of this exact numerical sequence as it will later be needed.
Now that we have the OID of the outlet, let’s find the values needed to turn it on and off.
In iReasoning, with the ePDUOutletControlOutletCommand still selected, look at the lower left corner of the window, as seen in the screenshot below.
The Syntax box provides information about the type of values to use, which in this case is INTEGER, and also provides information about the different values to use in regards to the desired action to be made (On, Off, Reboot, etc.)
The Indexes box provides more information on the SNMP actions and the values to use. We see that:
- To turn the outlet off, use the value given under immediateOff, which is 2.
- To turn the outlet on, use the value given under immediateOn, which is 1.
These two values are the ones to use to turn the outlet on and off.
At this point, to control the PDU, we have all of the required six basic parameters that are given at the beginning of this document:
- IP address of the SNMP-enabled device: 172.16.203.21 (use yours, not this one)
- Read & Write Community names of the SNMP-enabled device: public and private
- OID of the I/O to control: .188.8.131.52.4.1.3808.1.1.3.184.108.40.206.4.1
- I/O`s control values: 1 (on) and 2 (off)
- Value type of the control values: Integer
- SNMP Version: V1
Factory defaults of the Cortex360 allow it to do SNMP commands, so no special options other than what is presented here are required. Note that the Cortex320 requires an option to be able to perform SNMP Manager commands.
Connect to the Cortex, and go to Outputs > SNMP SETs.
Click on the (Add)button.
Select a free SNMP SET Output from the ID list (basic units have 128 SET commands available).
Enter a description for the Active state and the Normal state.
Click on the Action tab.
As seen in the screenshot below, populate the highlighted areas with the information shown, but use the IP address of your SNMP-enabled device, not the one listed here. When done, save.
These settings are all the 6 basic ones that have been described earlier.
Click on either Test Normal or Test Active to send a SET command to control PDU outlet #1. It will turn it on or off depending on its current state.
Following the SNMP SET test, a validation message will appear to tell about the success of the command.
Congratulations! You have configured your first SNMP SET command in your Davicom Cortex unit.