Beyond servers: How we monitor energy consumption2 Comments
Running an office is very similar to running a SaaS infrastructure. We need uninterrupted power supply so we can get things done, but we also want the smallest possible carbon footprint so we can be kind to the environment.
To achieve that goal, we monitor energy usage in the same way we monitor our servers, using Server Density.
The following graph illustrates the electricity consumption at one of our coworking spaces in Lisbon. The flat line on the 9th and 10th of April is our weekend usage, while the ensuing spikes occur during work hours. Should our usage rise above what we define as “normal” then Server Density makes sure we get notified.
A few weeks ago, for example, I received an email alerting me that electricity usage had crossed the 600W Saturday threshold. I live near the office so I walked in, switched the heater off, and placed a friendly reminder on our Slack channel.
Another thing we can do is zoom out and observe our seasonal consumption patterns. As you can see in the following graph, our baseline consumption was higher in mid-November, and similarly from late December to mid-March. Those patterns correspond to the addition (and removal) of test servers on our office network.
Since we started monitoring our electricity with Server Density we’ve achieved a 10% reduction in our energy bills. Energy-related alerts prompt us to ask the right questions, power down unneeded equipment, and optimise the devices we use. In short, energy monitoring makes us more accountable and, ahem, less forgetful.
How we monitor energy consumption
Server Density can monitor, graph, and alert on anything that it can gather data from (anything with an API really).
Take the sensor we used, for example. It measures electricity usage by counting the brief flashes (impressions) of the LED on the electricity panel (see how). It’s pretty low tech, it’s cheap, and it has an API, which means we can pull data from it.
All we had to do was attach the sensor on the electricity counter. We then used the EnergyOT Android app to connect the device to our WiFi network. We created a new Server Density account, added a device and installed the agent.
We then wrote the following plugin:
While this code is specific to the EnergyOT endpoint, you can tailor it for any device and endpoint, or you can write your own plugin (here is how). The only prerequisite is the existence of an HTTP API for Server Density to pull data from.
Monitoring water levels
In the next few months we will be relocating our Lisbon office away from the hustle and bustle of the city, and into the countryside.
In much of rural Portugal there is no immediate access to the water grid. It’s common practice to use water pumps to fill water tanks for household use. Obviously, pumping water requires electricity to power the pumps so they can “lift” the water from beneath the ground.
Most power companies use a lower tariff for “out of hours” consumption, so it makes sense to fill the tank in the evening. At the same time, we don’t want to run out of water during the day. The water pump should therefore be able to add water if levels drop below a minimum threshold.
To make this happen, we wanted a technique for monitoring the water level. As it turns out, the easiest way to do this is by attaching a sonar inside the tank. This sonar measures its distance from the water surface and sends us a measurement calibrated in percentage points. Should that measurement drop below a predefined threshold then we trigger the pump, even if it’s during the day.
This solution uses the same webhooks we used for watering the plants. Instead of alerts, Server Density sends a webhook to the device that controls the pump.
As part of our tests, we filled up a bucket with water and emptied it while taking readings from the sonar. We used a MaxSonar sensor and interfaced it with a Raspberry Pi which is supposed to collect all the data and send it to Server Density.
Here are the readings we collected.
I don’t have a water tank. Why should I care?
No water tank? No problem. Pick anything else. If it has an API, then go ahead and monitor it.
Leveraging the Server Density platform negates the need for in-house monitoring solutions. Instead of investing in non-core functions, manufacturers like EnergyOT could incorporate Server Density as a state of the art monitoring function that works out of the box.
If you are an enthusiast and hobbyist, Server Density makes it easier to monitor your devices, and yes, stay on top of your energy consumption too.
What about you? Are you monitoring anything other than websites and servers?