PowerTOP is a terminal-based diagnosis tool that helps you to monitor power usage by programs running on a Linux system when it is not plugged on to a power source , which makes it suitable for unreliable power sources For PowerTop to work in Edge Devices easily , this a image was to be required , which is build with help of Docker image and is available at DockerHub registry.
Furthermore the stats can be acquired with the help of Prometheus metrics , and can be stored in internal Prometheus TSDB . These data can be really helpful for alert management or even a visual representation of the stats using tools like grafana etc
While running thousands of application in edge devices the monitoring and optimisation of power consumption is crucial
- Linux Environment for running without container
for this powertop is needed to be pre installed
open up a terminal
-
clone the repo
-
go in the folder
cd powertop_monitoring
-
run using go compiler
sudo go run cmd/main.go
powertop requires sudo permission to access the system stats -
bare prometheus metrics can be seen using
curl 0.0.0.0:8887/metrics
- for this you used need --priviledge flag , which would give it access to host energy stats
docker run -d -p 8887:8887 --privileged sibseh/powertopcsv:v2
- bare prometheus metrics can be seen using
curl 0.0.0.0:8887/metrics |grep powertop
These can be run with graphana and prometheus easily with the docker compose file
-
Open up a terminal in the same directory
docker-compose up
-
Open your favourite brower with localhost:3000 , it will open up Graphana, login with username and password both as
admin
-
Go to configuration ->Data sources -> Add Prometheus -> set Http as
http://prometheus:9090
-
Go to create -> Dashboard -> Select one
-
Add powertop_wakeup_count , powertop_baseline_power,powertop_tunable_count,powertop_cpu_usage
6 . Now you can see clearly the parameters of your system calculated !!
The final set up should look like this
Viewing powertop_baseline_power variation