Server Emissions Monitor
SCOOP is an ICT framework for implementing and deploying carbon accounting. The framework describes and quantifies CO2, and GHG movement between the earth and the atmosphere, establishing generally accepted accounting principles (GAAP) quantifying these movements with high quality data in real time along with a historical record, and possibly forecasting models. It seeks to extend the scope of scientific projects to integrate new discoveries and global heating decarbonization processes into the mainstream economy.
Figure 1: SCOOP global carbon exchange model
SCOOP defines a global GAAP framework to be instantiated for applicable industry sectors as well as carbon exchanges from natural processes. The goal for the exercise described in this document is to serve as a minimalist example for implementing, a reference implementation for tracking carbon emissions from server operations in a data center in a manner that complies with the IEEE P7802 standard.
This exercise is not intended to be comprehensive. Specifically excluded is the carbon load from the construction of the data center physical plant and from the manufacture of the server and ancillary equipment. However, for the emissions that are monitored, the quantities are tagged to specific emissions events, namely the emissions stemming from measured electricity consumed by a specific server over a specified period. The SCOOP-Data Center application creates and maintains this information in a database for use by other applications downstream.
Data center emissions from operations can be calculated from electricity consumption, currently a GHG Protocol Scope 2 input. Carbon emissions can be calculated from the kilowatt-hours billed by the utility company. A first approximation for estimating the emissions would be from the fraction of fossil fuel used by the power utility to generate the electricity delivered. Large data centers may have purchase contracts that specify the composition of the energy sources.
All emissions in this reference implementation are absolute or zero-based, not relative to an arbitrary baseline to allow for liability transfer transactions. The data is collected in real time with granularity and timestamped in a manner that enables proper billing. For instance, to the extent that the local laws allow it, data centers operating cloud services could pass the liability for emissions to their customers as part of the service invoicing.
The tagging enables attribution. If the server is in a cloud data center, and the server was running applications on behalf of data center customers, the data center operator and the customers involved can now figure out how to take compensating actions for these actions. These compensating actions have a cost, currently considered an externality cost.
This externality cost does not go away, even in the absence of compensating actions. In this case, the burden of this cost is imposed on humanity in terms of GHG global warming.
Managing this cost at the source is much more efficient than after leaving it unfettered. The focus of SCOOP is to provide quality data to enable effective management and decision-making. These are policy decisions made by the actors involved. SCOOP does not change any of that, but it brings in transparency needed for effective decision making.
Principles of Operation
In its current form, the Server Emissions Monitor, (SCOOP Emissions Monitor) is an application instance for SCOOP-Data Center to estimate the carbon emissions from the operation of a single server computer in a data center. This model is minimalist for conceptual clarity, at the expense of completeness. Nonetheless, the emissions from electricity generation to operate servers represent the largest emissions component in the data center industry. This emissions monitor uses the Scope 1, 2 and 3 categories prescribed by the GHG Protocol. Figure 2 breaks down emissions by different line items. Estimates done today are after-the-fact statistical country level. Carbon monitoring needs to be more fine-grained if the data is to be used for carbon accounting, with emissions attributable not only to a specific machine, but also to specific events, such as the emissions between two specific dates. If the machine is a cloud hyperscale machine, the emissions are also linked to the tenants who used the machine during that period. For simplicity, this monitor tracks the emissions from a single physical server. Operational records and policies can be applied to apportion responsibility across machine tenants.
As noted, with this level of granularity, the data center operator can pass the bill for emissions to the tenant, and the tenant can forward this liability to sub-tenants. Alternatively, any participant in this supply chain can pay a fee to a third-party carbon offset provider to dispose of this liability. Because this liability is not currently accounted for, it becomes an externality
Thus, emissions are akin to a cost. SCOOP is a mechanism that helps internalize this cost. As in other cost calculations, carbon emissions can be classified as operating costs (OpEx) and capital costs (CapEx). Capital costs include emissions expended in the construction of the physical plant as well as the manufacture of computer and networking equipment. These costs are broken down in the items described in Figure 2. For simplicity, the monitor still does not account for other operations components such as the emissions from heating, cooling and lighting and transmission losses. The path to internalize these costs across all industries will be long and arduous. It will be gradual, and what matters in this transformation process is that the carbon that does get internalized is a true, verifiable and auditable quantity.
Figure 2. Carbon emissions line items in data centers.
As noted, we want to keep complexity in check. The implementation uses instrumentation already present in the machinery, gathering information from sensors embedded in various equipment. A digital twin model is used to organize the information collected from sensors. Most of this information is managed through microcontrollers embedded in the existing equipment. There are microcontrollers almost everywhere: inside CPUs such as the processor control unit (PCU), and the Intel® Management Engine (ME) in Intel processors, in the baseboard (the Baseboard Management Controller or BMC), inside power supply units (PSUs), even in server chassis in more complex configurations. Servers may also be provisioned with GPUs, memory and nonvolatile storage, each with their own microcontrollers.
While the communication protocols inside the internal components, the CPUs, GPU, memory and nonvolatile storage may be proprietary, there is a degree of standardization, such as the use of the I2C protocol and off-the-shelf microcontrollers such as the Aspeed for BMCs to convey management data through circuit traces in the server baseboard. The network protocols to convey the power data are also standardized, IPMI at the TCP/IP level and Redfish as a higher-level REST protocol. Power data is extracted from servers through an Ethernet management port. The emissions monitor will use data provided by the server BMC, which consolidates power consumed by the CPUs and baseboard components. Power used by GPUs may need to be tracked separately if not collected by the BMC.
Higher architectural components in the data center also have their own controllers, more likely implemented in software. We will focus on chassis components for emissions monitoring.
As noted, the initial version of the monitor will track the power from one physical server. Server emissions cannot be measured directly. Emissions are estimated from energy figures calculated from integrating real-time server power over a period of interest, yielding an estimate of the energy consumption. The emissions figure comes from the emissions from generating this energy estimate. These emissions are determined by the type and quantity of fossil fuels involved, information that can be obtained from the power utility, from the power distributor or from federal agencies such as the US DOE.
Solution Architecture
SCOOP follows the well-established 3-tier IT solution architecture that has been around since the 1980s, shown in Figure 3. Most nontrivial scale deployments consist of tiers made of orchestrated composites of loosely coupled services linked through high-level protocols such as HTTP, REST or gRPC, also known as microservices architectures. This trait is not evident in this first implementation of a carbon monitor, being a small, one-machine implementation whose internals may not even need to use networking.
Figure 3. SCOOP general application model and server emissions monitor instance.
The generic SCOOP architecture has the data tier structured in two layers, the physical system being modeled that captures or emits GHGs, and a digital twin on top to model and manage sensor data from the physical system. The digital twin also provides an API for the logic tier to call. There is no centralized database in the “data” tier in the traditional. The component microservices may manage their own storage or connect to data services as needed. The same applies to logic tier microservices.
There exist several alternatives to take a power consumption reader in a server: through the firmware embedded in the CPUs, from the BMC, the power supply microcontroller and from each GPU, if provisioned. The power readouts from CPUs can be “spiky” and hence will need to be smoothed, and the readouts from all these sources are also somewhat redundant, and hence specific policies and algorithms will need to be applied to yield credible estimates.
The logic tier is also split into two layers. The layer below is specific for the industry segment. For SCOOP-Data Center it implements a logical model essentially a register consisting of timestamped power readings belonging to multiple machines. Hardware quirks are less evident in this layer. However, data must be harmonized across machines, for instance to account for different sampling rates or error estimates. The next sub-layer is the business logical model. This layer provides APIs to be used by business or financial applications in the presentation tier and needs to perform harmonization for data coming from other data centers, or data from other industry segments.
We will focus on the bottom three sublayers for the first emissions monitor implementation, circled in red in Figure 3. The monitor will be geared toward rendering a time series for the system under test along with a data manager service that calculates energy consumption over a given interval as well as the associated emissions during that period.
For reference, Figure 4 depict the entire hierarchy of power sensors and actuators associated with server power consumption. The red circle encompasses the same scope of the red circle in Figure 3. Additional echelons from Figure 4 will be added as the scope of the monitor is extended to racks, server pods, a data center or eventually, the data centers in a cloud. The top echelon consists of power utilities and data center customers when emissions data are furnished as passthrough data. Depending on policy, the data center operator may decide to offset their emissions themselves or pass on the information with the expectation that the customer will handle the liabilities.
Figure 4. Digital twin model for power and energy management in data centers.
Emissions Monitor Architecture
The monitor consists of three main components, shown in Figure 5 corresponding to the three bottom sub-layers in SCOOP solution architecture.
Server Under Test
This is the physical server. It runs two microservices, represented as two sequential processes:
A workload application. This application will load the CPUs in the SUT to a preset target. The initial version uses Intel® Power and Thermal Utility (PTU). PTU is a CPU architecture-specific program that loads up a server to a pre-specified level. The loading level is set upon launch. To set a new loading level the currently running PTU instance is terminated, and a new instance launched with the desired target.
Workload Manager takes the SUT through a preset daily load curve that mimics the load curve of a server deployed at a data center using the workload application. It is implemented as a Linux daemon or Windows service that wakes up every 15 minutes. It retrieves the target loading for the current time-of-day from a table and launches PTU accordingly.
The two services run autonomously, with no input or output. This mimics security considerations in real life. For the purposes of SCOOP, the only information passed on to SCOOP is a server identifier and power consumption metadata.
To be more precise, here is Workload Manager expressed as pseudo-Python code:
Initialize the workload process ID for the first round
workload_pid = 0
This code runs in an infinite loop
while True:
time_of_day = Get_time_of_day ()
Get the desired loading for this time-of-day
loading_target = Get_load_target (time_of_day)
If this is not the first time around, stop the currently
running workload
if workload_pid != 0: Kill_process (workload_pid)
Launch new instance of PTU
Launch_PTU (loading_target)
Go to sleep for the next 15 minutes.
Sleep (15, “minutes”)
Figure 5. SCOOP Server Emissions Monitor, detailed architecture.
SCOOP Server Monitor
The SCOOP Server Monitor microservice is the interface between higher level carbon accounting apps and server digital twins modeling power consumption, sampling power consumption data to establish a historical record, providing real-time power, energy and emissions data on demand and a forecasting model for future power consumption, not implemented this initial version. It has three constituent microservices, namely
SCOOP Monitor Daemon implementing the sampling capability
SCOOP Power Register, essentially a historical database of timestamped power samples
SCOOP Data Manager is the interface to higher business or financial applications. In addition to providing a real-time power readout, it calculates quantities derived from power consumption, such as the energy consumption within a time interval, and if needed, the associated emissions.
SCOOP Monitor Daemon
Monitor Daemon takes a power reading from the SUT every second and stores it in a database along with a time-of-day timestamp.
Here is a pseudo-Python rendering:
server_ID = 0 # Not used for a single-machine environment.
interval = 1 # Power consumption sampling interval set to 1 second.
while True:
timestamp = Get_time_of_day ()
Retrieve server power consumption datum
current_power = Get_power_consumption (server_ID)
Write_power (server_ID, timestamp, current_power)
Go back to sleep until the time for the next readout
Sleep (1, “seconds”)
Power Consumption Permanent Ledger
The power ledger implements two functions: to keep a historical record of power readings generated by SCOOP Monitor Daemon and to deliver a segment of contiguous power readings to SCOOP Data Manager to calculate the emissions from power use during a specific period.
Store a power reading in the ledger, essentially an append function
Write_power (server_ID, timestamp, power)
Retrieve power consumption segment for a time interval t1 to t2
Read_power = Retrieve_from_ledger (server_ID, t1, t2)
SCOOP Data Manager
Data Manager calculates a machine’s energy consumption through interval (t1, t2) by integrating power readings over that interval and converts the energy number to kilograms of CO2 emitted. The integration of power readings yields electricity consumption in kilowatt hours. The kilograms of CO2 emitted is calculated by taking the fraction of electricity generated from burning a fuel. Calculations for the energy conversion efficiency and the fraction of CO2 mass embodied in the fuel are considered. These emissions during the interval (t1, t2) represent an emission event. If these emissions are placed in a marketplace for offsetting, a cryptographic token is attached to this event to prevent reuse.
PoC v2 Microservices
Possible methodologies
C4model
Test driven development
Clean code
Multiformat translator
Reads power consumption data from various hardware — hardware specific implementation is provided through plugins. The test setup will have a RedFish plugin as an example implementation. RedFish data can be read from a local machine or a mocking service.
Functions
It provides a service endpoint that allows to read the latest energy readings. It will buffer temporarily only (to support low end hardware restrictions). It will allow to read:
The current power consumption of the device, and
A list of the latest entries
API
GET /read/current
Current power consumption
Format
{
consumption: Number <in kWh?>;
source?: String <Refers to a specific contract for power supply, optional>;
}
GET /read/
List of power consumption readings since (a timestamp), optional.
Format
{
source?: String <Refers to a specific contract for power supply, optional>;
[{
date: String ;
consumption: Number <in kWh?>;
}]
}
GET /read//
List of power consumption readings between and
Format
Same as above.
GET /about
Get details about the device being read, meta data.
Format
{
id: String <UUID of the device — IoT stuff>
event-subscription-queue: String? URL? ?
meta: { }
}
Digital twin service
Simulates the real-world entity by providing functions to read information as if it was from the live system but instead it’s a simulation that can interpolate readings from the history of readings it keeps.
To update its data, it reads from one or more Multi Format Translator services and stores the data in a local database.
Open questions:
Do we need to return the power consumption of each individual device? Or would the data center for example be an entity and this service would be the digital twin of the entire data center, not the individual device. Granularity?
Interface
GET /consumption
Sum of current power consumption of all devices for each source.
Format
[{
consumption: Number <in kWh?>;
source?: String <Refers to a specific contract for power supply, optional>;
}]
GET /consumption/
Total power consumption since for each source
Format
[{
start: String ;
end: String ;
source?: String <Refers to a specific contract for power supply, optional>;
consumption: Number <in kWh?>;
}]
GET /consumption//
Total power consumption for each source between and
Format
Same as above.
GET /about …
Proposal for communication services: GitHub - slackhq/nebula: A scalable overlay networking tool with a focus on performance, simplicity and security
C4 Model
For context,visit: https://c4model.com/
System context diagram
Container diagram
Component diagram
Code diagram
Figure 6. Monitor data architecture.
Appendix
The Business Value of Carbon Accounting
One mechanism for the internalization of the cost of GHG emissions is by regulation where polluters are obligated to pay a fee for their emissions. These fees are in turn applied to GHG mitigation programs.
There are very few entities in the United States under this regime, for instance, entities under the California Cap-and-Trade Program. These include large industrial facilities emitting over 25,000 metric tons of CO2 equivalent per year: oil refineries, cement plants, glass manufacturers and steel mills, electricity generators, and fuel suppliers.
The basis for the assessment is usually statutory linked to the entities’ output. In other countries there are cases where the fees apply to individuals. An example is the Vehicle Excise Duty (VED) in the UK. Vehicle owners are assessed a first-year fee and a yearly renewal fee thereafter. The fees are statutory, as shown in Figure 7, where the fee is based on engine displacement, and the renewal fee is a flat 140 GBP. Perhaps the system would be fairer if the fees were based on actual emissions. This is indeed possible: information about the accumulated fuel burn can be obtained from a vehicle’s Onboard Diagnostics port (OBD). This would present an incentive to recharge the battery in plug in hybrid vehicles, perhaps reducing the incidence of system abuse of corporate-issued vehicles, who purchase PHEVs to take advantage of tax breaks, yet never bother to charge, especially when the cost of fuel is refunded as a business expense.
Figure 7. UK Vehicle Excise Duty.
If corporate emitters have a choice between paying the statutory fee based on industry average vs actual emissions. Entities that implement antipollution measures that beat industry averages and get a break by paying only for the actual emissions.
Servers deployed in a data center have the equivalent of an automotive OBD where servers are equipped with power consumption sensors mediated by the firmware in the server.
A SCOOP-based system would be useful in all three cases mentioned, collecting the information from appropriate sensors, channeling it, securely storing and conveying it and providing accurate, certified and secured emissions estimates.
There are synergies to be had with generalized SCOOP deployments: diversified portfolios for carbon credits and liabilities become possible, allowing risk management through the same mechanism available today in financial markets, with single-instance vertical offerings becoming a thing of the past.
Retrieving a Power Reading
This is a code snippet to retrieve the current SUT power consumption, using a program running on the local host, namely running on the same machine in which the code runs. This code would be run by SCOOP Monitor.
import subprocess
def Get_power_consumption():
try:
Run the ipmitool command to get power consumption in watts
result = subprocess.run(
[‘ipmitool’, ‘sdr’, ‘type’, ‘Current’],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True)
if result.returncode != 0:
print (f"Error executing ipmitool: {result.stderr}")
return None
Parse the output to find the power consumption (in Watts or Amps)
for line in result.stdout.splitlines():
if “Watts” in line or “W” in line:
Extract and return the numeric value
for power consumption
parts = line.split()
for part in parts:
if part.replace(‘.’, ‘’, 1).isdigit():
return float(part)
print (“Power consumption data not found.”)
return None
except Exception as e:
print (f"Exception occurred: {e}")
return None
The code fragment above parses an SDR string output from ipmitool formatted as shown below:
Power Consumption | 220 Watts | ok
CPU Temp | 45 degrees C | ok
System Temp | 32 degrees C | ok
Fan 1 | 1250 RPM | ok
Fan 2 | 1180 RPM | ok
Vcore | 0.95 Volts | ok
+3.3V | 3.31 Volts | ok
+12V | 12.15 Volts | ok
+5V | 5.07 Volts | ok
If the SUT is somewhere in the LAN, except that the parameters to ipmitool need to specify the IP address for the target SUT, specified by ipmi_ip. For this example, assume that the management port address for the target SUT is 192.168.6.25.
import subprocess
IPMI credentials and BMC address
bmc_ip = “192.168.1.25”
username = “admin” # Replace with actual username
password = “password” # Replace with actual password
Command to get SDR (sensor data records)
command = f"ipmitool -I lanplus -H {bmc_ip} -U {username} -P {password} sdr"
Execute the command
try:
result = subprocess.run(
command.split(),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True)
if result.returncode == 0:
output = result.stdout
# Extract power consumption reading
for line in output.splitlines():
if "Power Consumption" in line:
print (line)
else:
print (f"Error: {result.stderr}")
except Exception as e:
print (f"An error occurred: {e}")
Here is a third alternative using the higher-level Redfish HTTP protocol:
import requests
import json
def get_Redfish_power_consumption(ip, username, password):
try:
# Redfish Power endpoint for retrieving power consumption
power_url = f"https://{ip}/redfish/v1/Chassis/1/Power"
# Create a session and authenticate
session = requests.Session()
session.auth = (username, password)
# In case the server uses self-signed certificates
session.verify = False
# Make a GET request to retrieve power data
response = session.get(power_url)
if response.status_code != 200:
print(
f"Error: Unable to retrieve power data. HTTP Status Code: {response.status_code}")
return None
# Parse the JSON response
power_data = response.json()
# Extract the power consumption from the "PowerControl" section
# (usually in Watts)
power_control = power_data.get ('PowerControl', [])
if power_control:
for power_item in power_control:
if 'PowerConsumedWatts' in power_item:
return power_item['PowerConsumedWatts']
print ("Power consumption data not found in Redfish response.")
return None
except requests.exceptions.RequestException as e:
print (f"Error connecting to Redfish API: {e}")
return None
if name == “main”:
# Redfish BMC details
ip = “192.168.6.25”
username = “admin” # Replace with your Redfish username
password = “password” # Replace with your Redfish password
power_consumption = get_redfish_power_consumption(ip, username, password)
if power_consumption is not None:
print (f"Current power consumption: {power_consumption} Watts")
else:
print ("Could not retrieve power consumption.")
Yet one more method to retrieve a power reading is to directly assemble an IP packet that follows the IPMI protocol. Fortunately, there are supporting libraries to spare programmers from having to deal with bytecodes or bit fields directly. Here is a Python snippet to assemble an IPMI-formatted packet to command the IPMI port at 192.168.1.25 to deliver the machine’s SDR and to parse the retrieved record for the current power consumption of the machine using the pyghmi library, which provides functionality to communicate with IPMI devices. This example demonstrates how to assemble an IPMI packet to command the BMC (Baseboard Management Controller) at 192.168.1.25 to retrieve the SDR (Sensor Data Records) and parse the current power consumption from the retrieved records.
First, install the pyghmi library: in bash:
pip install pyghmi
Once the library is installed, you can use the following Python snippet to issue an IPMI command and extract the SDR (specifically, the power consumption information):
from pyghmi.ipmi import command
BMC connection details
bmc_ip = ‘192.168.1.25’
bmc_user = ‘admin’ # Replace with actual BMC username
bmc_password = ‘password’ # Replace with actual BMC password
Command to get SDR (sensor data records)
command = f"ipmitool -I lanplus -H {bmc_ip} -U {username} -P {password} sdr"
Initialize IPMI session with the BMC
ipmi_session = command.Command (bmc_ip, bmc_user, bmc_password)
Fetch the SDR (Sensor Data Records)
sdr_records = ipmi_session.get_sdr ()
Function to extract power consumption from SDR records
def get_power_consumption (sdr):
for record in sdr:
# Look for sensors related to power consumption
if ‘Power’ in record[‘name’]:
sensor_reading = record.get (‘reading’, None)
sensor_unit = record.get (‘units’, None)
if sensor_reading is not None and sensor_unit:
print (f"Power Consumption: {sensor_reading} {sensor_unit}")
return sensor_reading, sensor_unit
print (“Power consumption data not found.”)
return None
Parse the SDR records for power consumption
power_data = get_power_consumption (sdr_records)
Close the IPMI session
(optional, as pyghmi handles sessions dynamically)
ipmi_session.ipmi_session.logout ()
