mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix sentry3 voltage sensors (#9649)
* Fix sentry3 voltage sensors * don't need check, fix array to string conversion
This commit is contained in:
@@ -1,25 +1,26 @@
|
||||
<?php
|
||||
|
||||
$oids = snmp_walk($device, 'infeedVoltage', '-OsqnU', 'Sentry3-MIB');
|
||||
d_echo($oids."\n");
|
||||
$oids = snmpwalk_group($device, 'infeedVoltage', 'Sentry3-MIB', 2);
|
||||
d_echo($oids);
|
||||
|
||||
if ($oids) {
|
||||
echo 'Sentry3-MIB ';
|
||||
|
||||
$divisor = 10;
|
||||
$type = 'sentry3';
|
||||
|
||||
foreach (explode("\n", $oids) as $data) {
|
||||
$data = trim($data);
|
||||
if ($data) {
|
||||
list($oid,$descr) = explode(' ', $data, 2);
|
||||
$split_oid = explode('.', $oid);
|
||||
$descr = 'Tower '.$index;
|
||||
$index = $split_oid[(count($split_oid) - 1)];
|
||||
$oid = '.1.3.6.1.4.1.1718.3.2.2.1.11.1.'.$index;
|
||||
$current = (snmp_get($device, $oid, '-Oqv') / $divisor);
|
||||
|
||||
discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
|
||||
}
|
||||
foreach ($oids as $index => $first) {
|
||||
foreach ($first as $end => $data) {
|
||||
$divisor = 10;
|
||||
discover_sensor(
|
||||
$valid['sensor'],
|
||||
'voltage',
|
||||
$device,
|
||||
".1.3.6.1.4.1.1718.3.2.2.1.11.1.$index.$end",
|
||||
$index,
|
||||
'sentry3',
|
||||
'Tower ' . $index,
|
||||
$divisor,
|
||||
1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
empty($data['infeedVoltage']) ? 0 : ($data['infeedVoltage'] / $divisor)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user