Skip to content
This repository has been archived by the owner on Dec 1, 2024. It is now read-only.

Latest commit

 

History

History
62 lines (34 loc) · 2.56 KB

README.md

File metadata and controls

62 lines (34 loc) · 2.56 KB

PowerTop Monitoring

Using Prometheus and Graphana

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

Local SetUp

Pre-requisite

  1. Linux Environment for running without container

Dev SetUp

for this powertop is needed to be pre installed

open up a terminal

  1. clone the repo

  2. go in the folder cd powertop_monitoring

  3. run using go compiler sudo go run cmd/main.go
    powertop requires sudo permission to access the system stats

  4. bare prometheus metrics can be seen using curl 0.0.0.0:8887/metrics

Running Using Docker

  1. 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
  2. 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

Monitoring with Graphana and Prometheus using docker compose

  1. Open up a terminal in the same directory docker-compose up

  2. Open your favourite brower with localhost:3000 , it will open up Graphana, login with username and password both as admin

  3. Go to configuration ->Data sources -> Add Prometheus -> set Http as http://prometheus:9090

  4. Go to create -> Dashboard -> Select one

  5. 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 Screenshot from 2022-09-02 05-41-50

Viewing powertop_baseline_power variation