Skip to content

Connect to APC PDU with Redfish

This repo contains a set of Python tools for interacting with an APC PDU via the Redfish API. These scripts support API discovery, telemetry monitoring, and outlet control stress testing.

Recursively crawls the Redfish API starting from the root URI and maps out all reachable endpoints. Useful for reverse engineering the API structure or validating firmware features.

  • Outputs discovered paths to the terminal and saves a Markdown report for documentation.
  • Automatically follows nested links and handles connection errors gracefully.

Example:

Terminal window
python redfish_discovery.py

Edit the script to fill in your PDU IP, credentials, and desired SSL behavior.


Fetches live telemetry from the PDU, including total power usage and status details for individual outlets.

  • Reports power, voltage, current, energy usage, and health info.
  • Outputs formatted tables for clarity.
  • Designed to be run periodically or integrated into monitoring tools.

Example:

Terminal window
python pdu_telemetry.py

Edit the top of the script to configure your PDU IP, port (usually 8443), credentials, and SSL settings.

Example output:

C:\Users\grant\AppData\Local\Programs\Python\Python310\python.exe "C:\Users\grant\Documents\code\dell\Connect to APC PDU with Redfish\pdu_telemetry.py"
### PDU Telemetry Report - 2025-03-28T16:39:41.764492 ###
### PDU Summary Metrics ###
╒═════════════╀═════════════════╀══════════════════╀════════════════╀════════════════╕
β”‚ Power (W) β”‚ Apparent (VA) β”‚ Reactive (VAR) β”‚ Power Factor β”‚ Energy (kWh) β”‚
β•žβ•β•β•β•β•β•β•β•β•β•β•β•β•β•ͺ═════════════════β•ͺ══════════════════β•ͺ════════════════β•ͺ════════════════║
β”‚ 0 β”‚ 0 β”‚ 0 β”‚ 1 β”‚ 937.939 β”‚
β•˜β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•›
### Outlet 1 Status ###
╒═════════════╀══════════════════════════════════════╀══════════╀═════════╀═════════╀═══════════╀══════════════╀═════════════╀══════════════╀════════╀═════════╀═══════╕
β”‚ ID β”‚ Name β”‚ Health β”‚ State β”‚ Power β”‚ Enabled β”‚ Rated Amps β”‚ Nominal V β”‚ V (Actual) β”‚ Amps β”‚ Watts β”‚ kWh β”‚
β•žβ•β•β•β•β•β•β•β•β•β•β•β•β•β•ͺ══════════════════════════════════════β•ͺ══════════β•ͺ═════════β•ͺ═════════β•ͺ═══════════β•ͺ══════════════β•ͺ═════════════β•ͺ══════════════β•ͺ════════β•ͺ═════════β•ͺ═══════║
β”‚ PDU1OUTLET1 β”‚ Outlet PDU1OUTLET1, Branch Circuit A β”‚ OK β”‚ Enabled β”‚ Off β”‚ True β”‚ 10 β”‚ AC208V β”‚ 0 β”‚ 0 β”‚ 0 β”‚ 0 β”‚
β•˜β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•›
### Outlet 2 Status ###
╒══════════╀═══════════════════════════════════╀══════════╀═════════╀═════════╀═══════════╀══════════════╀═════════════╀══════════════╀════════╀═════════╀═══════╕
β”‚ ID β”‚ Name β”‚ Health β”‚ State β”‚ Power β”‚ Enabled β”‚ Rated Amps β”‚ Nominal V β”‚ V (Actual) β”‚ Amps β”‚ Watts β”‚ kWh β”‚
β•žβ•β•β•β•β•β•β•β•β•β•β•ͺ═══════════════════════════════════β•ͺ══════════β•ͺ═════════β•ͺ═════════β•ͺ═══════════β•ͺ══════════════β•ͺ═════════════β•ͺ══════════════β•ͺ════════β•ͺ═════════β•ͺ═══════║
β”‚ OUTLET 2 β”‚ Outlet OUTLET 2, Branch Circuit A β”‚ OK β”‚ Enabled β”‚ On β”‚ True β”‚ 16 β”‚ AC208V β”‚ 0 β”‚ 0 β”‚ 0 β”‚ 0 β”‚
β•˜β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•›
### Outlet 3 Status ###
╒══════════╀═══════════════════════════════════╀══════════╀═════════╀═════════╀═══════════╀══════════════╀═════════════╀══════════════╀════════╀═════════╀═══════╕
β”‚ ID β”‚ Name β”‚ Health β”‚ State β”‚ Power β”‚ Enabled β”‚ Rated Amps β”‚ Nominal V β”‚ V (Actual) β”‚ Amps β”‚ Watts β”‚ kWh β”‚
β•žβ•β•β•β•β•β•β•β•β•β•β•ͺ═══════════════════════════════════β•ͺ══════════β•ͺ═════════β•ͺ═════════β•ͺ═══════════β•ͺ══════════════β•ͺ═════════════β•ͺ══════════════β•ͺ════════β•ͺ═════════β•ͺ═══════║
β”‚ OUTLET 3 β”‚ Outlet OUTLET 3, Branch Circuit A β”‚ OK β”‚ Enabled β”‚ On β”‚ True β”‚ 10 β”‚ AC208V β”‚ 0 β”‚ 0 β”‚ 0 β”‚ 0 β”‚
β•˜β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•›
### Outlet 4 Status ###
╒══════════╀═══════════════════════════════════╀══════════╀═════════╀═════════╀═══════════╀══════════════╀═════════════╀══════════════╀════════╀═════════╀═══════╕
β”‚ ID β”‚ Name β”‚ Health β”‚ State β”‚ Power β”‚ Enabled β”‚ Rated Amps β”‚ Nominal V β”‚ V (Actual) β”‚ Amps β”‚ Watts β”‚ kWh β”‚
β•žβ•β•β•β•β•β•β•β•β•β•β•ͺ═══════════════════════════════════β•ͺ══════════β•ͺ═════════β•ͺ═════════β•ͺ═══════════β•ͺ══════════════β•ͺ═════════════β•ͺ══════════════β•ͺ════════β•ͺ═════════β•ͺ═══════║
β”‚ OUTLET 4 β”‚ Outlet OUTLET 4, Branch Circuit A β”‚ OK β”‚ Enabled β”‚ On β”‚ True β”‚ 16 β”‚ AC208V β”‚ 0 β”‚ 0 β”‚ 0 β”‚ 0 β”‚
β•˜β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•›
Process finished with exit code 0

Sends rapid toggle requests to a specified outlet to simulate control stress or validate firmware stability under load.

  • Supports CLI options for outlet number, duration, interval, SSL, and verbosity.
  • Logs each request and response to a file for auditing/debugging.
  • Tracks success/failure metrics and reports errors at the end.

Examples:

Terminal window
# Basic usage
python stress_test_outlet.py --pdu-ip 192.168.1.100 --username admin --password secret
# Stress outlet 2 for 2 minutes, toggling every 5 seconds
python stress_test_outlet.py --pdu-ip 192.168.1.100 --username admin --password secret --outlet 2 --duration 120 --interval 5
# Enable verbose logging and SSL verification
python stress_test_outlet.py --pdu-ip 192.168.1.100 --username admin --password secret --verify -v

  • All scripts communicate with the Redfish API over HTTPS (default port: 8443).
  • These tools have been tested on APC PDUs but may work with other Redfish-compatible hardware.
  • SSL verification is disabled by default β€” enable it for production use.