1<?php 2/** 3 * voss.inc.php 4 * 5 * LibreNMS Fan and Power Supply state Discovery module for Extreme/Avaya 6 * VOSS(VSP Operating System Software) 7 * 8 * Copyright (c) 2017 Daniel Cox <danielcoxman@gmail.com> 9 * 10 * This program is free software: you can redistribute it and/or modify it 11 * under the terms of the GNU General Public License as published by the 12 * Free Software Foundation, either version 3 of the License, or (at your 13 * option) any later version. Please see LICENSE.txt at the top level of 14 * the source code distribution for details. 15 * 16 * rcVossSystemFanInfoOperStatus or rcChasFanOperStatus 17 * unknown(1), 18 * up(2), 19 * down(3), 20 * notpresent(4) 21 */ 22$voss_fan = snmpwalk_cache_multi_oid($device, 'rcVossSystemFanInfoOperStatus', [], 'RAPID-CITY'); 23$fan = snmpwalk_cache_multi_oid($device, 'rcChasFanOperStatus', [], 'RAPID-CITY'); 24 25if (is_array($voss_fan)) { 26 foreach ($voss_fan as $oid => $array) { 27 $state = current($array); 28 $split_oid = explode('.', $oid); 29 $tray_num = $split_oid[(count($split_oid) - 2)]; 30 $fan_num = $split_oid[(count($split_oid) - 1)]; 31 $current_oid = ".1.3.6.1.4.1.2272.1.101.1.1.4.1.4.$tray_num.$fan_num"; 32 $descr = "VOSS Tray $tray_num Fan $fan_num"; 33 34 $state_name = 'rcVossSystemFanInfoOperStatus'; 35 $states = [ 36 ['value' => 1, 'generic' => 3, 'graph' => 0, 'descr' => 'unknown'], 37 ['value' => 2, 'generic' => 0, 'graph' => 0, 'descr' => 'up'], 38 ['value' => 3, 'generic' => 1, 'graph' => 0, 'descr' => 'down'], 39 ['value' => 4, 'generic' => 3, 'graph' => 0, 'descr' => 'notPresent'], 40 ]; 41 create_state_index($state_name, $states); 42 43 discover_sensor($valid['sensor'], 'state', $device, $current_oid, "rcVossSystemFanInfoOperStatus.$tray_num.$fan_num", $state_name, $descr, 1, 1, null, null, 3, 3, $state); 44 create_sensor_to_state_index($device, $state_name, "rcVossSystemFanInfoOperStatus.$tray_num.$fan_num"); 45 } 46} elseif (is_array($fan)) { 47 foreach ($fan as $oid => $array) { 48 $state = current($array); 49 $split_oid = explode('.', $oid); 50 $index = $split_oid[(count($split_oid) - 1)]; 51 $current_oid = ".1.3.6.1.4.1.2272.1.4.7.1.1.2.$index"; 52 $descr = "VOSS Fan $index"; 53 54 $state_name = 'rcChasFanOperStatus'; 55 $states = [ 56 ['value' => 1, 'generic' => 3, 'graph' => 0, 'descr' => 'unknown'], 57 ['value' => 2, 'generic' => 0, 'graph' => 0, 'descr' => 'up'], 58 ['value' => 3, 'generic' => 1, 'graph' => 0, 'descr' => 'down'], 59 ['value' => 4, 'generic' => 3, 'graph' => 0, 'descr' => 'notPresent'], 60 ]; 61 create_state_index($state_name, $states); 62 63 discover_sensor($valid['sensor'], 'state', $device, $current_oid, "rcChasFanOperStatus.$index", $state_name, $descr, 1, 1, null, null, 3, 3, $state); 64 create_sensor_to_state_index($device, $state_name, "rcChasFanOperStatus.$index"); 65 } 66} 67 68/* rcChasPowerSupplyOperStatus 69 * unknown(1), 70 * empty(2), 71 * up(3), 72 * down(4) 73*/ 74 75$power_supply = snmpwalk_cache_multi_oid($device, 'rcChasPowerSupplyOperStatus', [], 'RAPID-CITY'); 76 77if (is_array($power_supply)) { 78 foreach ($power_supply as $oid => $array) { 79 $state = current($array); 80 $split_oid = explode('.', $oid); 81 $index = $split_oid[(count($split_oid) - 1)]; 82 $current_oid = ".1.3.6.1.4.1.2272.1.4.8.1.1.2.$index"; 83 $descr = "VOSS Power Supply $index"; 84 85 $state_name = 'rcChasPowerSupplyOperStatus'; 86 $states = [ 87 ['value' => 1, 'generic' => 3, 'graph' => 0, 'descr' => 'unknown'], 88 ['value' => 2, 'generic' => 0, 'graph' => 0, 'descr' => 'empty'], 89 ['value' => 3, 'generic' => 0, 'graph' => 0, 'descr' => 'up'], 90 ['value' => 4, 'generic' => 1, 'graph' => 0, 'descr' => 'down'], 91 ]; 92 create_state_index($state_name, $states); 93 94 discover_sensor($valid['sensor'], 'state', $device, $current_oid, "rcChasPowerSupplyOperStatus.$index", $state_name, $descr, 1, 1, null, null, 4, 4, $state); 95 create_sensor_to_state_index($device, $state_name, "rcChasPowerSupplyOperStatus.$index"); 96 } 97} 98