Files
librenms-librenms/includes/discovery/sensors/fanspeed/aos.inc.php
joseUPV e0cff12f69 Better Support of Alcatel Switches (#10672)
* Added model, processor, fan and power supply for Alcatel Omnistack Switches

* Removed Index from description of Fan and power supply

* Merged PR #10655

* Added Temperature Sensor for AOS7+ Alcatel Enterprise Switches

* Added AOS7 mempools

* Added Tests

* Update aos.yaml

* Update alerts levels in state sensors

* Add test data
2019-10-20 22:26:21 +00:00

30 lines
1.2 KiB
PHP

<?php
echo "Checking Fan Speed...\n";
$rpm=[];
$rpm_oid = '.1.3.6.1.4.1.6486.801.1.1.1.3.1.1.11.1'; // alaChasEntPhysFanTable
$data = snmp_walk($device, 'alaChasEntPhysFanTable', "-OQUn", 'ALCATEL-IND1-CHASSIS-MIB', ':mibs/nokia/aos7:mibs');
foreach (explode("\n", $data) as $entry) {
list($oid,$value) = explode('=', $entry, 2);
$oid = trim($oid);
$value = trim($value, "\" \\\n\r");
list($revindex, $revchass, $revdata,) = explode('.', strrev($oid), 4);
if (!strstr($value, 'at this OID') && !empty($oid)) {
$chassis=strrev($revchass);
$index=strrev($revindex);
$data=strrev($revdata);
$rpm[$chassis][$index][$data] = $value;
}
}
if (is_array($rpm)) {
foreach ($rpm as $chassis => $entry) {
foreach ($entry as $index => $data) {
$descr = 'Chassis '.($chassis-450). " Fan $index";
$value = $data[4];
$id= "$chassis.$index";
$oid= "$rpm_oid.4.$chassis.$index";
echo "$descr: $value\n";
discover_sensor($valid['sensor'], 'fanspeed', $device, $oid, $id, 'alcatel-lucent', $descr, '1', '1', null, null, null, null, $value, 'snmp');
}
}
}