Self-awareness
Introduction
The aerOS self-awareness module is one of the 4 essential modules within the aerOS self-* capabilities set. This component analyses and obtains information from the node (CPU, RAM, disk, real-time characteristic, net traffic, net speed, power consumption, etc.), continuously monitoring its health status and workload. Due to the need to offer real-time information on the status of the IE, this module is subdivided into two components, which are executed continuously. One (power_consumption) is in charge of obtaining the power consumption (which requires more computing time). The other (hardware_info) is responsible for obtaining the rest of the parameters instantly. The component that obtains the power consumption needs an average of 20-25 seconds per execution to obtain new valid values and the other only needs about 10-15 seconds to update its information. The purpose is to provide updated information to the rest of the self-* capabilities as fast as possible to modify the operation of the IE, if necessary.
Features
Currently, the module is able to obtain the following information from each IE in the aerOS computing continuum:
domain: indicates the aerOS Domain where the IE is located.
hostname: internal name, it’s the hostname of the machine.
internalIpAddress: internal IP address.
macAddress: MAC address.
cpuCores: number of processor cores.
cpuFreqMax: maximum CPU frequency (in Megahertzs).
currentCpuUsage: current percentage of CPU usage.
ramCapacity: maximum RAM memory capacity (in Megabytes).
availableRam: currently available RAM memory (in Megabytes).
currentRamUsage: RAM memory currently in use (in Megabytes).
currentRamUsagePct: percentage of RAM memory currently in use.
diskType: indicates the type of the storage medium (HDD or SSD).
diskCapacity: maximum capacity of the storage medium (in Megabytes).
availableDisk: current available capacity of the storage medium (in Megabytes).
currentDiskUsage: current used capacity of the storage medium (in Megabytes).
currentDiskUsagePct: percentage of current capacity utilisation of the storage medium.
netSpeedUp: current upload speed of the network interface (in Megabits per second).
netSpeedDown: current download speed of the network interface (in Megabits per second).
netTrafficUp: current upload traffic of the network interface (in Megabytes per second).
netTrafficDown: current download traffic of the network interface (in Megabytes per second).
netLostPackages: indicates the number of packages lost from network traffic.
avgPowerConsumption: average electrical energy consumption (in Watts).
currentPowerConsumption: current electrical energy consumption (in Watts).
realTimeCapable: indicates whether the IE is capable of executing tasks that require the real-time constraint.
cpuArchitecture: indicates processor architecture (AMD64, ARM64, etc.).
operatingSystem: indicates the operating system installed (e.g. GNU/Linux).
infrastructureElementTier: indicates the tier in the continuum (e.g. Cloud, Edge, FarEdge, IoT, …) of the IE.
infrastructureElementStatus: indicates the status of the IE.
Place in architecture
The following figure describe the self-awareness module inside the IE and the relationships with another self-* modules.
User guide
Prerequisities
To start using the self-awareness module, please visit the Common deployments repository for more information.
Warning
Remember to create the necessary NGSI-LD entities related to Domains, LLOs, IEs, etc. in the context broker of the Domain.
For the power_consumption submodule the Docker images are split according to architecture (AMD64 and ARM64). Therefore, when launching them in Kubernetes or Docker, the deployment files must be modified to select the architecture.
Installation
Configuration options
Environment variables
AEROS_VERBOSE: indicates whether or not the module provides information through the Docker container log.
Value: true/false.
AEROS_AUTHORIZATION: indicates whether KrakenD shall be used to communicate with the context broker.
Value: true/false.
AEROS_KEYCLOAK_URL: the URL where Keycloak is running.
Value: IP and port.
Optional (if AEROS_AUTHORIZATION is false).
AEROS_KEYCLOAK_REALM: the Keycloak realm.
Value: string.
Optional (if AEROS_AUTHORIZATION is false).
AEROS_KRAKEND_URL: the URL where KrakenD is running.
Value: IP and port.
Optional (if AEROS_AUTHORIZATION is false).
AEROS_CB_CLIENT_ID: the ID of the client provided to the Auth server.
Optional (if AEROS_AUTHORIZATION is false).
AEROS_CB_CLIENT_SECRET: the secret of the client provided to the Auth server.
Optional (if AEROS_AUTHORIZATION is false).
AEROS_ORION_URL: the URL where the context broker is running.
Value: IP and port.
AEROS_CONTAINER_TECHNOLOGY: the container technology of the execution environment.
Value: Kubernetes/Docker.
AEROS_IE_GPU: indicates whether the IE has a GPU.
Value: true/false.
Optional.
AEROS_IE_GPU_MEMORY: indicates the IE’s GPU memory, in Megabytes (MB).
Value: integer.
Optional.
AEROS_IE_NET_SPEED_TEST: indicates whether an IE network speed test should be performed. This could consume network resources.
Value: true/false.
AEROS_POWER_SOURCE: entity ID of the power source (energy production source) that feeds the IE.
Value: NGSI-LD relationship format.
Optional.
AEROS_ENERGY_EFFICIENCY_RATIO: energy efficiency (from 0 to 1) of an IE based on the resources it uses or its computing capacity.
Value: float.
Optional.
AEROS_IE_LOCATION: the vector of coordinates (longitude, latitude) of the physical location of the IE.
Value: [float,float]
AEROS_IE_IP: the IP of the IE where is running the self-awareness module.
Value: IP.
Developer guide
Local deployment (hardware_info)
To test the code locally:
Download script.py file.
Run the following commands to install the necessary dependencies:
apt update apt install -y iproute2 pip3 install getmac psutil quart requests speedtest-cli
In the same directory where the file was downloaded, run the following command to launch the self-awareness (hardware_info):
python3 script.py
Local deployment (power_consumption)
To test the code locally:
Download script.py file.
Run the following commands to install the necessary dependencies:
apt update apt install -y powertop pip3 install getmac pandas quart requests
In the same directory where the file was downloaded, run the following command to launch the self-awareness (power_consumption):
python3 script.py
Sampling frequency
To change the sampling rate at which data is updated in the context broker for each Infrastructure Element, one server has been enabled on port 8002 for hardware_info and another on port 8003 for power_consumption. The operation of both is the same.
The following is an example using cURL to update the hardware_info sample frequency (in seconds):
curl -X 'POST' 'http://[AEROS_IE_IP]:8002/sampling_frequency' -H 'Content-Type: application/json' -d '{ "value": 10 }'
A swagger.yaml file is available for consultation.
The following is an example using cURL to update the power_consumption sample frequency (in seconds):
curl -X 'POST' 'http://[AEROS_IE_IP]:8003/sampling_frequency' -H 'Content-Type: application/json' -d '{ "value": 10 }'
A swagger.yaml file is available for consultation.