mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* Add TiMOS temperature and power supply state sensors. * Refactor the sensor discovery, making it a little cleaner * Discover TiMOS device serial number Pull proper hardware OID instead of parsing sysDescr * Make the style gods happy * Refactoring for some of the requested changes * Break out the arrays into variables as scrutinizer requests... * Fix missing semicolon
30 lines
1.3 KiB
PHP
30 lines
1.3 KiB
PHP
<?php
|
|
|
|
//SNMPv2-SMI::enterprises.6527.3.1.2.1.1.5.0 = Gauge32: 9 - sgiSwMajorVersion
|
|
//SNMPv2-SMI::enterprises.6527.3.1.2.1.1.6.0 = Gauge32: 0 - sgiSwMinorVersion
|
|
//SNMPv2-SMI::enterprises.6527.3.1.2.1.1.7.0 = STRING: "R3" - sgiSwVersionModifier
|
|
|
|
$majorVersion = trim(snmp_get($device, '1.3.6.1.4.1.6527.3.1.2.1.1.5.0', '-OQv', '', ''), '" ');
|
|
$minorVersion = trim(snmp_get($device, '1.3.6.1.4.1.6527.3.1.2.1.1.6.0', '-OQv', '', ''), '" ');
|
|
$versionModifier = trim(snmp_get($device, '1.3.6.1.4.1.6527.3.1.2.1.1.7.0', '-OQv', '', ''), '" ');
|
|
|
|
$version = 'v' . $majorVersion . '.' . $minorVersion . '.' . $versionModifier;
|
|
|
|
$chassis_type_name_array = snmpwalk_cache_oid($device, 'tmnxChassisTypeName', $a = array(), 'TIMETRA-CHASSIS-MIB', 'aos', '-OQUs');
|
|
|
|
$hardware_array = reset($chassis_type_name_array);
|
|
$hardware = end($hardware_array);
|
|
|
|
$props = snmpwalk_cache_numerical_oid($device, 'tmnxHwEntry.7', $props = array(), 'TIMETRA-CHASSIS-MIB', 'aos', '-OQne');
|
|
foreach ($props as $p) {
|
|
foreach ($p as $k => $v) {
|
|
if ($v == 3) {
|
|
$shrapnel = explode('.', $k);
|
|
$unitID = end($shrapnel);
|
|
$serial = snmp_get($device, "1.3.6.1.4.1.6527.3.1.2.2.1.8.1.5.1.$unitID", '-OQv', 'TIMETRA-CHASSIS-MIB', 'aos');
|
|
unset($shrapnel);
|
|
}
|
|
}
|
|
}
|
|
unset($props, $p, $k, $v, $unitID);
|