Files
librenms-librenms/includes/discovery/sensors/power/xos.inc.php
Tony Murray f15f8fa63a Sensors remove reliance on global variable (#16344)
* Sensors remove reliance on global variable

* Apply fixes from StyleCI

* Clear the instance instead of reset.
Remove $valid['sensors'] from docs

---------

Co-authored-by: Tony Murray <murrant@users.noreply.github.com>
2024-09-03 21:04:34 -05:00

14 lines
641 B
PHP

<?php
echo ' EXTREME-SYSTEM-MIB ';
// Power Usage
$descr = 'Power Usage';
$oid = '.1.3.6.1.4.1.1916.1.1.1.40.1.0'; // extremeSystemPowerUsage
$value = snmp_get($device, $oid, '-Oqv', 'EXTREME-SYSTEM-MIB');
$divisor = '1000';
if (is_numeric($value)) {
$value = ($value / $divisor); // Nasty hack to divide the first value by 1000 since the divisor only works for polling after the sensor has been added
discover_sensor(null, 'power', $device, $oid, '1', 'extreme-power', $descr, $divisor, 1, null, null, null, null, $value); // No limits have been specified since all equipment is different and will use different amount of Watts
}