# How I Control My Dell PowerEdge R710's Fans Remotely with an API

![How I Control My Dell PowerEdge R710's Fans Remotely with an API](https://cdn.hashnode.com/res/hashnode/image/upload/v1680983214426/187f5824-195e-422e-8ea8-71df6895ec43.jpeg)

Remotely monitoring my server's temperature and controlling the fan speed accordingly has been one of the more frustrating things I had to do. But that ends today! (Kind of...) Here's how I solved that issue with Python Flask and ipmitool.

[

GitHub - ItsNee/Dell-PowerEdge-R710-Fan-Controller-API: A Simple API made with Python Flask to help manage fam speeds on the Dell PowerEdge R710 Enterprise Server

A Simple API made with Python Flask to help manage fam speeds on the Dell PowerEdge R710 Enterprise Server - GitHub - ItsNee/Dell-PowerEdge-R710-Fan-Controller-API: A Simple API made with Python Fl...

![How I Control My Dell PowerEdge R710's Fans Remotely with an API](https://cdn.hashnode.com/res/hashnode/image/upload/v1680983215628/6316eb6d-a140-4a2a-81ef-28111dbb15d8.svg)GitHubItsNee

![How I Control My Dell PowerEdge R710's Fans Remotely with an API](https://cdn.hashnode.com/res/hashnode/image/upload/v1680983217098/9850fd81-5427-4435-93a3-a1f15df203a6.png)

](https://github.com/ItsNee/Dell-PowerEdge-R710-Fan-Controller-API.git)

* * *

Prerequisites
-------------

*   A system in the same network as the server installed with Python 3(This could very well be the server itself or a virtual machine running on the server. Baseline: machine should be able to reach server without any network issues)
*   Dell Server with IDRAC and IPMI over LAN turned on

* * *

Solution to Issue
-----------------

![How I Control My Dell PowerEdge R710's Fans Remotely with an API](https://cdn.hashnode.com/res/hashnode/image/upload/v1680983218522/f3abf439-3152-4d5d-a456-860dd9e9f682.png)

With the help of IPMI (Intelligent Platform Management Interface) over LAN, we would be able to query power supply usage, fan speed, server health, security details, and the state of operating systems. However, I'd be using this to query the server's temperature and change the fan speed.

One small hurdle is that we have to have a machine in the same network as the server (unless you want to expose your IPMI to the WWW). This bump can be overcome with the help of a custom made API exposed out to the internet through a reverse proxy. However its highly recommended that you obscure your API endpoint to prevent malicious actors from playing around with it. This can cause some serious damage to the hardware.

[

GitHub - ItsNee/Dell-PowerEdge-R710-Fan-Controller-API: A Simple API made with Python Flask to help manage fam speeds on the Dell PowerEdge R710 Enterprise Server

A Simple API made with Python Flask to help manage fam speeds on the Dell PowerEdge R710 Enterprise Server - GitHub - ItsNee/Dell-PowerEdge-R710-Fan-Controller-API: A Simple API made with Python Fl...

![How I Control My Dell PowerEdge R710's Fans Remotely with an API](https://cdn.hashnode.com/res/hashnode/image/upload/v1680983220284/7dfe6a9d-613a-49e2-9404-2b97b193931c.svg)GitHubItsNee

![How I Control My Dell PowerEdge R710's Fans Remotely with an API](https://cdn.hashnode.com/res/hashnode/image/upload/v1680983221083/f71db17d-2c53-49dc-9433-bb243e3f4240.png)

](https://github.com/ItsNee/Dell-PowerEdge-R710-Fan-Controller-API.git)

Here's the simple Python Flask API Server that I wrote. It performs 2 simple but crucial tasks.

*   Get Current Server Temperature
*   Set Server Fan Speed

* * *

Setup
-----

### Installing ipmitool

The Flask application entirely depends on the system having the `ipmitool` utility. Let's go ahead and install that first

    apt-get install ipmitool -y

![How I Control My Dell PowerEdge R710's Fans Remotely with an API](https://cdn.hashnode.com/res/hashnode/image/upload/v1680983224058/5bea466c-6715-4563-90cb-c5838702f605.png)

### Installing Python3 and pip

    apt-get install python3 python3-pip -y

![How I Control My Dell PowerEdge R710's Fans Remotely with an API](https://cdn.hashnode.com/res/hashnode/image/upload/v1680983225984/1381dcd3-fff5-40f7-bfca-f29a399cdf61.png)

### Clone Repository

    git clone https://github.com/ItsNee/Dell-PowerEdge-R710-Fan-Controller-API.git

![How I Control My Dell PowerEdge R710's Fans Remotely with an API](https://cdn.hashnode.com/res/hashnode/image/upload/v1680983227093/8d221c32-382e-47f8-9022-7cda4e8d8883.png)

### Installing Requirements

     pip3 install -r requirements.txt

![How I Control My Dell PowerEdge R710's Fans Remotely with an API](https://cdn.hashnode.com/res/hashnode/image/upload/v1680983228900/c5f76786-4c99-47eb-a6ae-31f5135e3ac8.png)

* * *

Run Server
----------

### Foreground

    python3 api-server.py

![How I Control My Dell PowerEdge R710's Fans Remotely with an API](https://cdn.hashnode.com/res/hashnode/image/upload/v1680983230628/d9e19ef3-e03f-4776-be83-4bd731dca658.png)

### Background

Here's how to background the API Server.

    nohup python3 api-server.py&

![How I Control My Dell PowerEdge R710's Fans Remotely with an API](https://cdn.hashnode.com/res/hashnode/image/upload/v1680983231610/a1776a2f-fa80-4bd1-a426-fd91db8dbd1e.png)

Here's how to kill a background process:

Find the ProcessID

    ps -faux | grep api-server

![How I Control My Dell PowerEdge R710's Fans Remotely with an API](https://cdn.hashnode.com/res/hashnode/image/upload/v1680983232412/c0edab37-de89-4fe6-86d3-c5cc207e3e43.png)

Kill Process

     kill -9 1085872

* * *

API Usage
---------

    https://api.myserver.com/ = [Returns a welcome string]
    
    https://api.myserver.com/get-temperature = [Returns the server's temperature]
    
    https://api.myserver.com/set-fan-speed/<SPEED> = [<SPEED> variable can be adjusted by end user]

![How I Control My Dell PowerEdge R710's Fans Remotely with an API](https://cdn.hashnode.com/res/hashnode/image/upload/v1680983233446/a83d33cf-5d64-4472-be8d-6a6942b7c809.png)

![How I Control My Dell PowerEdge R710's Fans Remotely with an API](https://cdn.hashnode.com/res/hashnode/image/upload/v1680983235070/29d5027a-3286-4e6d-a1bd-5367a121fe44.png)

* * *

IFTTT
-----

IFTTT is a free application that I make use of in order to send web requests with a tap of a widget on my phone's home screen.

![How I Control My Dell PowerEdge R710's Fans Remotely with an API](https://cdn.hashnode.com/res/hashnode/image/upload/v1680983237037/77ebcef5-4505-4ab8-93c6-55d8494709a6.png)

Creating an applet is as easy as picking "this" and "that". In my case, I went with "If button push, send web request"

![How I Control My Dell PowerEdge R710's Fans Remotely with an API](https://cdn.hashnode.com/res/hashnode/image/upload/v1680983238333/e7665116-1788-4442-a50a-11ce00ad1d0b.png)

![How I Control My Dell PowerEdge R710's Fans Remotely with an API](https://cdn.hashnode.com/res/hashnode/image/upload/v1680983240117/74b881a8-a150-4e2e-b2e7-8d9e69ea983f.png)

![How I Control My Dell PowerEdge R710's Fans Remotely with an API](https://cdn.hashnode.com/res/hashnode/image/upload/v1680983241875/1cc275eb-1c2c-4776-837d-0319933b9b69.png)

And with that, I'm able to remotely change my server's Fan Speed with a push of a button from my phone's home screen!
