mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
refactor: Tidy up sensor discovery (#5550)
* 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
This commit is contained in:
committed by
Tony Murray
parent
008af4cea0
commit
d4e8c54516
@@ -1,26 +1,24 @@
|
||||
<?php
|
||||
|
||||
// RFC1628 UPS
|
||||
if (isset($config['modules_compat']['rfc1628'][$device['os']]) && $config['modules_compat']['rfc1628'][$device['os']]) {
|
||||
echo 'RFC1628 ';
|
||||
echo 'RFC1628 ';
|
||||
|
||||
$oids = snmp_walk($device, '.1.3.6.1.2.1.33.1.2.4', '-Osqn', 'UPS-MIB');
|
||||
d_echo($oids."\n");
|
||||
$oids = snmp_walk($device, '.1.3.6.1.2.1.33.1.2.4', '-Osqn', 'UPS-MIB');
|
||||
d_echo($oids."\n");
|
||||
|
||||
$oids = trim($oids);
|
||||
foreach (explode("\n", $oids) as $data) {
|
||||
$data = trim($data);
|
||||
if ($data) {
|
||||
list($oid,$descr) = explode(' ', $data, 2);
|
||||
$split_oid = explode('.', $oid);
|
||||
$current_id = $split_oid[(count($split_oid) - 1)];
|
||||
$current_oid = ".1.3.6.1.2.1.33.1.2.4.$current_id";
|
||||
$current = snmp_get($device, $current_oid, '-O vq');
|
||||
$descr = 'Battery charge remaining'.(count(explode("\n", $oids)) == 1 ? '' : ' '.($current_id + 1));
|
||||
$type = 'rfc1628';
|
||||
$index = (500 + $current_id);
|
||||
$oids = trim($oids);
|
||||
foreach (explode("\n", $oids) as $data) {
|
||||
$data = trim($data);
|
||||
if ($data) {
|
||||
list($oid,$descr) = explode(' ', $data, 2);
|
||||
$split_oid = explode('.', $oid);
|
||||
$current_id = $split_oid[(count($split_oid) - 1)];
|
||||
$current_oid = ".1.3.6.1.2.1.33.1.2.4.$current_id";
|
||||
$current = snmp_get($device, $current_oid, '-O vq');
|
||||
$descr = 'Battery charge remaining'.(count(explode("\n", $oids)) == 1 ? '' : ' '.($current_id + 1));
|
||||
$type = 'rfc1628';
|
||||
$index = (500 + $current_id);
|
||||
|
||||
discover_sensor($valid['sensor'], 'charge', $device, $current_oid, $index, $type, $descr, '1', '1', null, null, null, null, $current);
|
||||
}
|
||||
discover_sensor($valid['sensor'], 'charge', $device, $current_oid, $index, $type, $descr, '1', '1', null, null, null, null, $current);
|
||||
}
|
||||
}//end if
|
||||
}
|
||||
|
Reference in New Issue
Block a user