Skip to content

pptam/pptam-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PPTAM Agent: Power and Performance Telemetry Agent ⚙️

This is a robust telemetry agent designed to be deployed within a testbed environment to monitor and collect power consumption and performance data from both Docker containers and the host system. It actively manages monitoring processes and provides comprehensive access and control via a REST API.

✨ Key Features

The agent provides a comprehensive monitoring and data collection suite:

  1. Container Power Monitoring: Actively monitors running Docker containers and initiates per-process ID (PID) power consumption tracking using the PowerJoular utility. Monitoring starts automatically when a new PID appears.
  2. Host Performance & Power Data: Initiates and manages a background process (using perf_power_monitor.sh) to collect host system power and performance data using the perf Linux utility.
  3. Dynamic Process Management: Automatically starts PowerJoular for new PIDs and gracefully terminates them when the PID or container disappears.
  4. RESTful Control & Data Access: Implements a Flask web server on Port 7333 for data retrieval, file download, and full measurement session reset.

🚀 Installation & Setup

This agent is intended to be run directly on the target testbed host.

Prerequisites

  • Python 3.x
  • Docker Engine (installed and running)
  • PowerJoular (must be installed on the host system)
  • perf utility (usually installed via the linux-tools package on the host)
  • sudo access for running monitoring tools (PowerJoular and perf_power_monitor.sh)
  • perf_power_monitor.sh script must be available in the same directory or in the system PATH.

Installation Steps

  1. Clone the Repository:
    git clone [YOUR_REPO_URL]
    cd pptam-agent
  2. Install Python Dependencies:
    pip install -r requirements.txt
  3. Run the Agent:
    python [YOUR_MAIN_FILE_NAME].py 
    # The default port is 7333

⚙️ Configuration

The following parameters are configured within the main agent script:

  • Port: PORT = 7333
  • Polling Interval: REFRESH_INTERVAL_SECONDS = 1 (Time between checking Docker containers)
  • Log Directory: PID_LOG_DIR = "pid-log" (Directory where all data files and agent logs are stored)

💻 API Endpoints (Base URL: http://<host-ip>:7333)

The agent exposes several endpoints for operational control and data retrieval.

Endpoint Method Description
/ or /data GET Get Status Snapshot. Returns a JSON snapshot of currently monitored containers and their PIDs, including monitoring status (RUNNING, CLOSING, END).
/files GET List Files. Returns a list of all data/log filenames currently stored in the pid-log directory.
/file/<filename> GET Get Single File Content. Returns the content of a specific file from the pid-log directory. Parameter: Add ?keep=true to prevent deletion after download (default is deletion).
/download-all GET Download All Data. Returns a single JSON object containing the content of all files in the pid-log directory and the primary perf_power.csv file. Files are not deleted upon download.
/reset POST/GET Reset Measurement. Crucial operational endpoint that performs a full reset: 1) Stops all active PowerJoular processes. 2) Clears all files from the pid-log directory. 3) Clears the in-memory data store.

📂 Data File Structure

All monitoring data is stored in the pid-log directory:

  • PID Data: Files named pid_<container-short-id>_<pid-number> contain PowerJoular data for individual processes.
  • Host Data: The perf_power.csv file (usually generated in the repository root or pid-log) contains the host-level performance data collected by the perf utility.

📄 License

This project is licensed under the MIT.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published