mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* refactor: Tidy up sensor discovery * more files * removed uneeded files * updated array check * updates for linux/supermicro * small changes * Update linux.inc.php * Add supermicro temps back to linux.inc.php * No need for is_file on rfc1628.inc.php, it exists * Revert rfc1628 change * Fix whitespace... * rebased * fixed $valid data not being passed to new sensors() function
26 lines
998 B
PHP
26 lines
998 B
PHP
<?php
|
|
|
|
$sensor_type = 'hpblmos_psu_usage';
|
|
$psu_oid = '.1.3.6.1.4.1.232.22.2.5.1.1.1.16';
|
|
$psu_usage_oid = '.1.3.6.1.4.1.232.22.2.5.1.1.1.10.';
|
|
$psu_max_usage_oid = '.1.3.6.1.4.1.232.22.2.5.1.1.1.9.';
|
|
|
|
$psus = trim(snmp_walk($device, $psu_oid, '-Osqn'));
|
|
|
|
foreach (explode("\n", $psus) as $psu) {
|
|
$psu = trim($psu);
|
|
if ($psu) {
|
|
list($oid, $presence) = explode(' ', $psu, 2);
|
|
if ($presence != 2) {
|
|
$split_oid = explode('.', $oid);
|
|
$current_id = $split_oid[(count($split_oid) - 1)];
|
|
$current_oid = $psu_usage_oid.$current_id;
|
|
$psu_max_oid = $psu_max_usage_oid.$current_id;
|
|
$descr = 'PSU '.$current_id.' output';
|
|
$value = snmp_get($device, $current_oid, '-Oqv');
|
|
$max_value = snmp_get($device, $psu_max_oid, '-Oqv');
|
|
discover_sensor($valid['sensor'], 'power', $device, $current_oid, $current_id, $sensor_type, $descr, 1, 1, null, null, null, $max_value, $value);
|
|
}
|
|
}
|
|
}
|