---
title: "DC Control: a robust and low-cost SNMP agent for data centers"
url: "https://maker.wiznet.io/teddy/projects/dc-control%3A-a-robust-and-low-cost-snmp-agent-for-data-centers/"
markdown_url: "https://maker.wiznet.io/teddy/projects/dc-control%3A-a-robust-and-low-cost-snmp-agent-for-data-centers/md"
type: "UCC: User Created Content"
author: "Jaime Dantas"
author_url: "https://medium.com/reverse-engineering/dc-control-a-robust-low-cost-snmp-agent-for-data-centers-f4a3d7149389"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "Jaime Dantas"
original_url: "https://medium.com/reverse-engineering/dc-control-a-robust-low-cost-snmp-agent-for-data-centers-f4a3d7149389"
published: "2022-11-28"
language: "en"
likes: 2
views: 1967
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

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

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

Original author: Jaime Dantas (source: https://medium.com/reverse-engineering/dc-control-a-robust-low-cost-snmp-agent-for-data-centers-f4a3d7149389)

## Documents and links

- [Arduino-SNMP](https://github.com/jaimedantas/Arduino-SNMP.git) (code)

## Article

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

![](https://miro.medium.com/max/700/1*xmZdC78MRremt4UVI1Pfyg.png)![](https://miro.medium.com/max/700/1*xmZdC78MRremt4UVI1Pfyg.png)

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**](https://jaimedantas.com/pdf/paperDcControl.pdf)publishedin the [XXIII CIENTEC 2017](https://sigeventos.ufrn.br/evento/CIENTEC2017).

## **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](https://en.wikipedia.org/wiki/Simple_Network_Management_Protocol)) 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](https://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol), 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.

![](https://miro.medium.com/max/500/1*UK5eloTXMuS9TIU-Eo-kFg.png)

![](https://miro.medium.com/max/500/1*UK5eloTXMuS9TIU-Eo-kFg.png)

In other words, SNMP devices expose data through variables using the Management Information Base ([MIB](https://en.wikipedia.org/wiki/Management_information_base)) 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](https://tools.ietf.org/html/rfc1157).

## **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.

![](https://miro.medium.com/max/700/1*ZGf5NnMka1pmI7DLsui-AA.jpeg)

![](https://miro.medium.com/max/700/1*ZGf5NnMka1pmI7DLsui-AA.jpeg)

*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](https://www.apc.com/shop/br/pt/categories/security-and-environmental-monitoring/security-and-environmental-appliances/netbotz-400/N-1l2f3lz) 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.

![](https://miro.medium.com/max/604/1*67CKKK3w4sCR7UprgwsnUg.png)

![](https://miro.medium.com/max/604/1*67CKKK3w4sCR7UprgwsnUg.png)

*DC Control*

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

![](https://miro.medium.com/max/700/1*WN2TkbExEB-bNsjXkkesaw.png)

![](https://miro.medium.com/max/700/1*WN2TkbExEB-bNsjXkkesaw.png)

*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 configurati

on and the status of the equipment.

![](https://miro.medium.com/max/700/1*Lge2r4CyyvnNEFm45PEUtg.png)

![](https://miro.medium.com/max/335/1*Ibi4jk5Mu0w-ZPtcgVefcw.png)![](https://miro.medium.com/max/700/1*Lge2r4CyyvnNEFm45PEUtg.png)

![](https://miro.medium.com/max/335/1*Ibi4jk5Mu0w-ZPtcgVefcw.png)

*DHT11 temperature sensor*

The temperature sensor is the [DHT11](https://learn.adafruit.com/dht) and the DHT22 sensors. I made all connectors and cables compatible with an ordinary [RJ45](https://en.wikipedia.org/wiki/Registered_jack#RJ11,_RJ14,_RJ25_wiring) 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.

![](https://miro.medium.com/max/700/1*RxudhmzYgRrodm27CH02PQ.png)

![](https://miro.medium.com/max/700/1*RxudhmzYgRrodm27CH02PQ.png)

*DC Control device*

## **Microcontroller**

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

![](https://miro.medium.com/max/600/1*k-280_sqxr5NOt9ycve-jA.jpeg)

![](https://miro.medium.com/max/600/1*k-280_sqxr5NOt9ycve-jA.jpeg)

*ATmega328 UNO R3 with the Ethernet Shield W5100*

I used an [Ethernet Shield](http://www.danduino.dk/shop/geekcreit-atmega328-uno-r3-ethernet-shield-w5100-kit-for-arduino/)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.

![](https://miro.medium.com/max/700/1*mSfoe-zX4eTQjdtogZbWzw.png)

![](https://miro.medium.com/max/700/1*mSfoe-zX4eTQjdtogZbWzw.png)

*Private identifies*

Using the [Wireshark](https://www.wireshark.org/) 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.

![](https://miro.medium.com/max/653/1*6oU3BSDlXRYGsAlvlDLB1w.png)

![](https://miro.medium.com/max/653/1*6oU3BSDlXRYGsAlvlDLB1w.png)

*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](https://code.google.com/archive/p/agentuino/) in 2012.

## [**jaimedantas/Arduino-SNMP**](https://github.com/jaimedantas/Arduino-SNMP)

### [The SNMP Device is an embedded hardware architecture capable of monitoring and controlling a data center environment…](https://github.com/jaimedantas/Arduino-SNMP)

[github.com](https://github.com/jaimedantas/Arduino-SNMP)

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](https://www.ibm.com/support/knowledgecenter/SSB23S_1.1.0.2020/gtpc1/pdus.html)) 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.

```
void loop()
{
  if(locUpTime - generalTime > 3){
    int chk = DHT.read22(DHT11_PIN);
    dtostrf(DHT.temperature, 4,1,TemperatiraDHT);
    dtostrf(DHT.humidity, 4,1,Humidade);
    generalTime=locUpTime;
  }
  dtostrf(Termistor(), 4,1,TemperaturraTermistor);
  dtostrf(bitRead(PORTD,3), 2,0, Ar);
  dtostrf(bitRead(PORTD,4), 2,0,isPorta);
  sprintf(mensagem, "AR %s | PORTA %s" ,Ar, isPorta);
  Agentuino.listen();
  locUpTime = millis()/1000;
  dtostrf(locUpTime, 10,0,upTimeString);
  if(!digitalRead(BOTAO_PIN)){
    lcd.clear();
    MostrarNoLCD(tela);
    delay(500);
    tela++;
    if(tela>7) tela=1;
  }
}
```

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](https://en.wikipedia.org/wiki/Steinhart%E2%80%93Hart_equation) was used to obtain a more precise coefficient for this operation.

![](https://miro.medium.com/max/399/1*NZ6mmcp2yznP1Q4bsjGOig.png)

![](https://miro.medium.com/max/399/1*NZ6mmcp2yznP1Q4bsjGOig.png)

***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](https://jaimedantas.com/pdf/paperDcControl.pdf) I published or the [77 pages long manal](https://github.com/jaimedantas/DC_Control/blob/master/Manual-TCC.pdf) I created.

![](https://miro.medium.com/max/700/1*fGCwU9D24lZJDeKvT7WA0Q.png)

![](https://miro.medium.com/max/700/1*fGCwU9D24lZJDeKvT7WA0Q.png)

*The electronic circuit of DC Control*

In order the create the Printed Circuit Board ([PCB](https://en.wikipedia.org/wiki/Printed_circuit_board)), I used the well-known method for creating homemade PCBs describe [here](https://www.pcbcart.com/article/content/PCB-manufacturing-process.html).

![](https://miro.medium.com/max/700/1*zqrSZzqliDjep436U6LE1A.png)

![](https://miro.medium.com/max/700/1*zqrSZzqliDjep436U6LE1A.png)

*PCB created*

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

![](https://miro.medium.com/max/517/1*BmFDhodt50vMH2FM0Ilpdg.png)

![](https://miro.medium.com/max/517/1*BmFDhodt50vMH2FM0Ilpdg.png)

*PCB Created*

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

![](https://miro.medium.com/max/700/1*bNUweg4KnC5ieScTbRO5Zg.png)

![](https://miro.medium.com/max/700/1*bNUweg4KnC5ieScTbRO5Zg.png)

*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.

![](https://miro.medium.com/max/700/1*q6LW98R81q-F_-Y6Ek-tpQ.png)

![](https://miro.medium.com/max/700/1*q6LW98R81q-F_-Y6Ek-tpQ.png)

*Data Center Environment Control System*

For the GUI, I used our old school [**Java Swing**](https://en.wikipedia.org/wiki/Swing_%28Java%29) 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.

![](https://miro.medium.com/max/700/1*8NgMevNyrm-3-eVcKSNOzQ.png)

![](https://miro.medium.com/max/700/1*8NgMevNyrm-3-eVcKSNOzQ.png)

*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.

## [**jaimedantas/DC_Control**](https://github.com/jaimedantas/DC_Control)

### [DC Control is a management, control and monitoring system for SNMP devices developed using the language Java. The…](https://github.com/jaimedantas/DC_Control)

[github.com](https://github.com/jaimedantas/DC_Control)

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](https://www.rnp.br/en), which is a huge player in the Internet market in Brazil.

![](https://miro.medium.com/max/700/1*X5iV_yoQgatOXJ2yR7Ep_A.png)

![](https://miro.medium.com/max/700/1*X5iV_yoQgatOXJ2yR7Ep_A.png)

*RNP data center used in the trial*

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

![](https://miro.medium.com/max/700/1*J-EtMjkycXX84HE7C_8buA.png)

![](https://miro.medium.com/max/700/1*J-EtMjkycXX84HE7C_8buA.png)

*DC Control network created on Zabbix*

A [Zabbix](https://en.wikipedia.org/wiki/Zabbix) server was created so I could build a dashboard and manage the alarms through email. Also, data extracted from an [APC NetBooz](https://www.apc.com/shop/br/pt/categories/security-and-environmental-monitoring/security-and-environmental-appliances/netbotz-400/N-1l2f3lz) 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.

![](https://miro.medium.com/max/650/1*iCUHtquh-yG4fbltbBKy0g.png)

![](https://miro.medium.com/max/650/1*iCUHtquh-yG4fbltbBKy0g.png)

*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.

![](https://miro.medium.com/max/700/1*SyI37GJGtm8bkgrbY7CqJA.png)

![](https://miro.medium.com/max/700/1*SyI37GJGtm8bkgrbY7CqJA.png)

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

![](https://miro.medium.com/max/700/1*IvO3LIrtzY0Wim4FNr_W3Q.png)

![](https://miro.medium.com/max/700/1*IvO3LIrtzY0Wim4FNr_W3Q.png)

*DC Control temperature*

![](https://miro.medium.com/max/700/1*lJO-woSu58zQnTwHZJ795g.png)

![](https://miro.medium.com/max/700/1*lJO-woSu58zQnTwHZJ795g.png)

*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.

![](https://miro.medium.com/max/522/1*VAvJQiMBN9D8sDoJ6o7dBg.png)

![](https://miro.medium.com/max/522/1*VAvJQiMBN9D8sDoJ6o7dBg.png)

*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](http://www.jaimedantas.com/)

---

Source: https://maker.wiznet.io/teddy/projects/dc-control%3A-a-robust-and-low-cost-snmp-agent-for-data-centers/
