Hardware
banshee/hardware-collection/hardware/ups/eaton/snmp/
status
The battery fault, battery age, battery management state, battery test, source, runtime and load of an Eaton UPS by SNMP.
by banshee0 installations1 version
Published on October 28, 2026. First version.
// An Eaton UPS, by SNMP, through its network card (XUPS-MIB): what UPS-MIB does not say, a battery fault or a
// failed battery test, a battery too old, and the state of the charger's Advanced Battery Management (ABM:
// charging, floating, resting, or "check battery"); with what feeds the output in Eaton's words (the
// high-efficiency and parallel modes), the runtime, charge and load, so that one probe is enough on a card
// where UPS-MIB is off.
need('protocol:snmp');
output('source', 'text', array('label' => 'Output source'));
output('battery-fault', 'text', array('label' => 'Battery fault'));
output('battery-aged', 'text', array('label' => 'Battery too old'));
output('abm', 'text', array('label' => 'Battery management state'));
output('battery-test', 'text', array('label' => 'Last battery test'));
output('runtime', 'number', array('label' => 'Runtime left', 'unit' => 'min'));
output('charge', 'number', array('label' => 'Battery charge', 'unit' => '%'));
output('load', 'number', array('label' => 'Load', 'unit' => '%'));
watch.state('on-battery', 'On battery, bypass or off', 'source', array(
'warning' => array('battery', 'bypass', 'maintenance-bypass'),
'critical' => array('none'),
));
watch.state('battery-fault', 'Battery fault', 'battery-fault', array('critical' => array('yes')));
watch.state('battery-aged', 'Battery too old', 'battery-aged', array('warning' => array('yes')));
watch.state('abm', 'Battery to check', 'abm', array('warning' => array('check-battery', 'disconnected')));
watch.state('battery-test', 'Battery test failed', 'battery-test', array('critical' => array('failed')));
watch.below('runtime', 'Little runtime left', 'runtime', array('warning' => 15, 'critical' => 5));
watch.below('charge', 'Battery not charged', 'charge', array('warning' => 50, 'critical' => 20, 'for' => '2 runs'));
watch.above('load', 'Overloaded', 'load', array('warning' => 80, 'critical' => 95, 'for' => '3 runs'));
// XUPS-MIB, under xupsMIB (1.3.6.1.4.1.534.1), three small branches; each key is the rest of the OID: '1.0'
// is xupsBatTimeRemaining.0 in the first.
$battery = snmp.walk('1.3.6.1.4.1.534.1.2');
$output = snmp.walk('1.3.6.1.4.1.534.1.4');
$test = snmp.walk('1.3.6.1.4.1.534.1.8');
if (!list.has($output, '5.0') && !list.has($battery, '5.0')) {
fail('misconfigured', 'The agent serves no Eaton UPS state (xupsOutputSource, xupsBatteryAbmStatus, XUPS-MIB)',
'Not an Eaton UPS, or a view that does not include 1.3.6.1.4.1.534.1.');
}
// xupsOutputSource.
$sources = array(1 => 'other', 2 => 'none', 3 => 'normal', 4 => 'bypass', 5 => 'battery', 6 => 'booster',
7 => 'reducer', 8 => 'parallel-capacity', 9 => 'parallel-redundant', 10 => 'high-efficiency',
11 => 'maintenance-bypass', 12 => 'ess-mode');
if (list.has($output, '5.0')) {
value('source', list.get($sources, $output['5.0'], 'source ' . $output['5.0']));
}
// xupsOutputLoad, in % of the UPS's capacity.
if (list.has($output, '1.0')) {
value('load', $output['1.0']);
}
// xupsBatteryFailure (a battery fault, or a battery test failed) and xupsBatteryAged: yes (1), no (2).
$answers = array(1 => 'yes', 2 => 'no');
if (list.has($battery, '7.0')) {
value('battery-fault', list.get($answers, $battery['7.0'], 'unknown'));
}
if (list.has($battery, '9.0')) {
value('battery-aged', list.get($answers, $battery['9.0'], 'unknown'));
}
// xupsBatteryAbmStatus.
$abm = array(1 => 'charging', 2 => 'discharging', 3 => 'floating', 4 => 'resting', 5 => 'unknown',
6 => 'disconnected', 7 => 'under-test', 8 => 'check-battery');
if (list.has($battery, '5.0')) {
value('abm', list.get($abm, $battery['5.0'], 'unknown'));
}
// xupsBatTimeRemaining, in seconds; xupsBatCapacity, in %.
if (list.has($battery, '1.0')) {
value('runtime', number.round($battery['1.0'] / 60, 1));
}
if (list.has($battery, '4.0')) {
value('charge', $battery['4.0']);
}
// xupsTestBatteryStatus, the last battery test.
$tests = array(1 => 'unknown', 2 => 'passed', 3 => 'failed', 4 => 'in-progress', 5 => 'not-supported',
6 => 'inhibited', 7 => 'scheduled');
if (list.has($test, '2.0')) {
value('battery-test', list.get($tests, $test['2.0'], 'unknown'));
}