DC Control: a robust and low-cost SNMP agent for data centers

Jaime Dantas
Reverse Engineering
9 min readMay 6, 2020
DC Control Device

A few years ago, I’ve created a reliable and low-cost SNMP device to monitor and control a data center environment, and on this post, I’ll walk you through the entire design process I went through, as well as all features this network equipment is capable of. It’s safe to say this article ended up being quite long, so if something wasn’t clear enough, don't hesitate to contact me for further clarification.

This work resulted in the paper named Embedded Real-Time Environment Control System for Data Centers published in the XXIII CIENTEC 2017.

Overview

I organized this article into the following categories:

  • SNMP Network Protocol
  • System Design
  • DC Control Hardware
  • DC Control Software
  • Application in a Data Center
  • Data Analysis

SNMP Network Protocol

The Simple Network Management Protocol (SNMP) is a network protocol used for network management. It’s used to collect and control network devices such as routers, switches, servers, hubs, or any other equipment which implements the SNMP protocol. People usually mix SNMP with SMTP, so make no mistake, SNMP stands for network management, not an email protocol.

That being said, I’ll not explain in detail how this protocol work, since it’s not the goal of this article. Basically, there is a manager node that receives and sends data to agent nodes. The manager always sends a GET/SET request, and it always receives a GET/SET response.

In other words, SNMP devices expose data through variables using the Management Information Base (MIB) database. Currently, there’re three versions of this protocol, and the one I used was the SNMPv1. If you want to understand this protocol completely, I recommend reading the RFC 1157.

System Design

Now that you have a general idea of what SNMP is, let’s talk about the solution developed itself. Inside a data center, we can find several types of electronic equipment as well as mechanical systems such as the temperature control system that makes sure the surrounding environment is always in the complaint with the standards. In a small data center, several fully-equipped racks are placed in proximity of each either, and a climate control system is used to control the temperature of the room. Some specific zones of a data center accumulate more heat than others, as illustrated in the image bellow.

Temperature zones in a data center

There are several devices available in the market that can monitor the temperature of the rack and the data center as a whole. Some smart racks do offer this feature out of the box, which is quite handy (and pricy too). Alternatively, you can buy the APC NetBotz to equip your rack for monitoring your data center. Despite being one of the most reliable equipments for this job, its cost is very salty. Expect to spend hundreds if not thousands of dollars to buy one. If you live outside the US and have to import one of these devices, purchasing this equipment is not even an option due to the insanely high final cost.

With this mindset in mind, I created the DC Control, an extremely low-cost and reliable SNMP agent for data centers. The cost of the material for this device is around USD 80, which is almost 10 times less than its competitors.

DC Control

The following diagram highlights the overall architecture used in this project.

DC Control architecture

Note that DC Control does not only monitor the temperature of the data center, but it also opens the rack’s door and controls the air conditioner system.

DC Control Device

The DC Control device is based in the Arduino microcontroller. It has an LCD screen to display the configuration and the status of the equipment.

DHT11 temperature sensor

The temperature sensor is the DHT11 and the DHT22 sensors. I made all connectors and cables compatible with an ordinary RJ45 patch panel to make the maintenance easy and clear.

As a final result, the DC Control device became a well-built device ready to be used in any rack.

DC Control device

Microcontroller

As I mentioned above, the microcontroller inside DC Control is the ATmega328, commonly known as Arduino.

ATmega328 UNO R3 with the Ethernet Shield W5100

I used an Ethernet Shield with the Arduino to enable Ethernet 10/100 connection.

Together, this combination gave the Arduino an incredible power. All I had left to do was to design the electronic circuit and build the code.

Inside the private tree of the SNMP protocol, the iso.organization.dod.inter- net.private (1.3.6.1.4), I created all objects we use in our system. Note that there is a command for each action.

Private identifies

Using the Wireshark software, after tacking the communication between the server (manager) and the agent (DC Control), we can see the SNMP communication for the temperature check command.

Wireshark snapshot for snmpTEMP’s command

Now it’s time to check the code itself. I created an SNMP library in C to be used in this project. I based the development of this library in the previous work done by Agentuino in 2012.

I’ll go over a few points about the microcontroller firmware I built. First, I defined the set of commands.

const static char snmpTEMP1[] PROGMEM   = "1.3.6.1.2.1.6540.1.0";  const static char snmpTEMP2[] PROGMEM   = "1.3.6.1.2.1.6540.2.0";

The loop() function is constantly checking for new Protocol Data Units (PDUs) received from the manager through the method pduReceived().

Upon receiving a GET Request for temperature sensor 1, for instance, the microcontroller will read the sensor, encode its value, transform into a PDU, and send it in the GET Response.

...
else if ( strcmp_P(oid, snmpTEMP1 ) == 0 ) {
status = pdu.VALUE.encode(SNMP_SYNTAX_OCTETS, TemperatureDHT);
pdu.type = SNMP_PDU_RESPONSE;
pdu.error = status;
}
...

Another point worth mentioning is that the internal loop is also checking for updates in the variables (IPs, temps, name, etc), so whenever these values change, it updates the LCD of the device.

All devices are equipped with an internal Negative Temperature Coefficient (NTC) Thermistor for internal temperature checks. In order the display its value, a function was created to calculate the real temperature value based on its electrical signal. The Steinhart–Hart equation was used to obtain a more precise coefficient for this operation.

Steinhart–Hart Equation

The temperature was set to be checked every 1 second.

float Termistor() {  
Temp = log(9060.0*((1024.0/analogRead(TERMISTOR_PIN)-1)));
Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp );
Temp = Temp - 273.15; // Convert Kelvin to Celcius
double multiplier = pow(10, 1 || 0);
Temp = round(Temp * multiplier) / multiplier;
return Temp;
}

Electronic Circuit

When it comes to the PCB board, a lot of effort was put into it. First, I created two power suppliers to feed the system. I then moved to the control board, which is responsible for controlling the air conditioner and reading the temperature sensors. I won’t spend tons of time explaining how the circuit works, so if you want to know more about its internal components, I encourage you to read the paper I published or the 77 pages long manal I created.

The electronic circuit of DC Control

In order the create the Printed Circuit Board (PCB), I used the well-known method for creating homemade PCBs describe here.

PCB created

The end result was quite satisfactory, with nice copper lines and a good overall look.

PCB Created

Below you can see an image with the inside view of the equipment built.

DC Control Inside View

DC Control Software

Finally, I created a multiplatform desktop application for controlling and monitor the data center using the DC Control. The stack chosen was Java due to its multiplatform capabilities.

Data Center Environment Control System

For the GUI, I used our old school Java Swing with its several JFrame capabilities. Please, don’t judge me. At the time, back is 2015, Java Swing was a real thing (some may argue against that though). Anyways, aside from several graphs to monitor the temperature, this software has a window for controlling the rack’s door opening as well as the air conditioner.

Sofware running with 10 agents

There is also the possibility to set the temperature in which the air conditioner will automatically turn on. An alarm is shown whenever the temperature of an agent surpasses the preset value, thus, turning on the air conditioner.

As always, the source code for the system is available in my GitHub.

Now, let’s see a real application and analyze the practical results.

Use Case

I had the opportunity to install and validate this equipment in one of the many data centers of RNP, which is a huge player in the Internet market in Brazil.

RNP data center used in the trial

I created a private LAN network and monitored the data center environment for several hours.

DC Control network created on Zabbix

A Zabbix server was created so I could build a dashboard and manage the alarms through email. Also, data extracted from an APC NetBooz was compared with the one removed from the DC Control device.

Results

Bellow, we can see the temperature graph for one hour time period extracted from the DC Control System.

DC Control temperature sensors

I created a dashboard in Zabbix to monitor not only the temperature, but also the state of the air conditioner and the rack’s door.

In order to validate the analysis, the temperature was compared against the ACP NetBooz readings.

DC Control temperature
APC NetBooz temperature

As can be seen, the DC Control was quite accurate and precise in the readings.

As a plus, with a smartphone, I installed an Android APP with SNMP client features and connected it to the DC Control device to check its sensors.

Connecting to DC Control with an Android APP

Overall, all tests were successful, including the automatic control of the air conditioner.

Conclusion

DC Control turned out to be an awesome device with great features for those who are looking for an affordable data center environment monitor. All about this project is open-source, and you can reproduce as you wish.

I hope you liked this project, and if you have any questions at all, please drop me a message. I’ll be happy to hear your thoughts about this project.

Thanks for reading it!

www.jaimedantas.com

--

--