banshee is under active development: collectors will keep changing, and a version you publish will likely need adjustments. For stable use, wait for version 1.0.0.

Hardware

banshee/hardware-collection/hardware/pdu/apc/snmp/

phases

The load state, current, voltage and power of an APC rack PDU and of each of its phases by SNMP.

  • hardware
  • pdu
  • apc
  • schneider
  • powernet
  • rack
  • phase
  • power
  • snmp

by banshee0 installations1 version

v1Latest

Published on October 28, 2026. First version.

Keen 1.0.0 · 74 lines
// An APC rack PDU, by SNMP (PowerNet-MIB, rPDU2): for the PDU and for each of its phases, the load state the
// PDU judges against its own thresholds (low, normal, near overload, overload), the current, the voltage and
// the power drawn. A phase is what trips its breaker: its current is the measure to watch. PDUs linked in a
// group (Network Port Sharing) are read through the one that holds the address, each by its number.
need('protocol:snmp');

per('line', 'PDUs and phases');
output('load-state', 'text', array('label' => 'Load state', 'per' => 'line'));
output('current', 'number', array('label' => 'Current', 'unit' => 'A', 'per' => 'line'));
output('voltage', 'number', array('label' => 'Voltage', 'unit' => 'V', 'per' => 'line'));
output('power', 'number', array('label' => 'Power', 'unit' => 'W', 'per' => 'line'));

watch.state('load-state', 'Near overload or overloaded', 'load-state', array('warning' => array('near-overload'), 'critical' => array('overload')));
watch.above('current', 'High current', 'current', array(
    'help'    => 'Raises above the current set on the probe, in amperes, for each phase.',
    'enabled' => false,
));
watch.missing('missing', 'PDU or phase missing', 'load-state', array('enabled' => false));

// rPDU2LoadState: lowLoad (1), normal (2), nearOverload (3), overload (4).
$states = array(1 => 'low', 2 => 'normal', 3 => 'near-overload', 4 => 'overload');

// rPDU2DeviceStatusTable (1.3.6.1.4.1.318.1.1.26.4.3.1): rPDU2DeviceStatusModule, the PDU's number in its
// group; rPDU2DeviceStatusLoadState; rPDU2DeviceStatusPower, in hundredths of kW.
$devices = snmp.table(array(
    'module' => '1.3.6.1.4.1.318.1.1.26.4.3.1.2',
    'state'  => '1.3.6.1.4.1.318.1.1.26.4.3.1.4',
    'power'  => '1.3.6.1.4.1.318.1.1.26.4.3.1.5',
));
// rPDU2PhaseStatusTable (1.3.6.1.4.1.318.1.1.26.6.3.1): rPDU2PhaseStatusModule, rPDU2PhaseStatusNumber,
// rPDU2PhaseStatusLoadState, rPDU2PhaseStatusCurrent in tenths of A, rPDU2PhaseStatusVoltage in V,
// rPDU2PhaseStatusPower in hundredths of kW.
$phases = snmp.table(array(
    'module'  => '1.3.6.1.4.1.318.1.1.26.6.3.1.2',
    'number'  => '1.3.6.1.4.1.318.1.1.26.6.3.1.3',
    'state'   => '1.3.6.1.4.1.318.1.1.26.6.3.1.4',
    'current' => '1.3.6.1.4.1.318.1.1.26.6.3.1.5',
    'voltage' => '1.3.6.1.4.1.318.1.1.26.6.3.1.6',
    'power'   => '1.3.6.1.4.1.318.1.1.26.6.3.1.7',
));

$read = 0;
foreach ($devices as $row) {
    if (!list.has($row, 'module') || !list.has($row, 'state')) {
        continue;
    }
    $name = 'pdu ' . $row['module'];
    value('load-state', list.get($states, $row['state'], 'state ' . $row['state']), $name);
    if (list.has($row, 'power')) {
        value('power', $row['power'] * 10, $name);
    }
    $read = $read + 1;
}
foreach ($phases as $row) {
    if (!list.has($row, 'module') || !list.has($row, 'number') || !list.has($row, 'state')) {
        continue;
    }
    $name = 'pdu ' . $row['module'] . ' L' . $row['number'];
    value('load-state', list.get($states, $row['state'], 'state ' . $row['state']), $name);
    if (list.has($row, 'current')) {
        value('current', $row['current'] / 10, $name);
    }
    if (list.has($row, 'voltage')) {
        value('voltage', $row['voltage'], $name);
    }
    if (list.has($row, 'power')) {
        value('power', $row['power'] * 10, $name);
    }
    $read = $read + 1;
}
if ($read == 0) {
    fail('misconfigured', 'The agent serves no APC rack PDU (rPDU2DeviceStatusTable, rPDU2PhaseStatusTable, PowerNet-MIB)',
        'Not an APC rack PDU of the rPDU2 generation, or a view that does not include 1.3.6.1.4.1.318.1.1.26.');
}