1 | <?php |
||
2 | /** |
||
3 | * boss.inc.php |
||
4 | * |
||
5 | * LibreNMS Fan and Power Supply state Discovery module for Extreme/Avaya ERS |
||
6 | */ |
||
7 | if ($device['os'] === 'boss') { |
||
8 | $oid = snmpwalk_cache_oid($device, 's5ChasComTable', [], 'S5-CHASSIS-MIB'); |
||
9 | $cur_oid = '.1.3.6.1.4.1.45.1.6.3.3.1.1.10.'; |
||
10 | |||
11 | if (is_array($oid)) { |
||
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
12 | //get states |
||
13 | $state_name = 's5ChasComOperState'; |
||
14 | $states = [ |
||
15 | ['value' => 1, 'generic' => 3, 'graph' => 0, 'descr' => 'other'], |
||
16 | ['value' => 2, 'generic' => 3, 'graph' => 0, 'descr' => 'notAvail'], |
||
17 | ['value' => 3, 'generic' => 3, 'graph' => 0, 'descr' => 'removed'], |
||
18 | ['value' => 4, 'generic' => 3, 'graph' => 0, 'descr' => 'disabled'], |
||
19 | ['value' => 5, 'generic' => 0, 'graph' => 0, 'descr' => 'normal'], |
||
20 | ['value' => 6, 'generic' => 1, 'graph' => 0, 'descr' => 'resetInProg'], |
||
21 | ['value' => 7, 'generic' => 1, 'graph' => 0, 'descr' => 'testing'], |
||
22 | ['value' => 8, 'generic' => 1, 'graph' => 0, 'descr' => 'warning'], |
||
23 | ['value' => 9, 'generic' => 1, 'graph' => 0, 'descr' => 'nonFatalErr'], |
||
24 | ['value' => 10, 'generic' => 2, 'graph' => 0, 'descr' => 'fatalErr'], |
||
25 | ['value' => 11, 'generic' => 3, 'graph' => 0, 'descr' => 'notConfig'], |
||
26 | ['value' => 12, 'generic' => 3, 'graph' => 0, 'descr' => 'obsoleted'], |
||
27 | ]; |
||
28 | create_state_index($state_name, $states); |
||
29 | |||
30 | $ers_sensors = []; |
||
31 | foreach ($oid as $key => $value) { |
||
32 | if ($value['s5ChasComGrpIndx'] == 4 || $value['s5ChasComGrpIndx'] == 5 || $value['s5ChasComGrpIndx'] == 6) { |
||
33 | $ers_sensors[$key] = $value; |
||
34 | } |
||
35 | } |
||
36 | |||
37 | $ps_num = 0; |
||
38 | foreach ($ers_sensors as $index => $entry) { |
||
39 | //Get unit number |
||
40 | $unit_array = explode('.', $index); |
||
41 | $unit = floor($unit_array[1] / 10); |
||
42 | //Set description with Power Supply number |
||
43 | if ($unit_array[0] == 4) { |
||
44 | if ($unit != $temp_unit) { |
||
45 | $ps_num = 1; |
||
46 | } else { |
||
47 | $ps_num++; |
||
48 | } |
||
49 | $descr = "BOSS Unit $unit: Power Supply $ps_num"; |
||
50 | } else { |
||
51 | $descr = "BOSS Unit $unit: $entry[s5ChasComDescr]"; |
||
52 | } |
||
53 | //Discover Sensors |
||
54 | discover_sensor($valid['sensor'], 'state', $device, $cur_oid . $index, "s5ChasComOperState.$index", $state_name, $descr, 1, 1, null, null, null, null, $entry['s5ChasComOperState']); |
||
55 | //Create Sensor To State Index |
||
56 | create_sensor_to_state_index($device, $state_name, "s5ChasComOperState.$index"); |
||
57 | $temp_unit = $unit; |
||
58 | } |
||
59 | } |
||
60 | } |
||
61 |